[sniffer] autoconf d'arpwatch, sur dyson, special crans

Ignore-this: 273a6d04fd110d2c14a3c5b8679977e4

darcs-hash:20120512174644-3ca67-0f23dfe04102f93276501c57d8ddc251f05f13ac.gz
This commit is contained in:
daniel.stan 2012-05-12 19:46:44 +02:00
parent 467bf7fd96
commit 216f227f67
7 changed files with 56 additions and 2 deletions

6
Bundler/arpwatch.xml Normal file
View file

@ -0,0 +1,6 @@
<Bundle name="arpwatch" version="2.0">
<Package name="arpwatch"/>
<Service name="arpwatch"/>
<ConfigFile name="/etc/default/arpwatch"/>
<ConfigFile name="/etc/arpwatch.conf"/>
</Bundle>

View file

@ -0,0 +1,8 @@
# Fichier gere par Bcfg2 (plugin Cfg)
# Global options for arpwatch(8).
# Debian: don't report bogons, don't use PROMISC.
ARGS="-N -p -s /usr/scripts/surveillance/arpwatch_sendmail"
# Debian: run as `arpwatch' user. Empty this to run as root.
RUNAS="arpwatch"

View file

@ -1156,11 +1156,15 @@
<Group name="sniffer"
comment="Le serveur qui surveille le réseau">
<Group name="non-free" /> <!-- Pour snmp-mibs-downloader -->
<!-- TODO : à implémenter -->
<Group name="arpwatch" />
</Group>
<Group name="arpwatch" comment="arpwatch special crans avec traçage des macs">
<Group name="non-free" /><!-- Pour snmp-mibs-downloader, pour interrogation switch -->
<Bundle name="arpwatch" />
</Group>
<!-- +====================+ -->
<!-- | Groupes dynamiques | -->
<!-- +====================+ -->

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8; mode: python -*-
include("ip")
include("arpwatch")
info["owner"] = "root"
info["group"] = "root"
@ -12,10 +13,13 @@ Les modifications locales sont a mettre dans le fichier /etc/network/interfaces.
Voir http://wiki.crans.org/CransTechnique/Bcfg2/... pour plus d'explications.
""")
configured_ifaces=[]
def dev(interface, mode, additionnals=[]):
"""Generation de la conf d'une interface:
- additionnals contient des lignes a mettre en plus a la definition"""
configured_ifaces.append(interface)
if mode == "pub":
print """auto %(interface)s
@ -122,6 +126,17 @@ print """auto lo
iface lo inet loopback
"""
# Pour arpwatch, on surveille nos réseaux
def otherlisteners():
print "#Interfaces d'ecoute restantes pour arpwatch "
for vlan in watched_vlans:
if vlan == 1:
iface = 'eth0'
else:
iface = 'eth0.%d' % vlan
if not iface in configured_ifaces:
dev(iface,'vide')
def pubip6(If):
return "2a01:240:fe3d:4:" + If_Mac[If]

View file

@ -59,3 +59,7 @@ if has("users"):
@ALL ALL=(respbats) /usr/scripts/gestion/chsh.py, NOPASSWD:/usr/local/bin/ldap_whoami
@# Quotas
@ALL ALL=NOPASSWD:/usr/local/bin/quota.sh
if has('arpwatch'):
@# arpwatch
@arpwatch ALL=(arpwatch) NOPASSWD:/usr/scripts/surveillance/arpwatch_sendmail.py

View file

@ -100,6 +100,8 @@
<Service type="deb" name="munin-node" status="on"/>
<Service type="deb" name="nagios-nrpe-server" status="on"/>
<Service type="deb" name="arpwatch" status="on"/>
<Action name="link-munin-plugins" timing="post" when="modified" status="check"
command="python /usr/scripts/munin/scripts/link_plugins.py -f" />

15
etc/python/arpwatch.py Normal file
View file

@ -0,0 +1,15 @@
# -*- mode: python; coding: utf-8 -*-
#
# Liste des vlans surveilles
# On surveille les réseaux du crans
# 1: adherent
# 2: adm
# 3: wifi-crans
## 4: wifi-ens -> c'est pas nos oignons
## 6: gratuit -> plus utilisé
# 7: accueil (utile ? Éviter que des gens s'en servent comme lan ?)
# 9: isolement (utile ?)
# 10: évènementiel
# 21: appartements
watched_vlans = [1,2,3,7,9,10,21]