AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 519956
Accepted
dan
dan
Asked: 2013-07-02 08:16:59 +0800 CST2013-07-02 08:16:59 +0800 CST 2013-07-02 08:16:59 +0800 CST

是否有命令行两因素身份验证验证码生成器?

  • 772

我管理具有双重身份验证的服务器。输入正常的服务器密码后,我必须使用Google Authenticator iPhone应用程序获取6位验证码才能输入。此处描述了设置:http ://www.mnxsolutions.com/security/two-factor-ssh-with-google-authenticator.html

我想要一种仅使用我的笔记本电脑而不是我的 iPhone 来获取验证码的方法。必须有一种方法可以为生成这些验证码并为您提供当前 30 秒窗口的代码的命令行应用程序提供种子。

有没有可以做到这一点的程序?

ssh
  • 8 8 个回答
  • 27028 Views

8 个回答

  • Voted
  1. Best Answer
    EEAA
    2013-07-02T08:27:54+08:002013-07-02T08:27:54+08:00

    是的,oathtool可以做到这一点。您需要使用服务器中的共享密钥为其播种。

    您可以从oath-toolkit包中安装它。

    生成与 google 身份验证器和 authy 相同的代码的示例用法:

    oathtool -b --totp 'N3V3R G0nn4 G1v3 Y0u Up'
    
    • 33
  2. Adam Terrey
    2015-08-15T22:56:36+08:002015-08-15T22:56:36+08:00

    在https://github.com/pcarrier/gauth的 github 上也有一个 go 实现

    这个使用配置文件~/.config/gauth.csv以以下格式存储令牌

    [email protected]: abcd efg hijk lmno
    aws-account: mygauthtoken
    

    输出也相当友好:

    $ gauth
               prev   curr   next
    AWS        315306 135387 483601
    Airbnb     563728 339206 904549
    Google     453564 477615 356846
    Github     911264 548790 784099
    [=======                      ]
    
    • 8
  3. Jeff VanNieulande
    2013-07-02T08:30:17+08:002013-07-02T08:30:17+08:00

    有许多 3rd 方 Authenticator 实现。查看维基百科页面上的列表。例如,您可以使用onetimepass(用 Python 编写)来使用命令行。

    • 4
  4. voretaq7
    2013-07-02T08:27:24+08:002013-07-02T08:27:24+08:00

    据我所知,Google 只发布手机(iOS、Android)的 Authenticator 应用程序。
    (这给像我这样偏执的人带来了问题,他们并不真正相信谷歌停止服务的历史,几乎没有注意到,他们更喜欢我们可以在里面看到的令牌生成器。)

    您可以考虑其他替代方案,例如一次性密码键盘系统。


    老实说,从您的笔记本电脑获取验证码会破坏两因素身份验证方面(任何捕获笔记本电脑的人现在都拥有代码生成器 - 这是 Authenticator 应该防止的一部分)。

    • 2
  5. jar
    2016-11-11T20:05:38+08:002016-11-11T20:05:38+08:00

    你可以试试http://soundly.me/oathplus

    这是我在 venerable 之上开发的一个工具oathtool,它可以让您读取 QR 码,并存储 OTP 帐户信息以供以后使用。您可以将其视为命令行的Google Authenticator,因为它可以下载和读取 QR 码,并使用otpauth://URI。(仅 OSX 自动取款机。)

    • 2
  6. mosh
    2019-01-09T11:21:46+08:002019-01-09T11:21:46+08:00
    A windows commandline gauth.exe is here https://github.com/moshahmed/gauth/
    fork of https://github.com/pcarrier/gauth to compile on windows7.
    
    $ cd ~/.ssh
    $ cat gauth.mfa
        test,ABC
    
    # Encrypt gauth.mfa to gauth.ssl
    $ openssl enc -aes-128-cbc -md sha256 -in gauth.mfa -out gauth.ssl
        password=xxx
    # Decrypt gauth.ssl and edit gauth.mfa
    $ openssl enc -aes-128-cbc -md sha256 -d -in gauth.ssl -out gauth.mfa
        password=xxx
    
    # Get the 2fa code
    $ go run gauth.go [tes] [$HOME/.ssh/gauth.ssl]
    |   pass:xxx
    |   2FA    Name
    |   129079 test
    # Print qrcode.txt on console as scan able image
      $ pip install qrcode
      $ qr "otpauth://totp/Example:[email protected]?secret=XYZ&issuer=SOMEONE"
        [qrcode printed on Console]
    # Convert text to png image, from https://github.com/miyako/console-qrencode
      $ waqrencode -t png -i mfa.txt -o mfa.png
    # Convert qrcode.jpg image to string
      $ zbarimg qrcode.jpg
    
    • 0
  7. Morgan Christiansson
    2019-07-11T02:07:36+08:002019-07-11T02:07:36+08:00

    如果您使用的是 python,则 pip 中提供了带有 CLI 前端的软件包。

    • https://pypi.org/project/authenticator/
    • https://pypi.org/project/mfa/
    • 0
  8. Guest
    2020-01-08T07:26:54+08:002020-01-08T07:26:54+08:00

    这是一个 hacky 的:https ://github.com/bjurga/DeOtp

    这是一个精简的 GoogleAuthenticator,带有一个不错的“Windows 集成”理念。git 项目非常新,显然需要改进外观,但到目前为止它运行良好。

    • 0

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve