[Netfilter] Do not delete SNAT rule if not on first position

master
andryyy 2018-12-01 21:17:08 +01:00
parent 57aa379a2a
commit 45ecc26a12
2 changed files with 7 additions and 7 deletions

View File

@ -301,12 +301,12 @@ def snat4(snat_target):
print log['message'] print log['message']
chain.insert_rule(get_snat4_rule()) chain.insert_rule(get_snat4_rule())
table.commit() table.commit()
else: #else:
for position, item in enumerate(chain.rules): # for position, item in enumerate(chain.rules):
if item == get_snat4_rule(): # if item == get_snat4_rule():
if position != 0: # if position != 0:
chain.delete_rule(get_snat4_rule()) # chain.delete_rule(get_snat4_rule())
table.commit() # table.commit()
table.autocommit = True table.autocommit = True
except: except:
print 'Error running SNAT4, retrying...' print 'Error running SNAT4, retrying...'

View File

@ -318,7 +318,7 @@ services:
- acme - acme
netfilter-mailcow: netfilter-mailcow:
image: mailcow/netfilter:1.19 image: mailcow/netfilter:1.20
build: ./data/Dockerfiles/netfilter build: ./data/Dockerfiles/netfilter
stop_grace_period: 30s stop_grace_period: 30s
depends_on: depends_on: