Skip to content

k-saiki/mfa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mfa

Generate TOTP(Time-based One-time Password) token with CLI.

Installation

  • Download from Release.
  • Unzip and move to the directory of PATH.

Configuration

Default config file is $HOME/.mfa/secrets.yml or $HOME/.mfa/secrets.yaml .

service:
  - name: amazon
    secret: "your secret key"
  - name: google
    secret: "your secret key"
  - name: github
    secret: "your secret key"

You can change config file path to use environment variable.

$ export MFA_CONFIG=/path/to/file

Usage

Generate token

$ mfa gen amazon
999999

List services

$ mfa list
amazon
google
github

Use case

aws-vault with direnv.

$ echo 'export AWS_REGION=<region code>' > .envrc
$ echo 'export AWS_DEFAULT_REGION=${AWS_REGION}' >> .envrc
$ echo 'eval $(aws-vault export --mfa-token=$(mfa gen aws) --format=export-env <profile>)' >> .envrc
$ direnv allow
direnv: loading .envrc
direnv: export +AWS_ACCESS_KEY_ID +AWS_CREDENTIAL_EXPIRATION +AWS_DEFAULT_REGION +AWS_REGION +AWS_SECRET_ACCESS_KEY +AWS_SESSION_TOKEN

TODO

  • Add test

About

Generate TOTP(Time-based One-time Password) token with CLI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages