Proprification et factorisation
This commit is contained in:
parent
286ff53713
commit
cca497ef3b
1 changed files with 40 additions and 49 deletions
|
@ -8,30 +8,21 @@ import lc_ldap.shortcuts
|
||||||
|
|
||||||
conn = lc_ldap.shortcuts.lc_ldap_readonly()
|
conn = lc_ldap.shortcuts.lc_ldap_readonly()
|
||||||
|
|
||||||
# Ip des serveurs
|
comment_start = "#"
|
||||||
ipv4o2 = str(conn.search(u'host=o2.adm.crans.org')[0]['ipHostNumber'][0])
|
header("Gestion du mapping avec les base de données")
|
||||||
ipv6o2 = str(conn.search(u'host=o2.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4asterisk = str(conn.search(u'host=asterisk.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv4zamok = str(conn.search(u'host=zamok.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6zamok = str(conn.search(u'host=zamok.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4kenobi = str(conn.search(u'host=kenobi.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv4owl = str(conn.search(u'host=owl.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6owl = str(conn.search(u'host=owl.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4roundcube = str(conn.search(u'host=roundcube.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6roundcube = str(conn.search(u'host=roundcube.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4horde = str(conn.search(u'host=horde.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6horde = str(conn.search(u'host=horde.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4mediadrop = str(conn.search(u'host=mediadrop.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6mediadrop = str(conn.search(u'host=mediadrop.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4titanic= str(conn.search(u'host=titanic.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6titanic= str(conn.search(u'host=titanic.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4soyouz = str(conn.search(u'host=soyouz.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv4redisdead = str(conn.search(u'host=redisdead.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6redisdead = str(conn.search(u'host=redisdead.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
ipv4owncloud = str(conn.search(u'host=owncloud.adm.crans.org')[0]['ipHostNumber'][0])
|
|
||||||
ipv6owncloud = str(conn.search(u'host=owncloud.adm.crans.org')[0]['ip6HostNumber'][0])
|
|
||||||
|
|
||||||
out("""#Fichier géré par Bcfg2""")
|
# Ip des serveurs
|
||||||
|
def ipv4(serveur):
|
||||||
|
return str(conn.search(u'host=%s.adm.crans.org' % serveur)[0]['ipHostNumber'][0])
|
||||||
|
def ipv6(serveur):
|
||||||
|
return str(conn.search(u'host=%s.adm.crans.org' % serveur)[0]['ip6HostNumber'][0])
|
||||||
|
|
||||||
|
serveurs = ['o2','zamok','asterisk','kenobi','owl','roundcube','horde','mediadrop','titanic','soyouz','redisdead','owncloud']
|
||||||
|
|
||||||
|
ip_serveurs = dict()
|
||||||
|
for serv in serveurs:
|
||||||
|
ip_serveurs['ipv4'+serv] = ipv4(serv)
|
||||||
|
ip_serveurs['ipv6'+serv] = ipv6(serv)
|
||||||
|
|
||||||
out("""# PostgreSQL Client Authentication Configuration File
|
out("""# PostgreSQL Client Authentication Configuration File
|
||||||
# ===================================================
|
# ===================================================
|
||||||
|
@ -103,14 +94,14 @@ host Syslog rsyslog 127.0.0.1/32 md5
|
||||||
|
|
||||||
#Intranet : venant d'o2, on autorise l'ecriture""")
|
#Intranet : venant d'o2, on autorise l'ecriture""")
|
||||||
|
|
||||||
out("""host django crans """ + ipv4o2 + """/32 ident map=django""")
|
out("""host django crans """ + ip_serveurs['ipv4o2'] + """/32 ident map=django""")
|
||||||
out("""host django crans """ + ipv6o2 + """/128 ident map=django""")
|
out("""host django crans """ + ip_serveurs['ipv6o2'] + """/128 ident map=django""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# Asterisk a besoin d'écrire depuis asterisk et depuis zamok""")
|
# Asterisk a besoin d'écrire depuis asterisk et depuis zamok""")
|
||||||
|
|
||||||
out("""host django crans """ + ipv4asterisk + """/32 ident map=django""")
|
out("""host django crans """ + ip_serveurs['ipv4asterisk'] + """/32 ident map=django""")
|
||||||
out("""host django crans """ + ipv4zamok + """/32 ident map=django""")
|
out("""host django crans """ + ip_serveurs['ipv4zamok'] + """/32 ident map=django""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# Tout le reste sur adm est django_ro et crans_ro, pas besoin d'écrire""")
|
# Tout le reste sur adm est django_ro et crans_ro, pas besoin d'écrire""")
|
||||||
|
@ -120,51 +111,51 @@ out("""host django crans_ro 2a01:240:fe3d:c804::/64
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# kenobi""")
|
# kenobi""")
|
||||||
out("""host etherpad crans """ + ipv4kenobi + """/32 ident map=etherpad""")
|
out("""host etherpad crans """ + ip_serveurs['ipv4kenobi'] + """/32 ident map=etherpad""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# On autorise tout pour owl TODO : à proprifier""")
|
# On autorise tout pour owl TODO : à proprifier""")
|
||||||
out("""host roundcube roundcube """ + ipv4owl + """/32 ident map=webmail""")
|
out("""host roundcube roundcube """ + ip_serveurs['ipv4owl'] + """/32 ident map=webmail""")
|
||||||
out("""host roundcube roundcube """ + ipv6owl + """/128 ident map=webmail""")
|
out("""host roundcube roundcube """ + ip_serveurs['ipv6owl'] + """/128 ident map=webmail""")
|
||||||
out("""host all all """ + ipv4owl + """/32 ident""")
|
out("""host all all """ + ip_serveurs['ipv4owl'] + """/32 ident""")
|
||||||
out("""host all all """ + ipv6owl + """/128 ident""")
|
out("""host all all """ + ip_serveurs['ipv6owl'] + """/128 ident""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# Roundcube a accès à sa base""")
|
# Roundcube a accès à sa base""")
|
||||||
out("""host roundcube roundcube """ + ipv4roundcube + """/32 ident map=webmail""")
|
out("""host roundcube roundcube """ + ip_serveurs['ipv4roundcube'] + """/32 ident map=webmail""")
|
||||||
out("""host roundcube roundcube """ + ipv6roundcube + """/128 ident map=webmail""")
|
out("""host roundcube roundcube """ + ip_serveurs['ipv6roundcube'] + """/128 ident map=webmail""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# sql grey pour zamok""")
|
# sql grey pour zamok""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv4zamok + """/32 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv4zamok'] + """/32 ident""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv6zamok + """/128 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv6zamok'] + """/128 ident""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
#Base de horde pour root et www-data""")
|
#Base de horde pour root et www-data""")
|
||||||
out("""host horde5 www-data """ + ipv4horde + """/32 ident map=horde""")
|
out("""host horde5 www-data """ + ip_serveurs['ipv4horde'] + """/32 ident map=horde""")
|
||||||
out("""host horde5 www-data """ + ipv6horde + """/128 ident map=horde""")
|
out("""host horde5 www-data """ + ip_serveurs['ipv6horde'] + """/128 ident map=horde""")
|
||||||
out("""host horde5 root """ + ipv4horde + """/32 ident map=horde""")
|
out("""host horde5 root """ + ip_serveurs['ipv4horde'] + """/32 ident map=horde""")
|
||||||
out("""host horde5 root """ + ipv6horde + """/128 ident map=horde""")
|
out("""host horde5 root """ + ip_serveurs['ipv6horde'] + """/128 ident map=horde""")
|
||||||
|
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
#mediadrop""")
|
#mediadrop""")
|
||||||
out("""host mediadrop mediadrop """ + ipv4mediadrop + """/32 ident map=mediadrop""")
|
out("""host mediadrop mediadrop """ + ip_serveurs['ipv4mediadrop'] + """/32 ident map=mediadrop""")
|
||||||
out("""host mediadrop mediadrop """ + ipv6mediadrop + """/128 ident map=mediadrop""")
|
out("""host mediadrop mediadrop """ + ip_serveurs['ipv6mediadrop'] + """/128 ident map=mediadrop""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# SQLgrey depuis titanic""")
|
# SQLgrey depuis titanic""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv4titanic + """/32 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv4titanic'] + """/32 ident""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv6titanic + """/128 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv6titanic'] + """/128 ident""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# SQLgrey depuis soyouz""")
|
# SQLgrey depuis soyouz""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv4soyouz + """/32 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv4soyouz'] + """/32 ident""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# SQLgrey depuis redisdead""")
|
# SQLgrey depuis redisdead""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv4redisdead + """/32 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv4redisdead'] + """/32 ident""")
|
||||||
out("""host sqlgrey sqlgrey """ + ipv6redisdead + """/128 ident""")
|
out("""host sqlgrey sqlgrey """ + ip_serveurs['ipv6redisdead'] + """/128 ident""")
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
# SQLgrey local""")
|
# SQLgrey local""")
|
||||||
|
@ -178,8 +169,8 @@ out("""local mac_prises crans ident map=mac_pris
|
||||||
|
|
||||||
out("""
|
out("""
|
||||||
#Base pour owncloud""")
|
#Base pour owncloud""")
|
||||||
out("""host owncloud owncloud """ + ipv4owncloud + """/24 md5""")
|
out("""host owncloud owncloud """ + ip_serveurs['ipv4owncloud'] + """/24 md5""")
|
||||||
out("""host owncloud owncloud """ + ipv6owncloud + """/128 md5""")
|
out("""host owncloud owncloud """ + ip_serveurs['ipv6owncloud'] + """/128 md5""")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue