ssh-keygen output format tweak

varies too much across versions.
pull/7/head
Rui Carmo 2016-04-23 17:40:50 +01:00
rodzic 069e4dc20e
commit 791c8d9cd7
1 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -577,10 +577,9 @@ def add_key(public_key_file):
if exists(public_key_file):
try:
fingerprint = check_output('ssh-keygen -lf %s' % public_key_file, shell=True).split(' ',4)[1]
if re.match('(([0-9a-f]{2}\:){16})', '%s:' % fingerprint):
key = open(public_key_file).read().strip()
echo("Adding key '%s'." % fingerprint, fg='white')
setup_authorized_keys(fingerprint, realpath(__file__), key)
key = open(public_key_file).read().strip()
echo("Adding key '%s'." % fingerprint, fg='white')
setup_authorized_keys(fingerprint, realpath(__file__), key)
except:
echo("Error: invalid public key file '%s'" % public_key_file, fg='red')
else: