You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
keyfob is a two-factor authentication agent suitable for AWS and Github. Works pretty much the same as Google Authenticator, but uses your laptop's keychain.
2
+
3
+
Usage:
4
+
5
+
go get -u github.com/StevenACoffman/keyfob
6
+
7
+
keyfob add [name] [key]
8
+
keyfob otp [name]
9
+
keyfob help
10
+
11
+
`keyfob add name` adds a new key to the keyfob keychain with the given name. It
12
+
prints a prompt to standard error and reads a two-factor key from standard
13
+
input. Two-factor keys are short case-insensitive strings of letters A-Z and
14
+
digits 2-7.
15
+
16
+
The new key generates time-based (TOTP) authentication codes.
17
+
18
+
`keyfob opt [name]` prints a One Time Password (aka two-factor authentication) code from the key with the
19
+
given name. If `--clip` is specified, `keyfob` also copies to the code to the system
20
+
clipboard.
21
+
22
+
With no arguments, `keyfob` prints two-factor authentication codes from all
23
+
known time-based keys.
24
+
25
+
The time-based authentication codes are derived from a hash of the
26
+
key and the current time, so it is important that the system clock have at
27
+
least one-minute accuracy.
28
+
29
+
The keychain is stored unencrypted in the text file `$HOME/.keyfob`.
30
+
31
+
## Example
32
+
33
+
During GitHub 2FA setup, at the “Scan this barcode with your app” step,
34
+
click the “enter this text code instead” link. A window pops up showing
35
+
“your two-factor secret,” a short string of letters and digits.
36
+
37
+
Add it to keyfob under the name github, typing the secret at the prompt:
38
+
39
+
$ keyfob add github
40
+
keyfob key for github: nzxxiidbebvwk6jb
41
+
$
42
+
43
+
Then whenever GitHub prompts for a 2FA code, run keyfob to obtain one:
44
+
45
+
$ keyfob otp github
46
+
268346
47
+
$
48
+
49
+
## Derivation
50
+
51
+
This is just a little toy cobbled together from [2fa](https://github.com/rsc/2fa/), [cobra](https://github.com/spf13/cobra), and [go-keyring](https://github.com/zalando/go-keyring).
52
+
53
+
Unlike 2fa, this doesn't support listing all the stored codes, or adding 7 or 8 character long TOTP, or counter-based (HOTP) codes. Pillaging ... ehrm... adapting the 2fa code to do that in here would be easy, but I don't need it.
54
+
55
+
## Really, does this make sense?
56
+
57
+
At least to me, it does. My laptop features encrypted storage, a stronger authentication mechanism, and I take good care of its physical integrity.
58
+
59
+
My phone also runs arbitrary apps, is constantly connected to the Internet, gets forgotten on tables.
60
+
61
+
Thanks to the convenience of a command line utility, I'm more likely to enable MFA in more places.
62
+
63
+
Clearly a win for security.
64
+
65
+
## Dependencies
66
+
67
+
#### OS X
68
+
69
+
The OS X implementation depends on the `/usr/bin/security` binary for
70
+
interfacing with the OS X keychain. It should be available by default.
71
+
72
+
#### Linux
73
+
74
+
The Linux implementation depends on the [Secret Service][SecretService] dbus
75
+
interface, which is provided by [GNOME Keyring](https://wiki.gnome.org/Projects/GnomeKeyring).
76
+
77
+
It's expected that the default collection `login` exists in the keyring, because
78
+
it's the default in most distros. If it doesn't exist, you can create it through the
79
+
keyring frontend program [Seahorse](https://wiki.gnome.org/Apps/Seahorse):
0 commit comments