46
52
def generate_key_file(tag):
47
53
"""Generates a filename in the .ssh directory"""
48
54
filename = os.path.join(SSH_DIR, "%s_id_rsa" % tag)
52
58
def generate_key(filename, password, comment=None):
53
59
"""Generate a new ssh key (rsa by default)"""
55
61
com = "ssh-keygen -t rsa -N '%s' -f '%s' -C '%s' -q" % (
56
62
password, filename, comment)
58
64
res = commands.getoutput(com)
60
66
return os.path.exists(filename)
62
68
def add_server_key(server):