News for hackers. Stuff that matters.
Re:TOTP tokens on my wrist with the smartest dumb watch by distcs on Tuesday October 18, 2022 @07:12AM (#33245571)
Is there some Unix-ish tool to generate these TOTPs on a laptop? I don't like to keep the 2nd factor on a small mobile device that is easy to lose. So I ask about a laptop tool.

By Unix-ish I mean something that is small and does one thing well. Like pipe in a secret to it and it gives me a TOTP? Pipe in multiple secrets and it gives me multiple TOTPs? Then I don't have to remain beholden to a custom encryption format. I can encrypt my secrets with other Unix-ish tools, decrypt it, pipe it to this tool and get my TOTPs. Recommendations?

Re:TOTP tokens on my wrist with the smartest dumb watch by grenoire on Tuesday October 18, 2022 @07:36AM (#33245763)
I just cooked up something in Python if you have it installed on your system, quite straightforward to use. If there's interest, I can prepare a compiled version.

Unlike the other ones posted here, this one just takes secrets as arguments:

    > python -mtotp DGLTPWEUERUUDCEC SWPKQCKEWRXPCRXE
    628502
    674329
https://gist.github.com/evrimoztamur/3cf2e3205c3661fc04a4214...
Re:TOTP tokens on my wrist with the smartest dumb watch by susam on Tuesday October 18, 2022 @07:44AM (#33245830)
I believe it is worth mentioning here that reading secrets from command line arguments exposes the secrets in shell history (e.g., ~/.bash_history, ~/.zsh_history, etc.), thus writing the secrets in cleartext to the filesystem. If command line auditing is enabled on a system, any secrets in command line arguments would be exposed in such audit logs too.

Further, if multiple users are logged into the same system (perhaps an unlikely scenario for most people), then secrets in command line arguments would expose the secrets in the output of ps -ef too thereby exposing the secrets to other users.

By the way, I have a similar script at https://github.com/susam/mintotp but it reads secrets from the standard input (as opposed to reading from command line arguments), one secret per line, and outputs TOTP values, one per line. Most of what this script does can be done with oathtool too and there is a section titled "Alternative: OATH Toolkit" in the README that documents this in detail.

Re:TOTP tokens on my wrist with the smartest dumb watch by grenoire on Tuesday October 18, 2022 @08:22AM (#33246130)
I should indeed have mentioned that. On the other hand, this is not a concern if you do not execute the it outside your shell (e.g. in another script that reads TOTP secrets from elsewhere).
Re:TOTP tokens on my wrist with the smartest dumb watch by twalla on Tuesday October 18, 2022 @10:50AM (#33248106)
fun fact: you can teach your shell to ignore commands that begin with a space character. in bash $HISTCONTROL needs to be ignorespace or ignoreboth, in zsh you must setopt HIST_IGNORE_SPACE
Re:TOTP tokens on my wrist with the smartest dumb watch by neilv on Tuesday October 18, 2022 @11:20AM (#33248645)
> reading secrets from command line arguments exposes the secrets in shell history

Yes, and process arguments (such as from command line) can also be accessible in process list data that's accessible to other processes and users.

Even if the process only lives for an instant, or normally no other processes could access the data, good practice is to nevertheless keep secrets out of any process arguments.

Re:TOTP tokens on my wrist with the smartest dumb watch by 3np on Tuesday October 18, 2022 @07:36AM (#33245764)
Here's an example of how you can wrap oathtool from oath-toolkit: https://markusholtermann.eu/2018/08/simple-bash-totp-script/

https://www.nongnu.org/oath-toolkit/

Re:TOTP tokens on my wrist with the smartest dumb watch by tecleandor on Tuesday October 18, 2022 @07:21AM (#33245647)
Several options...

Not exactly the same, but if you're using Bitwarden (which is compatible with generating TOTP tokens) to manage your passwords, you can use their bitwarden-cli tool to request tokens from the cli: https://bitwarden.com/help/cli/#get

But if you want the simplest cli thing, you can probably can use this golang ( https://github.com/yitsushi/totp-cli ) or this python ( https://github.com/WhyNotHugo/totp-cli ) implementations.

Re:TOTP tokens on my wrist with the smartest dumb watch by wolczek on Tuesday October 18, 2022 @07:28AM (#33245699)
https://keepassxc.org comes with keepassxc-cli
Re:TOTP tokens on my wrist with the smartest dumb watch by guipsp on Tuesday October 18, 2022 @07:15AM (#33245599)
Re:TOTP tokens on my wrist with the smartest dumb watch by maeln on Tuesday October 18, 2022 @07:42AM (#33245811)
> Is there some Unix-ish tool to generate these TOTPs on a laptop? I don't like to keep the 2nd factor on a small mobile device that is easy to lose.

I know that this is not really answering your question, but most open-source TOTP apps (like andOTP and Aegis) can export all the TOTP in an encrypted file that you can save. So if you lose your main TOTP device you can restore all of them quite easily.

Re:TOTP tokens on my wrist with the smartest dumb watch by undume on Tuesday October 18, 2022 @07:44AM (#33245833)
OATH Tookit provides console tool for generating TOTP codes: oathtool. https://www.nongnu.org/oath-toolkit/
Re:TOTP tokens on my wrist with the smartest dumb watch by aw1cks on Tuesday October 18, 2022 @07:48AM (#33245860)
pass-otp[0] integrates into pass[1] nicely. It's about as unix-y as password/secret management comes in my eyes.

Alternatively, gopass[2], which re-implements pass in golang, has this functionality built in[3].

[0] https://github.com/tadfisher/pass-otp

[1] https://www.passwordstore.org/

[2] https://www.gopass.pw/

[3] https://github.com/gopasspw/gopass/blob/master/docs/commands...

Re:TOTP tokens on my wrist with the smartest dumb watch by nashashmi on Tuesday October 18, 2022 @08:45AM (#33246318)
Also need to mention totp.app

It allows export import feature of keys

Re:TOTP tokens on my wrist with the smartest dumb watch by tadfisher on Tuesday October 18, 2022 @12:51PM (#33250359)
Thanks for the compliment!
Re:TOTP tokens on my wrist with the smartest dumb watch by pabs3 on Wednesday October 19, 2022 @07:46AM (#33260714)
Also use browserpass to integrate pass with Firefox/etc:

https://github.com/browserpass/

Re:TOTP tokens on my wrist with the smartest dumb watch by nashashmi on Tuesday October 18, 2022 @08:02AM (#33245971)
Totp.app is a great web app. So you can install on your phone as well
Re:TOTP tokens on my wrist with the smartest dumb watch by Amorymeltzer on Tuesday October 18, 2022 @08:04AM (#33245984)
Re:TOTP tokens on my wrist with the smartest dumb watch by computerfriend on Tuesday October 18, 2022 @08:44AM (#33246308)
You can also store them on YubiKeys, accessible on the command line with ykman.
Re:TOTP tokens on my wrist with the smartest dumb watch by lukeschlather on Tuesday October 18, 2022 @08:55AM (#33246404)
You need a TPM 2.0 compatible CPU, but something like this sounds really excellent: https://github.com/tpm2-software/tpm2-totp

This means your laptop itself would be your hardware device, the TOTP secret would be stored in the TPM and theoretically impossible to steal/copy. Of course this means you will probably want a mobile device (possibly a second laptop also) as a backup.)

Re:TOTP tokens on my wrist with the smartest dumb watch by cryptonector on Tuesday October 18, 2022 @11:38AM (#33249028)
Note that tpm2-totp is specifically meant to authenticate your laptop's state (TPM PCR values) to you, not you to some third system. But you could adapt tpm2-totp for the purpose of authenticating you to other systems.
Re:TOTP tokens on my wrist with the smartest dumb watch by emreb on Tuesday October 18, 2022 @09:16AM (#33246634)
Authy used to have a Chrome client you can run on your computer that syncronizes all your secrets.
Re:TOTP tokens on my wrist with the smartest dumb watch by markstos on Tuesday October 18, 2022 @09:49AM (#33247098)
You are looking for a Yubikey and `ykman`.

This is secure because the secret never leaves the hardware key.

This is convenient because you launch a tool with a global keyboard shortcut and copy/paste the code. I use `yubikey-oath-dmenu` to allow me to quickly filter to the TOTP code I need.

Re:TOTP tokens on my wrist with the smartest dumb watch by adamgordonbell on Tuesday October 18, 2022 @10:10AM (#33247402)
I think you want oathtool.

You can also use python's pyotp.totp.now()

https://earthly.dev/blog/multi-factor-auth/

Re:TOTP tokens on my wrist with the smartest dumb watch by austinjp on Wednesday October 19, 2022 @01:45AM (#33258213)
I use https://github.com/pcarrier/gauth

It relies on file permissions so is not exactly robustly secure (no idea about RAM vulnerabilities etc).

As per the author, I consider my laptop the fundamental point of vulnerability. If someone else gets access to it, I'll know and I'll hit the metaphorical panic button :)

Edit: I recently set up a new laptop, and copied my OTP seeds from Aegis into gauth without a hitch. Another step closer to me moving away from Authy.