[firewall4] redirection ssh2.crans.org:80 --> zamok.crans.org:81
hts (le serveur du programme httptunnel) écoute sur zamok sur le port 81.
This commit is contained in:
parent
52a4cefdb5
commit
c2a21b8756
4 changed files with 1 additions and 0 deletions
51
surveillance/list_things/list_droits.py
Executable file
51
surveillance/list_things/list_droits.py
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# list_droits.py --- Récupère la liste des adhérents ayant actuellement
|
||||
# des droits.
|
||||
"""Récupère la liste des adhérents avec des droits et l'affiche
|
||||
triée par type de droit."""
|
||||
|
||||
from lc_ldap import shortcuts
|
||||
from config.encoding import out_encoding
|
||||
|
||||
def fetch_adhs(ldap):
|
||||
"""Récupère la liste des adhérents avec des droits et
|
||||
les trie par droits actuellement possédés"""
|
||||
adhs_avec_droits = ldap.search(u"droits=*")
|
||||
|
||||
adhs_par_droit = {}
|
||||
|
||||
for adh in adhs_avec_droits:
|
||||
for droit in adh['droits']:
|
||||
adhs_par_droit.setdefault(droit, []).append(adh)
|
||||
|
||||
return adhs_par_droit
|
||||
|
||||
def make_output(adhs_par_droit):
|
||||
"""Génère une sortie à partir de la liste d'adhérents
|
||||
triés par droits"""
|
||||
d = adhs_par_droit.keys()
|
||||
d.sort()
|
||||
|
||||
output = []
|
||||
|
||||
for droit in d:
|
||||
adhs = adhs_par_droit[droit]
|
||||
|
||||
noms = []
|
||||
|
||||
txt = '%s\n' % droit
|
||||
for adh in adhs :
|
||||
noms.append(u'%s %s' % (adh['prenom'][0], adh['nom'][0]))
|
||||
noms.sort()
|
||||
txt += u' %s' % '\n '.join(noms)
|
||||
|
||||
output.append(txt)
|
||||
return output
|
||||
|
||||
if __name__ == '__main__':
|
||||
LDAP = shortcuts.lc_ldap_readonly()
|
||||
OUTPUT = make_output(fetch_adhs(LDAP))
|
||||
|
||||
print u'\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(OUTPUT).encode(out_encoding)
|
29
surveillance/list_things/list_exempt.py
Executable file
29
surveillance/list_things/list_exempt.py
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# list_exempt.py --- Fournit la liste des machines avec une exemption.
|
||||
"""Fournit une liste des machines d'adhérents disposant d'une exemption"""
|
||||
|
||||
from lc_ldap import shortcuts
|
||||
from config.encoding import out_encoding
|
||||
|
||||
def make_output(ldap):
|
||||
"""Génère le texte à afficher"""
|
||||
machines_avec_exemption = ldap.search(u"exempt=*")
|
||||
output = []
|
||||
|
||||
for machine in machines_avec_exemption:
|
||||
# texte pour la machine
|
||||
txt = u''
|
||||
txt += u'Propriétaire : %s\n' % machine.proprio()
|
||||
txt += u'Machine : %s\n' % machine['host'][0]
|
||||
txt += u'destination : %s\n' % ', '.join([unicode(i) for i in machine['exempt']])
|
||||
|
||||
output.append(txt.strip())
|
||||
return output
|
||||
|
||||
if __name__ == '__main__':
|
||||
LDAP = shortcuts.lc_ldap_readonly()
|
||||
OUTPUT = make_output(LDAP)
|
||||
|
||||
print u'\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(OUTPUT).encode(out_encoding)
|
43
surveillance/list_things/list_firewall.py
Executable file
43
surveillance/list_things/list_firewall.py
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash /usr/scripts/python.sh
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# list_firewall.py --- Liste les machines disposant de droits
|
||||
# particuliers en ce qui concerne leurs ports accessibles.
|
||||
"""Liste les machines dont certains ports sont whielistés par
|
||||
le parefeu"""
|
||||
|
||||
from lc_ldap import shortcuts
|
||||
from config.encoding import out_encoding
|
||||
|
||||
def make_output(ldap):
|
||||
"""Génère un texte à afficher"""
|
||||
machines_speciales = ldap.search(u"(|(portTCPin=*)(portTCPout=*)(portUDPin=*)(portUDPout=*))")
|
||||
|
||||
output = []
|
||||
|
||||
for machine in machines_speciales:
|
||||
# On se fiche des machines crans
|
||||
if machine['objectClass'][0] not in ["machineFixe", "machineWifi"]:
|
||||
continue
|
||||
|
||||
# texte pour la machine
|
||||
txt = u''
|
||||
txt += u'Propriétaire : %s\n' % machine.proprio()
|
||||
txt += u'Machine : %s\n' % machine['host'][0]
|
||||
if machine['portTCPin']:
|
||||
txt += u'ports TCP in : %s\n' % ' '.join([unicode(port) for port in machine['portTCPin']])
|
||||
if machine['portTCPout']:
|
||||
txt += u'ports TCP out : %s\n' % ' '.join([unicode(port) for port in machine['portTCPout']])
|
||||
if machine['portUDPin']:
|
||||
txt += u'ports UDP in : %s\n' % ' '.join([unicode(port) for port in machine['portUDPin']])
|
||||
if machine['portUDPout']:
|
||||
txt += u'ports UDP out : %s\n' % ' '.join([unicode(port) for port in machine['portTCPout']])
|
||||
|
||||
output.append(txt.strip())
|
||||
return output
|
||||
|
||||
if __name__ == '__main__':
|
||||
LDAP = shortcuts.lc_ldap_readonly()
|
||||
OUTPUT = make_output(LDAP)
|
||||
|
||||
print u'\n- - - - - - = = = = = = # # # # # # # # = = = = = = - - - - - -\n'.join(OUTPUT).encode(out_encoding)
|
Loading…
Add table
Add a link
Reference in a new issue