mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
changehost: add enable and enforce as network specific options.
Closes #611.
This commit is contained in:
parent
da67d6c42f
commit
f99be51515
@ -685,13 +685,17 @@ changehost:
|
|||||||
# Sets the networks where Changehost should be enabled. Please note: changehost does NOT support
|
# Sets the networks where Changehost should be enabled. Please note: changehost does NOT support
|
||||||
# arbitrarily cloaking clients introduced by PyLink (e.g. relay clients), as doing so would make
|
# arbitrarily cloaking clients introduced by PyLink (e.g. relay clients), as doing so would make
|
||||||
# ban matching impossible. In these cases, it is the remote admin's job to turn on cloaking on
|
# ban matching impossible. In these cases, it is the remote admin's job to turn on cloaking on
|
||||||
# their IRCd!
|
# their IRCd.
|
||||||
|
# You can also add to this list of enabled networks by setting "servers::<server name>::changehost_enable"
|
||||||
|
# to true.
|
||||||
enabled_nets:
|
enabled_nets:
|
||||||
- inspnet
|
- inspnet
|
||||||
- ts6net
|
- ts6net
|
||||||
|
|
||||||
# Sets the networks where Changehost hosts should be enforced: that is, any attempts
|
# Sets the networks where Changehost hosts should be enforced: that is, any attempts
|
||||||
# by the user or other services to overwrite a host will be reverted.
|
# by the user or other services to overwrite a host will be reverted.
|
||||||
|
# You can also add to this list of enabled networks by setting "servers::<server name>::changehost_enforce"
|
||||||
|
# to true.
|
||||||
#enforced_nets:
|
#enforced_nets:
|
||||||
# - inspnet
|
# - inspnet
|
||||||
|
|
||||||
@ -709,9 +713,8 @@ changehost:
|
|||||||
#match_ip: false
|
#match_ip: false
|
||||||
#match_realhosts: false
|
#match_realhosts: false
|
||||||
|
|
||||||
# This sets the hostmasks that Changehost should look for. Whenever someone
|
# This sets the hostmasks that Changehost should look for. Whenever someone with a matching nick!user@host
|
||||||
# with a matching nick!user@host connects, their host will be set to the
|
# connects, their host will be set to the text defined. The following substitutions are available here:
|
||||||
# text defined. The following substitutions are available here:
|
|
||||||
# $uid, $ts (time of connection), $nick, $realhost, $ident, and $ip.
|
# $uid, $ts (time of connection), $nick, $realhost, $ident, and $ip.
|
||||||
# Invalid characters in hosts are replaced with a "-".
|
# Invalid characters in hosts are replaced with a "-".
|
||||||
# Also, make sure you quote each entry so the YAML parser treats them as raw strings.
|
# Also, make sure you quote each entry so the YAML parser treats them as raw strings.
|
||||||
|
@ -19,11 +19,7 @@ def _changehost(irc, target):
|
|||||||
log.debug('(%s) Skipping changehost on internal client %s', irc.name, target)
|
log.debug('(%s) Skipping changehost on internal client %s', irc.name, target)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not changehost_conf:
|
if irc.name not in changehost_conf.get('enabled_nets') and not irc.serverdata.get('changehost_enable'):
|
||||||
log.warning("(%s) Missing 'changehost:' configuration block; "
|
|
||||||
"Changehost will not function correctly!", irc.name)
|
|
||||||
return
|
|
||||||
elif irc.name not in changehost_conf.get('enabled_nets'):
|
|
||||||
# We're not enabled on the network, break.
|
# We're not enabled on the network, break.
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -89,14 +85,12 @@ def handle_chghost(irc, sender, command, args):
|
|||||||
"""
|
"""
|
||||||
Handles incoming CHGHOST requests for optional host-change enforcement.
|
Handles incoming CHGHOST requests for optional host-change enforcement.
|
||||||
"""
|
"""
|
||||||
changehost_conf = conf.conf.get("changehost")
|
changehost_conf = conf.conf.get("changehost", {})
|
||||||
if not changehost_conf:
|
|
||||||
return
|
|
||||||
|
|
||||||
target = args['target']
|
target = args['target']
|
||||||
|
|
||||||
if (not irc.is_internal_client(sender)) and (not irc.is_internal_server(sender)):
|
if (not irc.is_internal_client(sender)) and (not irc.is_internal_server(sender)):
|
||||||
if irc.name in changehost_conf.get('enforced_nets', []):
|
if irc.name in changehost_conf.get('enforced_nets', []) or irc.serverdata.get('changehost_enforce'):
|
||||||
log.debug('(%s) Enforce for network is on, re-checking host for target %s/%s',
|
log.debug('(%s) Enforce for network is on, re-checking host for target %s/%s',
|
||||||
irc.name, target, irc.get_friendly_name(target))
|
irc.name, target, irc.get_friendly_name(target))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user