crans_bcfg2/Python/etc/sysctl.conf
2015-05-14 07:19:56 +02:00

50 lines
1.5 KiB
Python

# -*- coding: utf-8; mode: python -*-
info["owner"] = "root"
info["group"] = "root"
info["mode"] = 0644
template_ra="""
net.ipv6.conf.%(If)s.autoconf = 0
net.ipv6.conf.%(If)s.accept_ra = 0
net.ipv6.conf.%(If)s.accept_ra_defrtr = 0
net.ipv6.conf.%(If)s.accept_ra_rtr_pref = 0
net.ipv6.conf.%(If)s.accept_ra_pinfo = 0
net.ipv6.conf.%(If)s.accept_source_route = 0
net.ipv6.conf.%(If)s.accept_redirects = 0
"""
header("""
Les modifications locales sont à mettre dans le fichier /etc/sysctl.local
Voir http://wiki.crans.org/CransTechnique/Bcfg2/... pour plus d'explications.
""")
# Définitions communes
out("""
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.default.accept_ra_defrtr = 0
net.ipv6.conf.default.accept_ra_rtr_pref = 0
net.ipv6.conf.default.accept_ra_pinfo = 0
net.ipv6.conf.default.accept_source_route = 0
net.ipv6.conf.default.accept_redirects = 0
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.all.accept_ra_defrtr = 0
net.ipv6.conf.all.accept_ra_rtr_pref = 0
net.ipv6.conf.all.accept_ra_pinfo = 0
net.ipv6.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.all.use_tempaddr = 0
""")
Probe_Ifs = metadata.Probes["mac"].strip().split('\n')
Ifs = [Probe_Ifs[i] for i in range(len(Probe_Ifs)) if i % 2 == 0]
# Un '.' supplémentaire dans une clé sysctl, c'est mal.
for i in Ifs:
out(template_ra % { 'If' : i.replace('.','/') })
out(metadata.Probes["sysctl"])