diff -Nru ssh-import-id-5.6/ChangeLog ssh-import-id-5.7/ChangeLog --- ssh-import-id-5.6/ChangeLog 2016-09-16 15:12:32.000000000 +0000 +++ ssh-import-id-5.7/ChangeLog 2017-07-11 20:51:08.000000000 +0000 @@ -1,10 +1,26 @@ -ssh-import-id (5.6) released; urgency=medium +ssh-import-id (5.7) released; urgency=medium + + [ Scott Moser ] + * ssh_import_id/__init__.py: LP: #1570997 + - read_keyfile: use getpass and expanduser if HOME not set. + If the HOME environment variable was not set, then use getpass and + expanduser to try to find the right path. + Recreate was as simple as: + env -u HOME ssh-import-id bob + + [ Dustin Kirkland ] + * ssh_import_id/__init__.py: + - fix typo, missing colon + + -- Dustin Kirkland Fri, 16 Sep 2016 10:13:35 -0500 + +ssh-import-id (5.6-0ubuntu1) yakkety; urgency=medium [ Mitsuya Shibata ] * ssh_import_id/__init__.py: LP: #1565275 - fix bug, where only the last key from github was getting added - -- Dustin Kirkland Thu, 18 Feb 2016 12:38:57 -0800 + -- Dustin Kirkland Fri, 16 Sep 2016 10:13:31 -0500 ssh-import-id (5.5-0ubuntu1) xenial; urgency=medium diff -Nru ssh-import-id-5.6/debian/changelog ssh-import-id-5.7/debian/changelog --- ssh-import-id-5.6/debian/changelog 2017-07-11 21:58:17.000000000 +0000 +++ ssh-import-id-5.7/debian/changelog 2017-07-11 21:58:17.000000000 +0000 @@ -1,10 +1,26 @@ -ssh-import-id (5.6-0ubuntu1~trusty) trusty; urgency=medium +ssh-import-id (5.7-0ubuntu1~trusty) trusty; urgency=medium + + [ Scott Moser ] + * ssh_import_id/__init__.py: LP: #1570997 + - read_keyfile: use getpass and expanduser if HOME not set. + If the HOME environment variable was not set, then use getpass and + expanduser to try to find the right path. + Recreate was as simple as: + env -u HOME ssh-import-id bob + + [ Dustin Kirkland ] + * ssh_import_id/__init__.py: + - fix typo, missing colon + + -- Dustin Kirkland Fri, 16 Sep 2016 10:13:35 -0500 + +ssh-import-id (5.6-0ubuntu1) yakkety; urgency=medium [ Mitsuya Shibata ] * ssh_import_id/__init__.py: LP: #1565275 - fix bug, where only the last key from github was getting added - -- Dustin Kirkland Thu, 18 Feb 2016 12:38:57 -0800 + -- Dustin Kirkland Fri, 16 Sep 2016 10:13:31 -0500 ssh-import-id (5.5-0ubuntu1) xenial; urgency=medium diff -Nru ssh-import-id-5.6/ssh_import_id/__init__.py ssh-import-id-5.7/ssh_import_id/__init__.py --- ssh-import-id-5.6/ssh_import_id/__init__.py 2016-09-16 15:09:29.000000000 +0000 +++ ssh-import-id-5.7/ssh_import_id/__init__.py 2017-07-11 20:49:03.000000000 +0000 @@ -18,6 +18,7 @@ # along with ssh-import-id. If not, see . import argparse +import getpass import json import logging import os @@ -33,7 +34,7 @@ from urllib import quote_plus -__version__ = '5.6' +__version__ = '5.7' DEFAULT_PROTO = "lp" logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO) parser = argparse.ArgumentParser(description='Authorize SSH public keys from trusted online identities.') @@ -132,7 +133,15 @@ Locate key file, read the current state, return lines in a list """ lines = [] - output_file = parser.options.output or os.path.join(os.getenv("HOME"), ".ssh", "authorized_keys") + if parser.options.output: + output_file = parser.options.output + else: + if os.environ.get("HOME"): + home = os.environ["HOME"] + else: + home = os.path.expanduser("~" + getpass.getuser()) + output_file = os.path.join(home, ".ssh", "authorized_keys") + if os.path.exists(output_file): try: with open(output_file, "r") as f: