mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
parent
b3075d3414
commit
a8fe353ba4
1
conf.py
1
conf.py
@ -86,6 +86,7 @@ def validateConf(conf, logger=None):
|
|||||||
if newlogins:
|
if newlogins:
|
||||||
validate(conf.get('permissions'), "New-style accounts enabled but no permissions block was found. You will not be able to administrate your PyLink instance!")
|
validate(conf.get('permissions'), "New-style accounts enabled but no permissions block was found. You will not be able to administrate your PyLink instance!")
|
||||||
|
|
||||||
|
|
||||||
return conf
|
return conf
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,6 +382,10 @@ plugins:
|
|||||||
# Servermaps plugin: displays network /map's from the PyLink server's perspective.
|
# Servermaps plugin: displays network /map's from the PyLink server's perspective.
|
||||||
#- servermaps
|
#- servermaps
|
||||||
|
|
||||||
|
# Servprotect plugin: disconnects from network if a certain limit
|
||||||
|
# of kills/saves per X seconds is met.
|
||||||
|
#- servprotect
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
# This configuration block defines targets that PyLink should log commands,
|
# This configuration block defines targets that PyLink should log commands,
|
||||||
# errors, etc., to.
|
# errors, etc., to.
|
||||||
@ -566,6 +570,20 @@ relay:
|
|||||||
#
|
#
|
||||||
#clientbot_modesync: none
|
#clientbot_modesync: none
|
||||||
|
|
||||||
|
#servprotect:
|
||||||
|
# This block configures the servprotect plugin.
|
||||||
|
# You don't need this if you aren't using it.
|
||||||
|
|
||||||
|
# length: How many KILL/SAVE's before a disconnect
|
||||||
|
|
||||||
|
#length: 5
|
||||||
|
|
||||||
|
# time: Determines how much time should pass before
|
||||||
|
# the servprotect cache is reset.
|
||||||
|
|
||||||
|
#max_age: 10
|
||||||
|
|
||||||
|
|
||||||
automode:
|
automode:
|
||||||
# The following options in this block are common to all plugins that spawn service bots (games,
|
# The following options in this block are common to all plugins that spawn service bots (games,
|
||||||
# automode, etc.):
|
# automode, etc.):
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
# servprotect.py: Protects against KILL and nick collision floods
|
# servprotect.py: Protects against KILL and nick collision floods
|
||||||
from expiringdict import ExpiringDict
|
from expiringdict import ExpiringDict
|
||||||
|
|
||||||
from pylinkirc import utils
|
from pylinkirc import utils, conf
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
# TODO: make length and time configurable
|
# check for definitions
|
||||||
savecache = ExpiringDict(max_len=5, max_age_seconds=10)
|
servprotect_conf = conf.conf.get('servprotect', {})
|
||||||
killcache = ExpiringDict(max_len=5, max_age_seconds=10)
|
length = servprotect_conf.get('length,' 5)
|
||||||
|
age = servprotect_conf.get('age', 10)
|
||||||
|
|
||||||
|
savecache = ExpiringDict(max_len=length, max_age_seconds=age)
|
||||||
|
killcache = ExpiringDict(max_len=length, max_age_seconds=age)
|
||||||
|
|
||||||
def handle_kill(irc, numeric, command, args):
|
def handle_kill(irc, numeric, command, args):
|
||||||
"""
|
"""
|
||||||
Tracks kills against PyLink clients. If too many are received,
|
Tracks kills against PyLink clients. If too many are received,
|
||||||
automatically disconnects from the network.
|
automatically disconnects from the network.
|
||||||
"""
|
"""
|
||||||
if killcache.setdefault(irc.name, 1) >= 5:
|
if killcache.setdefault(irc.name, 1) >= length:
|
||||||
log.error('(%s) servprotect: Too many kills received, aborting!', irc.name)
|
log.error('(%s) servprotect: Too many kills received, aborting!', irc.name)
|
||||||
irc.disconnect()
|
irc.disconnect()
|
||||||
|
|
||||||
@ -27,7 +31,7 @@ def handle_save(irc, numeric, command, args):
|
|||||||
Tracks SAVEs (nick collision) against PyLink clients. If too many are received,
|
Tracks SAVEs (nick collision) against PyLink clients. If too many are received,
|
||||||
automatically disconnects from the network.
|
automatically disconnects from the network.
|
||||||
"""
|
"""
|
||||||
if savecache.setdefault(irc.name, 0) >= 5:
|
if savecache.setdefault(irc.name, 0) >= length:
|
||||||
log.error('(%s) servprotect: Too many nick collisions, aborting!', irc.name)
|
log.error('(%s) servprotect: Too many nick collisions, aborting!', irc.name)
|
||||||
irc.disconnect()
|
irc.disconnect()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user