
Ignore-this: e05e354085338cecf9bde47fd0576e94 darcs-hash:20130123020454-3a55a-75caebd514c11385e6a0453655617ac64a1cc2dd.gz
32 lines
No EOL
898 B
Python
32 lines
No EOL
898 B
Python
# -*- coding: utf-8; mode: python -*-
|
|
|
|
include("mode/space")
|
|
|
|
header("Configuration du serveur ssh")
|
|
|
|
|
|
import sys
|
|
sys.path.append('/usr/scripts/lc_ldap')
|
|
sys.path.append('/usr/scripts/gestion')
|
|
import lc_ldap
|
|
import config
|
|
|
|
conn=lc_ldap.lc_ldap_admin()
|
|
machines=conn.search("objectClass=machineCrans")
|
|
|
|
|
|
key_machines={}
|
|
for machine in machines:
|
|
for key in machine['sshFingerprint']:
|
|
if not key.value in key_machines.keys():
|
|
key_machines[key.value]=set()
|
|
for host in machine['host']:
|
|
key_machines[key.value].add(host.value)
|
|
key_machines[key.value].add(host.value.split('.')[0])
|
|
for alias in machine['hostAlias']:
|
|
key_machines[key.value].add(alias.value)
|
|
key_machines[key.value].add(alias.value.split('.')[0])
|
|
for ip in machine['ipHostNumber']:
|
|
key_machines[key.value].add("%s" % ip)
|
|
for key,hosts in key_machines.items():
|
|
sys.stdout.write("%s %s" % (','.join(hosts),key)) |