[Netfilter] Exit on log line error in pubsub
This commit is contained in:
parent
dfe43f56bf
commit
edf1a4fb1f
@ -309,9 +309,12 @@ def watch():
|
|||||||
logInfo('Watching Redis channel F2B_CHANNEL')
|
logInfo('Watching Redis channel F2B_CHANNEL')
|
||||||
pubsub.subscribe('F2B_CHANNEL')
|
pubsub.subscribe('F2B_CHANNEL')
|
||||||
|
|
||||||
|
global quit_now
|
||||||
|
global exit_code
|
||||||
|
|
||||||
while not quit_now:
|
while not quit_now:
|
||||||
for item in pubsub.listen():
|
|
||||||
try:
|
try:
|
||||||
|
for item in pubsub.listen():
|
||||||
refreshF2bregex()
|
refreshF2bregex()
|
||||||
for rule_id, rule_regex in f2bregex.items():
|
for rule_id, rule_regex in f2bregex.items():
|
||||||
if item['data'] and item['type'] == 'message':
|
if item['data'] and item['type'] == 'message':
|
||||||
@ -327,8 +330,9 @@ def watch():
|
|||||||
logWarn('%s matched rule id %s (%s)' % (addr, rule_id, item['data']))
|
logWarn('%s matched rule id %s (%s)' % (addr, rule_id, item['data']))
|
||||||
ban(addr)
|
ban(addr)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logWarn('Could not read logline from pubsub, skipping...')
|
logWarn('Error reading log line from pubsub')
|
||||||
continue
|
quit_now = True
|
||||||
|
exit_code = 2
|
||||||
|
|
||||||
def snat4(snat_target):
|
def snat4(snat_target):
|
||||||
global lock
|
global lock
|
||||||
|
Loading…
Reference in New Issue
Block a user