From 6ee2ec8a2d52317b807b0a0de228a58a604cf416 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 19 Sep 2015 10:17:25 -0700 Subject: [PATCH] relay: make oper status/IP hiding configurable Closes #108. --- config.yml.example | 16 ++++++++++++++++ plugins/relay.py | 19 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/config.yml.example b/config.yml.example index e11cd60..c638978 100644 --- a/config.yml.example +++ b/config.yml.example @@ -20,6 +20,22 @@ login: user: admin password: changeme +relay: + # This block defines various options for the Relay plugin. You don't need this + # if you aren't using it. + + # Determines whether remote opers will have user mode +H (hideoper) set on them. + # This has the benefit of lowering the oper count in /lusers and /stats (P|p), + # but only on IRCds that supported the mode. + # It defaults to true if not set. + hideoper: true + + # Determines whether real IPs should be sent across the relay. You should + # generally have a consensus with your linked networks whether this should + # be turned on. You will see other networks' user IP addresses, and they + # will see yours. + show_ips: false + servers: yournet: # Server IP, port, and passwords diff --git a/plugins/relay.py b/plugins/relay.py index f0f2652..035da09 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -203,14 +203,29 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True): # Set hideoper on remote opers, to prevent inflating # /lusers and various /stats hideoper_mode = remoteirc.umodes.get('hideoper') - if hideoper_mode: + try: + use_hideoper = irc.conf['relay']['hideoper'] + except KeyError: + use_hideoper = True + if hideoper_mode and use_hideoper: modes.append((hideoper_mode, None)) rsid = getRemoteSid(remoteirc, irc) + try: + showRealIP = irc.conf['relay']['show_ips'] + except KeyError: + showRealIP = False + if showRealIP: + ip = userobj.ip + realhost = userobj.realhost + else: + realhost = None + ip = '0.0.0.0' try: u = remoteirc.proto.spawnClient(nick, ident=ident, host=host, realname=realname, modes=modes, ts=userobj.ts, - opertype=opertype, server=rsid).uid + opertype=opertype, server=rsid, + ip=ip, realhost=realhost).uid except ValueError: log.exception('(%s) Failed to spawn relay user %s on %s.', irc.name, nick, remoteirc.name)