commit | c11d4592cd84df3e6835f360b846a3dff72758a6 | [log] [tgz] |
---|---|---|
author | Greg Stein <gstein@gmail.com> | Mon Dec 09 01:16:23 2019 -0600 |
committer | GitHub <noreply@github.com> | Mon Dec 09 01:16:23 2019 -0600 |
tree | 416324282ae6c67cd1fd84d814b653303739ae7d | |
parent | e02ebe4212e2e2ea575db82cc28919e9522d0d4e [diff] |
oops. trim the LICENSE file. I copied this from svn, and forgot to trim the included third-party licenses.
Command-line OTP calculator, with automatic password creation/storage.
The Apache Software Foundation (ASF) uses the Orthrus PAM module on its machines/VMs. Orthrus implements RFC 2289 to offer One Time Password (OTP) challenges, in order to sudo
. That package emits MD5-based challenges (otp-md5
), so this script only constructs MD5-based responses.
[remote]$ sudo bash otp-md5 440 someseed ext Password: [local]$ ./otp.py Challenge? otp-md5 440 someseed ext Response: MEAT SAD JERK STUN ARGO ITS NOTE: copied to clipboard
Note that you must copy/paste the challenge string from the remote host to the prompt on the local host. The response can then be pasted into the remote host's Password:
prompt.
If the local host has the xclip
program, then the reponse will be automatically copied to the clipboard. If that is not present, or does not exit with success, then the response string can be manually copied, then pasted to the remote.
The script examines the program name used to invoke it (sys.argv[0]
), and if that name matches a defined algorithm (otp-*
), then it will use the command line arguments to select the sequence and seed.
For example:
[local]$ ln -s $somewhere/otp.py otp-md5 [local]$ otp-md5 440 someseed ext Response: MEAT SAD JERK STUN ARGO ITS NOTE: copied to clipboard
Note that the challenge string from [remote] is directly pasted to the shell prompt.
$ ./otp.py --test
This will run a few internal tests. Any problems will raise an AssertionError
If new seed is seen (ie. by running ortpasswd
), then otp.py
will construct a new password and store the seed and password into $HOME/.otp
. The password will be used the next time the seed is seen.
xclip
fails, try using pbcopy
to support macOSkeyring
python package to support keyrings instead of a plaintext fileLicensed under the Apache License, v2.0