From: Magnus Hagander Date: Sat, 17 Oct 2009 18:34:40 +0000 (+0200) Subject: Properly dump multiple ssh keys to the authorized_keys file. X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=47995cfc04a5ea4bc1b1654c88b20b4276480a9e;p=pggit.git Properly dump multiple ssh keys to the authorized_keys file. --- diff --git a/gitdump.py b/gitdump.py index 6f7a3eb..fac9f4b 100644 --- a/gitdump.py +++ b/gitdump.py @@ -34,7 +34,8 @@ class AuthorizedKeysDumper(object): curs.execute("SELECT userid,sshkey FROM git_users ORDER BY userid") f = open("%s/.ssh/authorized_keys.tmp" % self.conf.get("paths", "githome"), "w") for userid,sshkey in curs: - f.write("command=\"%s %s\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n" % (self.conf.get("paths", "pggit"), userid, sshkey)) + for key in sshkey.split("\n"): + f.write("command=\"%s %s\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n" % (self.conf.get("paths", "pggit"), userid, key)) f.close() os.chmod("%s/.ssh/authorized_keys.tmp" % self.conf.get("paths", "githome"), 0600) os.rename("%s/.ssh/authorized_keys.tmp" % self.conf.get("paths", "githome"), "%s/.ssh/authorized_keys" % self.conf.get("paths", "githome"))