Décomposition de l'analyse des regles pour detecter plus facilement
une desynchronisation des firewalls, en attendant de trouver un moyen plus automatique. darcs-hash:20070901152243-72cb0-4ef3180254ceaba433de7d38c567c3c85531e788.gz
This commit is contained in:
parent
dce68b1bf5
commit
ab6cc70394
1 changed files with 28 additions and 7 deletions
|
@ -28,17 +28,38 @@ if arg == "config" :
|
||||||
for chain in CHAINS :
|
for chain in CHAINS :
|
||||||
nom = string.lower(chain.replace('_', '').replace('-', '').replace('.','').replace('/', ''))
|
nom = string.lower(chain.replace('_', '').replace('-', '').replace('.','').replace('/', ''))
|
||||||
label = chain.replace('_', '-').replace('.','-').replace('/','-')
|
label = chain.replace('_', '-').replace('.','-').replace('/','-')
|
||||||
print "%s.label %s" % (nom, label)
|
if label != "TEST-MAC-IP" :
|
||||||
if CHAINS.index(chain) == 0 :
|
print "%s.label %s" % (nom, label)
|
||||||
print "%s.draw AREA" % nom
|
if CHAINS.index(chain) == 0 :
|
||||||
|
print "%s.draw AREA" % nom
|
||||||
|
else :
|
||||||
|
print "%s.draw STACK" % nom
|
||||||
else :
|
else :
|
||||||
print "%s.draw STACK" % nom
|
print "%sadm.label %s-adm" % (nom, label)
|
||||||
if label == "TEST-MAC-IP" :
|
print "%sadm.draw STACK" % nom
|
||||||
|
for subnet in range(136,152):
|
||||||
|
print "%s%s.label %s-%s" % (nom, subnet, label, subnet)
|
||||||
|
print "%s%s.draw STACK" % (nom, subnet)
|
||||||
|
print "%s.label %s" % (nom, label)
|
||||||
print "%s.warning 100:2500" % nom
|
print "%s.warning 100:2500" % nom
|
||||||
print "%s.critical 1:3000" % nom
|
print "%s.critical 1:3000" % nom
|
||||||
|
|
||||||
else :
|
else :
|
||||||
for chain in CHAINS :
|
for chain in CHAINS :
|
||||||
nom = string.lower(chain.replace('_', '').replace('-', '').replace('.','').replace('/', ''))
|
nom = string.lower(chain.replace('_', '').replace('-', '').replace('.','').replace('/', ''))
|
||||||
value = int(commands.getoutput('%s %s | wc -l' % (IPTABLES, chain))) - 2
|
label = chain.replace('_', '-').replace('.','-').replace('/','-')
|
||||||
print "%s.value %d" % (nom, value)
|
if label == "TEST-MAC-IP" :
|
||||||
|
data = commands.getoutput("%s %s | awk '{print $4}' | grep 231 | awk -F '.' '{print $1$2$3}' | sort | uniq -c | grep 231" % (IPTABLES, chain)).split('\n')
|
||||||
|
total = 0
|
||||||
|
for line in data :
|
||||||
|
value, subnet = line.split()
|
||||||
|
total += int(value)
|
||||||
|
if subnet[:8] == "10231136":
|
||||||
|
print "%sadm.value %s" % (nom, value)
|
||||||
|
for x in range(136,152):
|
||||||
|
if subnet[:9] == ("138231%d" % x):
|
||||||
|
print "%s%d.value %s" % (nom, x, value)
|
||||||
|
print "%s.value %d" % (nom, total)
|
||||||
|
else :
|
||||||
|
value = int(commands.getoutput('%s %s | wc -l' % (IPTABLES, chain))) - 2
|
||||||
|
print "%s.value %d" % (nom, value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue