[ldap_crans/whos] Deux corrections concernant ssh, et ajout des champs à whos, avec option -s pour afficher les fpr ssh.
Ignore-this: c7d7960aad0da2f4a510b09d97eeeec7 <> sshFingerprint n'était pas un historique de type diff <> gpgexists au milieu de sshFingerprint() <> on rajoute une espace après le cinquième bloc GPG + Affichage des fpr GPG dans whos + Affichage des fpr SSH dans whos avec option -s ou --ssh + ? darcs-hash:20130112160140-b6762-824baacdb54a9dbd358d8762bda30d5511616674.gz
This commit is contained in:
parent
d6944ca03b
commit
fe958d0009
2 changed files with 17 additions and 6 deletions
|
@ -236,7 +236,7 @@ def format_mac(mac):
|
||||||
def format_gpg_fingerprint(fpr):
|
def format_gpg_fingerprint(fpr):
|
||||||
"""
|
"""
|
||||||
Formatage de fingerpring GPG pour les avoir de la forme
|
Formatage de fingerpring GPG pour les avoir de la forme
|
||||||
XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
|
XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# longueur + fpr sans espaces
|
# longueur + fpr sans espaces
|
||||||
|
@ -257,6 +257,8 @@ def format_gpg_fingerprint(fpr):
|
||||||
|
|
||||||
if i != 10:
|
if i != 10:
|
||||||
formattedfpr += " "
|
formattedfpr += " "
|
||||||
|
if i == 4:
|
||||||
|
formattedfpr += " "
|
||||||
|
|
||||||
return formattedfpr
|
return formattedfpr
|
||||||
|
|
||||||
|
@ -480,7 +482,7 @@ class CransLdap:
|
||||||
|
|
||||||
aid $ chbre $ mail $ mailAlias $ canonicalAlias $
|
aid $ chbre $ mail $ mailAlias $ canonicalAlias $
|
||||||
mid $ macAddress $ host $ hostAlias $ ipHostNumber $
|
mid $ macAddress $ host $ hostAlias $ ipHostNumber $
|
||||||
gpgFingerprint
|
gpgFingerprint $ sshFingerprint
|
||||||
|
|
||||||
Retourne le dn du lock
|
Retourne le dn du lock
|
||||||
"""
|
"""
|
||||||
|
@ -1205,7 +1207,7 @@ class BaseClasseCrans(CransLdap):
|
||||||
for champ in ['droits', 'controle', 'paiement', 'carteEtudiant',
|
for champ in ['droits', 'controle', 'paiement', 'carteEtudiant',
|
||||||
'mailAlias', 'hostAlias', 'exempt', 'nvram',
|
'mailAlias', 'hostAlias', 'exempt', 'nvram',
|
||||||
'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout',
|
'portTCPin', 'portTCPout', 'portUDPin', 'portUDPout',
|
||||||
'homepageAlias', 'imprimeurClub', 'gpgFingerprint']:
|
'homepageAlias', 'imprimeurClub', 'gpgFingerprint', 'sshFingerprint']:
|
||||||
if champ in self.modifs:
|
if champ in self.modifs:
|
||||||
if champ == 'controle':
|
if champ == 'controle':
|
||||||
# Ce n'est pas pareil que self._init_data.get('controle', [''])
|
# Ce n'est pas pareil que self._init_data.get('controle', [''])
|
||||||
|
@ -3024,7 +3026,7 @@ Contactez nounou si la MAC est bien celle d'une carte.""", 3)
|
||||||
else:
|
else:
|
||||||
index = -1
|
index = -1
|
||||||
|
|
||||||
#if gpgexists(new):
|
#if sshexists(new):
|
||||||
# raise ValueError(u"FPR existant ou correspondand à un compte.")
|
# raise ValueError(u"FPR existant ou correspondand à un compte.")
|
||||||
|
|
||||||
if index != -1:
|
if index != -1:
|
||||||
|
|
|
@ -37,6 +37,7 @@ le mode d'affichage condensé au lieu du mode détaillé (défaut %(limit_aff_de
|
||||||
d'historique affichées (défaut %(limit_aff_historique)i)
|
d'historique affichées (défaut %(limit_aff_historique)i)
|
||||||
-d <num> ou --limit-blacklist=<num> : limitation du nombre de lignes
|
-d <num> ou --limit-blacklist=<num> : limitation du nombre de lignes
|
||||||
d'historique des déconnexions affichées (défaut %(limit_aff_blacklist)i)
|
d'historique des déconnexions affichées (défaut %(limit_aff_blacklist)i)
|
||||||
|
-s ou --ssh : affiche les fingerpring ssh des machines
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -63,6 +64,7 @@ limit_aff_machines = 15
|
||||||
limit_aff_historique = 4
|
limit_aff_historique = 4
|
||||||
limit_aff_blacklist = 4
|
limit_aff_blacklist = 4
|
||||||
aff_ipsec = 0
|
aff_ipsec = 0
|
||||||
|
aff_ssh = 0
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
### Fonctions utiles
|
### Fonctions utiles
|
||||||
|
@ -434,6 +436,8 @@ def adher_details(adher) :
|
||||||
f += GL
|
f += GL
|
||||||
f += RMH
|
f += RMH
|
||||||
f += u'\n'
|
f += u'\n'
|
||||||
|
if len(adher.gpgFingerprint()) > 0:
|
||||||
|
f += u"\n".join([coul(u'Fingerprint GPG : ', 'gras') + u"%s" % (i) for i in adher.gpgFingerprint()])+"\n"
|
||||||
try:
|
try:
|
||||||
forward = file("/home/%s/.forward" % adher.compte()).readlines()
|
forward = file("/home/%s/.forward" % adher.compte()).readlines()
|
||||||
if len(forward) > 1:
|
if len(forward) > 1:
|
||||||
|
@ -600,6 +604,9 @@ def machine_details(machine) :
|
||||||
f+= coul(u'IP : ','gras') + "%s\t\t" %machine.ip()
|
f+= coul(u'IP : ','gras') + "%s\t\t" %machine.ip()
|
||||||
f+= coul(u'MAC : ','gras') + "%s\n" %machine.mac()
|
f+= coul(u'MAC : ','gras') + "%s\n" %machine.mac()
|
||||||
|
|
||||||
|
if len(machine.sshFingerprint()) > 0 and aff_ssh:
|
||||||
|
f += u"\n".join([coul(u'Fingerprint SSH : ', 'gras') + u"%s" % (i) for i in machine.sshFingerprint()])+"\n"
|
||||||
|
|
||||||
# Propriétaire
|
# Propriétaire
|
||||||
f+= coul(u'Propriétaire : ','gras')
|
f+= coul(u'Propriétaire : ','gras')
|
||||||
try :
|
try :
|
||||||
|
@ -1093,7 +1100,7 @@ def __recherche() :
|
||||||
"""
|
"""
|
||||||
Recherche et affichage des résultats à partir des options founies (sys.argv)
|
Recherche et affichage des résultats à partir des options founies (sys.argv)
|
||||||
"""
|
"""
|
||||||
global aff_ipsec, limit_aff_details, limit_aff_historique, limit_aff_blacklist, debug
|
global aff_ipsec, aff_ssh, limit_aff_details, limit_aff_historique, limit_aff_blacklist, debug
|
||||||
|
|
||||||
# Récupération des options
|
# Récupération des options
|
||||||
if len(sys.argv) == 1 :
|
if len(sys.argv) == 1 :
|
||||||
|
@ -1101,7 +1108,7 @@ def __recherche() :
|
||||||
__usage_brief()
|
__usage_brief()
|
||||||
|
|
||||||
try :
|
try :
|
||||||
options, arg = getopt.getopt(sys.argv[1:], 'hamctbil:L:d:', [ 'debug', 'help', 'adherent', 'machine', 'club' , 'tech', 'bornes', 'limit=', 'limit-historique=', 'limit-blacklist=', 'ipsec', 'crans' ])
|
options, arg = getopt.getopt(sys.argv[1:], 'hamcstbil:L:d:', [ 'debug', 'help', 'adherent', 'machine', 'club' , 'tech', 'bornes', 'limit=', 'limit-historique=', 'limit-blacklist=', 'ipsec', 'crans', 'ssh' ])
|
||||||
except getopt.error, msg :
|
except getopt.error, msg :
|
||||||
__usage_brief(unicode(msg))
|
__usage_brief(unicode(msg))
|
||||||
|
|
||||||
|
@ -1164,6 +1171,8 @@ def __recherche() :
|
||||||
elif opt in [ '-i', '--ipsec' ] :
|
elif opt in [ '-i', '--ipsec' ] :
|
||||||
# Affichage des clefs ipsec
|
# Affichage des clefs ipsec
|
||||||
aff_ipsec = 1
|
aff_ipsec = 1
|
||||||
|
elif opt in [ '-s', '--ssh' ]:
|
||||||
|
aff_ssh = 1
|
||||||
|
|
||||||
if only_adh + only_mac + only_club + only_bornes > 1 :
|
if only_adh + only_mac + only_club + only_bornes > 1 :
|
||||||
__usage_brief(u'Options utilisées incompatibles')
|
__usage_brief(u'Options utilisées incompatibles')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue