• Stars
    star
    316
  • Rank 132,587 (Top 3 %)
  • Language
    Go
  • License
    ISC License
  • Created over 11 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Google Authenticator in your terminal

Go presubmit

gauth: replace Google Authenticator

Installation

With a Go environment already set up, it should be as easy as go install github.com/pcarrier/gauth@latest.

Eg, with GOPATH=$HOME/go (its default), it will create a binary $HOME/go/bin/gauth.

Usage

  • In web interfaces, pretend you can't read QR codes, get a secret like hret 3ij7 kaj4 2jzg instead.

  • Store one secret per line in ~/.config/gauth.csv, in the format name:secret. For example:

      AWS:   ABCDEFGHIJKLMNOPQRSTUVWXYZ234567ABCDEFGHIJKLMNOPQRSTUVWXYZ234567
      Airbnb:abcd efgh ijkl mnop
      Google:a2b3c4d5e6f7ghij
      Github:234567qrstuvwxyz
      otpauth://totp/testOrg:testuser?secret=AAAQEAYEAUDAOCAJ======&issuer=testOrg&algorithm=SHA512&digits=8&period=30
    
  • Restrict access to your user:

      $ chmod 600 ~/.config/gauth.csv
    
  • Run gauth. The progress bar indicates how far the next change is.

      $ gauth
                 prev   curr   next
      AWS        315306 135387 483601
      Airbnb     563728 339206 904549
      Google     453564 477615 356846
      Github     911264 548790 784099
      [=======                      ]
    
  • Run gauth KEYNAME to print a specific key with progress bar.

  • Run gauth KEYNAME -b to print a bare current key.

      $ gauth Google -b
      477615
    
  • gauth is convenient to use in watch.

      $ watch -n1 gauth
    
  • Remember to keep your system clock synchronized and to lock your computer when brewing your tea!

  • If you find yourself needing to interpret a QR code (e.g. exporting a code from an existing Google Authenticator setup, on a phone to which you do not have root access), then gauthQR may be useful.

Encryption

gauth supports password-based encryption of gauth.csv. To encrypt, use:

    $ openssl enc -aes-128-cbc -md sha256 -in ~/gauth.csv -out ~/.config/gauth.csv
    enter aes-128-cbc encryption password:
    Verifying - enter aes-128-cbc encryption password:

gauth will then prompt you for that password on every run:

    $ gauth
    Encryption password:
               prev   curr   next
    LastPass   915200 479333 408710

Note that this encryption mechanism is far from ideal from a pure security standpoint. Please read OpenSSL's notes on the subject.

Compatibility

Tested with:

  • Airbnb
  • Apple
  • AWS
  • DreamHost
  • Dropbox
  • Evernote
  • Facebook
  • Gandi
  • Github
  • Google
  • LastPass
  • Linode
  • Microsoft
  • Okta (reported by Bryan Baldwin)
  • WP.com
  • bittrex.com
  • poloniex.com

Please report further results to [email protected].

Rooted Android?

If your Android phone is rooted, it's easy to "back up" your secrets from an adb shell into gauth.

# sqlite3 /data/data/com.google.android.apps.authenticator2/databases/database \
          'select email,secret from accounts'

If your phone isn't rooted, you may have luck with the gauthQR tool mentioned in the Usage section above.

Really, does this make sense?

At least to me, it does. My laptop features encrypted storage, a stronger authentication mechanism, and I take good care of its physical integrity.

My phone also runs arbitrary apps, is constantly connected to the Internet, gets forgotten on tables.

Thanks to the convenience of a command line utility, my usage of 2-factor authentication went from 3 to 10 services over a few days.

Clearly a win for security.

More Repositories

1

afuse

An automounter implemented with FUSE
C
97
star
2

srv.us

ssh to expose local HTTP services online, CLI pastebin, etc.
Go
79
star
3

ident.me

free public IP address APIs
Swift
34
star
4

planck

Planck: a thumb-chorded 47-key keyboard
C
16
star
5

cdb64

Format-incompatible 64-bit version of cdb (no 4GB limit)
C
14
star
6

pcma

Page Cache My Assets
C
12
star
7

identify

Generate vCards and SSL certificates for LDAP accounts (unmaintained)
Java
11
star
8

datadog-sync

Automate Datadog monitor updates (unmaintained)
Go
11
star
9

teeko.cc

Play teeko online
TypeScript
6
star
10

vanity-keygen

Get your vanity SSH ed25519 keypair
Go
5
star
11

edu-rmiage

RMI-based framework (school project)
Java
4
star
12

benchmarking-uselessness

C
4
star
13

graphed

GraphQL things in Kotlin multiplatform
Kotlin
4
star
14

stuff

Bunch of small things not worth packaging separately
C
4
star
15

forms

Nim
3
star
16

bz

A partial port of https://github.com/pcarrier/baze to Nim
Nim
3
star
17

nur

Zig
2
star
18

edu-gkcours

Cours de Geoffroy Carrier
TeX
2
star
19

zat.is

Short QR codes
Go
2
star
20

ingest

Go
2
star
21

config

System config (nix-based)
Nix
2
star
22

node-murmur3

C++
2
star
23

baba

Maintain a process hierarchy
C++
2
star
24

edu-ihmprojet2

Projet 2 d'IHM
Java
1
star
25

tudos

A manually managed mirror of http://svn.tudos.org/repos/oc/tudos/
C
1
star
26

edu-msi-audit

Shell
1
star
27

edu-flightstracking

Flights tracking project for school
Python
1
star
28

edu-tortue

Projet de cours PPO
Java
1
star
29

uzaj

Attempt at Spanner data processing using Cloud Dataflow
Kotlin
1
star
30

localcert.org

Go
1
star
31

debian-minimal-repository

1
star
32

introspective

any schema at your fingertips
TypeScript
1
star
33

baze

Base toolbox for Unix
Ruby
1
star
34

java-stuff

Java
1
star
35

mcc

Unmaintained. memcache CLI tool in Java.
Java
1
star
36

edu-projet_sys_res

Projet de systeme/rΓ©seau miage 2008
C
1
star
37

dotfiles

Shell
1
star
38

meteor-connstats

Hits and DDP monitoring for Meteor apps
JavaScript
1
star