NEWS file for project ssh-installkeys
+1.8 @ 2013-04-18:
+ Program can now use new-style config-file location ~/.config/ssh-installkeys
+
1.7 @ 2012-03-26:
Remote installations are now recorded if your create ~/.ssh-installkeys.
Code now bails out gracefully on host key changes or broken ptys.
#
###############################################################################
-version = 1.7
+version = 1.8
class ssh_session:
"Session with extra state including the password to be used."
"Store our state about remote keys."
def __init__(self):
ConfigParser.RawConfigParser.__init__(self)
- self.have_config = os.path.exists(KeyConfig.configfile())
- self.read(KeyConfig.configfile())
- @staticmethod
- def configfile():
- return os.path.expanduser('~/.ssh-installkeys')
+ newstyle = os.path.expanduser('~/.config/ssh-installkeys')
+ oldstyle = os.path.expanduser('~/.ssh-installkeys')
+ if os.path.exists(newstyle):
+ self.configfile = newstyle
+ elif os.path.exists(oldstyle):
+ self.configfile = oldstyle
+ else:
+ self.configfile = None
+ if self.configfile:
+ self.read(self.configfile)
def save(self):
- if self.have_config:
- self.write(open(KeyConfig.configfile(), "w"))
+ if self.configfile:
+ self.write(open(self.configfile, "w"))
def remember(self, session):
authorized = session.ssh("cat $HOME/.ssh/authorized_keys")
keydict = {}
if __name__ == '__main__':
# Process options
- (options, arguments) = getopt.getopt(sys.argv[1:], "cdhvp:")
+ try:
+ (options, arguments) = getopt.getopt(sys.argv[1:], "cdhvp:")
+ except getopt.GetoptError, e:
+ print e
+ sys.exit(1)
check = 0
verbose = 0
delete = 0
pass
except RuntimeError:
sys.exit(-1)
+
# It's all over now...
os.remove(keyfile)
config.save()
</refsect1>
<refsect1><title>Recording remote key locations</title>
-<para>If the file <filename>~/.ssh/installkeys</filename> exists,
-places where you install keys will be recorded in it. This record will
-also be updated when you use the check option, so you can use
-that option to check sites where you may have previously installed
-keys and add them to the list. Entries are removed when you
-delete remote keys.</para>
+<para>If either of the files
+<filename>~/.config/ssh/installkeys</filename> or
+<filename>~/.ssh/installkeys</filename> exists, places where you
+install keys will be recorded in it. This record will also be updated
+when you use the check option, so you can use that option to check
+sites where you may have previously installed keys and add them to the
+list. Entries are removed when you delete remote keys.</para>
<para>Beware that if your account is cracked, this record will offer
the intruder a menu of other systems to attack, escalating security