pass-otp, 用于管理一次性口令( OTP ) 令牌的pass扩展

分享于 

9分钟阅读

GitHub

  繁體 雙語
A pass extension for managing one-time-password (OTP) tokens
  • 源代码名称:pass-otp
  • 源代码网址:http://www.github.com/tadfisher/pass-otp
  • pass-otp源代码文档
  • pass-otp源代码下载
  • Git URL:
    git://www.github.com/tadfisher/pass-otp.git
    Git Clone代码到本地:
    git clone http://www.github.com/tadfisher/pass-otp
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/tadfisher/pass-otp
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    分支状态
    Build Status: master
    开发Build Status: develop
    通过 otp

    一个用于管理( OTP ) 令牌的传递命令行扩展。

    用法

    
    Usage:
    
    
    
     pass otp [code] [--clip,-c] pass-name
    
    
     Generate an OTP code and optionally put it on the clipboard.
    
    
     If put on the clipboard, it will be cleared in 45 seconds.
    
    
    
     pass otp insert [--force,-f] [--echo,-e] [pass-name]
    
    
     Prompt for and insert a new OTP key URI. If pass-name is not supplied,
    
    
     use the URI label. Optionally, echo the input. Prompt before overwriting
    
    
     existing password unless forced. This command accepts input from stdin.
    
    
    
     pass otp append [--force,-f] [--echo,-e] pass-name
    
    
     Appends an OTP key URI to an existing password file. Optionally, echo
    
    
     the input. Prompt before overwriting an existing URI unless forced. This
    
    
     command accepts input from stdin.
    
    
    
     pass otp uri [--clip,-c] [--qrcode,-q] pass-name
    
    
     Display the key URI stored in pass-name. Optionally, put it on the
    
    
     clipboard, or display a QR code.
    
    
    
     pass otp validate uri
    
    
     Test if the given URI is a valid OTP key URI.
    
    
    
    More information may be found in the pass-otp(1) man page.
    
    
    
    

    示例

    提示输入OTP令牌,隐藏输入:

    
    $ pass otp insert totp-secret
    
    
    Enter otpauth://URI for totp-secret:
    
    
    Retype otpauth://URI for totp-secret:
    
    
    
    

    提示输入OTP令牌,回显输入:

    
    $ pass otp insert -e totp-secret
    
    
    Enter otpauth://URI for totp-secret: otpauth://totp/totp-secret?secret=AAAAAAAAAAAAAAAA&issuer=totp-secret
    
    
    
    

    otpauth:// URI管道插入 passfile:

    
    $ pass otp insert totp-secret <totp-secret.txt 
    
    
    
    

    使用 zbar 将QR图像解码为 passfile:

    
    $ zbarimg -q --raw qrcode.png | pass otp insert totp-secret
    
    
    
    

    相同,但附加到现有 passfile:

    
    $ zbarimg -q --raw google-qrcode.png | pass otp append google/example@gmail.com
    
    
    
    

    使用这里标记生成 2FA 代码:

    
    $ pass otp totp-secret
    
    
    698816
    
    
    
    

    显示OTP令牌的二维码:

    
    $ pass otp uri -q totp-secret
    
    
    █████████████████████████████████████
    
    
    █████████████████████████████████████
    
    
    ████ ▄▄▄▄▄ ██▄▄ ▀█ ▀ █▀█ ▄▄▄▄▄ ████
    
    
    ████ █ █ █▀▄ █▀▀▄▀▀██ █ █ █ ████
    
    
    ████ █▄▄▄█ █▄▀ █▄▄▄ █▀▀▄ █ █▄▄▄█ ████
    
    
    ████▄▄▄▄▄▄▄█▄▀▄█ ▀ █▄█ ▀▄█▄▄▄▄▄▄▄████
    
    
    ████▄▄▀██▄▄ ▀▄ █▄█▀ ▀▄▀▀▄▀█▀ ▄▀██████
    
    
    ████ ▀▄▀ ▄▀ ▄▀ ▄▄ ▄ ███ ██ █ ███████
    
    
    ████▀▀ ▄▄█▄▄▄▄ █ █ ▀███▀▄▀ ▀▀█ ████
    
    
    ████▀▄▀ ▀ ▄█▀▄██ ▀▀▄██▀█▀▄▀▀ ▀█▀████
    
    
    ████▀ █▀ ▄▄██ █▀▄▄▄ ▄▀ ▄▀ ▀ ▄▀▀████
    
    
    ████ ▄ ▀█ ▄█▄ ▀ ▄██▄▀██▄ ▀▀▀█ ▄▀ ████
    
    
    ████▄█▄▄▄█▄▄ █▄▄ ▀█ █▄█▀ ▄▄▄ █▄█▄████
    
    
    ████ ▄▄▄▄▄ █ ▄▀▀▀▀▄ █▄▄ █▄█ ███▀████
    
    
    ████ █ █ ██▀▄ █▄█ ▀█▀ ▄▄▄█▀▄ ████
    
    
    ████ █▄▄▄█ █▀▄ █ █ ██▄▄▀ ▀▄█ ▄▀████
    
    
    ████▄▄▄▄▄▄▄█▄█▄▄███▄█▄█▄█▄█▄██▄██████
    
    
    █████████████████████████████████████
    
    
    █████████████████████████████████████
    
    
    
    

    安装

    来自git的

    
    git clone https://github.com/tadfisher/pass-otp
    
    
    cd pass-otp
    
    
    sudo make install
    
    
    
    

    Arch Linux

    pass-otp[community] 存储库中可用:

    
    pacman -S pass-otp
    
    
    
    

    NixOS

    • configuration.nix

    系统宽度:

    {
     environment.systemPackages= [ pkgs.pass-otp ];
    }

    每个用户:

    {
     users.users."name".packages= [ pkgs.pass-otp ];
    }
    • 命令性
    
    nix-env -i pass-otp
    
    
    
    

    macOS

    
    brew install oath-toolkit
    
    
    git clone https://github.com/tadfisher/pass-otp
    
    
    cd pass-otp
    
    
    make install PREFIX=/usr/local
    
    
    
    

    要求

    • pass 1.7.0或者更高版本支持扩展
    • 用于生成 2FA 代码的oathtool
    • 用于生成QR码图像的qrencode

    构建要求

    • make test
      • pass> = 1.7.0
      • git
      • oathtool
      • expect
    • make lint
      • shellcheck

    从通过 otp-0.1迁移

    pass-otp 已经切换到标准密钥Uri格式中存储OTP令牌。 你需要编辑所有保存的标记并将它们更改为这里格式。 例如:

    
    $ pass edit totp-secret
    
    
    
    

    旧格式:

    
    otp_secret: AAAAAAAAAAAAAAAA
    
    
    otp_type: totp
    
    
    otp_algorithm: sha1
    
    
    otp_period: 30
    
    
    otp_digits: 6
    
    
    
    

    新格式:

    
    otpauth://totp/totp-secret?secret=AAAAAAAAAAAAAAAA&issuer=totp-secret
    
    
    
    

    注意,下面的默认值不需要在URI中指定:

    参数默认值
    算法sha1
    期间30
    数字6

    许可证

    
    Copyright (C) 2017 Tad Fisher
    
    
    
    This program is free software: you can redistribute it and/or modify
    
    
    it under the terms of the GNU General Public License as published by
    
    
    the Free Software Foundation, either version 3 of the License, or
    
    
    (at your option) any later version.
    
    
    
    This program is distributed in the hope that it will be useful,
    
    
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    
    
    GNU General Public License for more details.
    
    
    
    You should have received a copy of the GNU General Public License
    
    
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    
    
    
    

    MAN  ext  时间  password  Token  OTP  
    相关文章