LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-09-2023, 07:52 AM   #1
uberprutser
LQ Newbie
 
Registered: Oct 2023
Posts: 12

Rep: Reputation: 11
TOTP tool for Debian


I just installed Debian 12 with xfce on my old 32bit laptop.
And now I would like to add a simple gui for TOTP 2fa login.
I tried to install keepassxc but that needs 120MB! There must be something smaller
 
Old 10-09-2023, 08:40 AM   #2
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,628

Rep: Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557

No idea, but I've been planning to lookup such a tool myself.

Debian package pages have a "Similar packages" option - visiting //packages.debian.org/keepassxc lists a bunch, but from a quick look none of them appear suitable.

Searching Debian package descriptions for "totp" reveals... well a whole bunch of libraries, but hidden in amongst those is:

* otpclient
* numerstation

They both depend on GTK3, which I dislike, so I guess yet another task for my todo list is to look at Python-based Numberstation and see what it takes to switch it to a different UI library (like Tk).

 
Old 10-09-2023, 08:44 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,042

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
what needs 120MB? I guess you could try to recompile/rebuild keepassxc, it won't be that much, especially if you remove the documentation and sources.
 
Old 10-09-2023, 09:29 AM   #4
uberprutser
LQ Newbie
 
Registered: Oct 2023
Posts: 12

Original Poster
Rep: Reputation: 11
I've installed OTPClient and it didn't need 120mb of libraries But now I have a new problem/challenge.
On windows 10 I use a program Winauth and it gives me the 6 digits I need to login to my google account (2fa)
Winauth can export a QR code and I used that to setup my google authenticator on android.
So codes generated on windows and android are in sync.
I can import the same QR code in OTPClient (using a png file) but then it generates a different code.... something is wrong, but I'm at a loss!

Last edited by uberprutser; 10-09-2023 at 09:31 AM.
 
Old 10-09-2023, 10:36 AM   #5
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,678

Rep: Reputation: Disabled
At one point, I successfully imported data (that was definitely not a QR code) from Winauth into OTPClient using its Import dialog. It was a plain text file. Sorry, cannot remember what exact format that was. OTPClient offers five formats for import. Winauth says it exports in Google KeyUriFormat, but there's no such option in OTPClient. I tried available options one after another, and one of them worked. I guess that was Authenticator Plus, but I'm not sure.

The only problem afterwards was that it mixed Account and Issuer fields in some lines, so nothing critical: authentication worked anyway.
 
Old 10-09-2023, 11:20 AM   #6
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,628

Rep: Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557

Numberstation is built around pyotp, which is a <50KB Python library with no other dependencies.

Thus, after doing "apt install python3-pyotp", one can write some trivial Python:
Code:
#!/usr/bin/env python3

import sys,pyopt,datetime

for a in sys.argv[1:]:

   totp = pyotp.parse_uri(a) if a.startswith('otpauth:') else pyotp.totp.TOTP(a)

   print (f'''
Name: {totp.name}
Issuer: {totp.issuer}
Secret: {totp.secret}
Password: {totp.now()}
Expires: {int(totp.interval - datetime.datetime.now().timestamp() % totp.interval)} seconds
''')
And then execute it like so:
Code:
$ ./test-totp.py I65VU7K5ZQL7WB4E otpauth://totp/totp@authenticationtest.com?secret=I65VU7K5ZQL7WB4E

Name: Secret
Issuer: None
Secret: I65VU7K5ZQL7WB4E
Password: 458681
Expires: 28 seconds


Name: totp@authenticationtest.com
Issuer: None
Secret: I65VU7K5ZQL7WB4E
Password: 458681
Expires: 28 seconds
Shouldn't be hard to add a QR decoder onto the front of that, and/or something to read secret(s) from somewhere suitably protected.


Last edited by boughtonp; 10-09-2023 at 11:21 AM.
 
Old 10-09-2023, 01:28 PM   #7
uberprutser
LQ Newbie
 
Registered: Oct 2023
Posts: 12

Original Poster
Rep: Reputation: 11
I installed numberstation, and it does give me the correct code. Otpclient looked better and I was able to copy the code. But for now the problem is fixed
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pthread_cond_wait sys call is getting assert failure when using helgrind tool in valgrind but not failed with memcheck tool with valgrind kalyan.vangipurapu Programming 7 06-21-2017 08:28 AM
Application crashing with assertion failure with helgrind tool but not with memcheck tool kalyan.vangipurapu Linux - Software 2 06-03-2017 07:45 AM
LXer: GNOME Tweak Tool - A tool for changing specialised or advanced GNOME3 settings LXer Syndicated Linux News 0 10-12-2011 11:50 PM
Cross-tool 0.42: Tool-chain compilation process fail ueagle Linux From Scratch 2 03-26-2011 03:43 AM
URLSCAN tool MS = Linux tool ? OB1 Linux - Security 3 10-05-2002 12:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration