LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   USB pass key (https://www.linuxquestions.org/questions/linux-newbie-8/usb-pass-key-4175591338/)

linux4evr5581 10-13-2016 11:00 AM

USB pass key
 
Can anyone recommend a method to generating passwords using all available password characters? I'm tired of creating and manually entering long passwords so I want to make a USB passkey for the login screen, sudo, root, etc.. Thanks in advance!

szboardstretcher 10-13-2016 11:08 AM

If you have the ability to install 'pwgen' then do that. Change the '64' to how ever many digits you need and the '1' to how many passwords you need:

Code:

yum install pwgen
pwgen 64 1

Or using basic commands. Change the 'length=64' to how ever many digits you need and the 'passwords=1' to how many passwords you need:

Code:

passwords=1
length=64
x=1
while [ $x -le $passwords ]
do
  strings /dev/urandom | head -n 100 | tr -d '\n','\ ','\t' | cut -c1-$length
  x=$(( $x + 1 ))
done


linux4evr5581 10-13-2016 12:44 PM

Quote:

Originally Posted by szboardstretcher (Post 5617505)
If you have the ability to install 'pwgen' then do that. Change the '64' to how ever many digits you need and the '1' to how many passwords you need:

Code:

yum install pwgen
pwgen 64 1

Or using basic commands. Change the 'length=64' to how ever many digits you need and the 'passwords=1' to how many passwords you need:

Code:

passwords=1
length=64
x=1
while [ $x -le $passwords ]
do
  strings /dev/urandom | head -n 100 | tr -d '\n','\ ','\t' | cut -c1-$length
  x=$(( $x + 1 ))
done


I decided I like makepasswd, but your scipt, do I just modify it to run on startup then paste to my USB and it will work just like a key?

Turbocapitalist 10-13-2016 12:55 PM

If you're dealing with a lot of remote logins, you can put RSA keys onto various sorts of dongle. the Yubikey can use RSA or maybe the NitroKey. Older versions of the Yubikey (Neo and earlier) still use FOSS, but the new ones not so much and can be avoided.

linux4evr5581 10-13-2016 01:17 PM

Quote:

Originally Posted by Turbocapitalist (Post 5617568)
If you're dealing with a lot of remote logins, you can put RSA keys onto various sorts of dongle. the Yubikey can use RSA or maybe the NitroKey. Older versions of the Yubikey (Neo and earlier) still use FOSS, but the new ones not so much and can be avoided.

Thanks I just read an article on NitroKey I guess it uses special firmware that prevents viruses or something. I wonder if its possible to use a CD-R instead of USB? But now I'm looking into pam-usb tools which uses 2fa with a token and one time pass, I think it's what im looking for aslong as I can use makepasswd to genetrate the onetime pass..

Turbocapitalist 10-13-2016 01:25 PM

Quote:

Originally Posted by linux4evr5581 (Post 5617582)
Thanks I just read an article on NitroKey I guess it uses special firmware that prevents viruses or something. I wonder if its possible to use a CD-R instead of USB? But now I'm looking into pam-usb tools which uses 2fa with a token and one time pass, I think it's what im looking for aslong as I can use makepasswd to genetrate the onetime pass..

Not really. The dongles appear as keyboards, all processing is done onboard separate from the main computer. With a CD-RW (or CD-R) you'd be running the program in main memory and the whole disc would be readable. Then that'd defeat some of the theoretical protection offered by dongles.

You might look at TOTP or something like that, but I haven't used those. The old way to do OTP was S/Key or an equivalent. They'd use PAM. I think there's even a PAM module called OTPW. Either way, there's more to it than just generating a list of passwords.

linux4evr5581 10-13-2016 03:18 PM

I assumed that the CD-R would be less permissive than a USB since a USB is read/write. So wouldn't both be readable in either case which is why you encrypt the flash drive? (or in case of the CD-R encrypt the password database, and use a password file as the encryption key and that key can be stored on the CD-R that's encrypted with Rohos) TOTP sounds good but I think you need the app the generates the tokens on mobile phone.. At most I would use a Rasberry Pie to do that if possible, but I dont want to use a mobile device just for that. So I guess the oldschool way like you said OTP with PAM modules would work.. I understand its more than just passwords, theres an algorithm that genetrates the token, but then I thought the other part was just making a password..

Turbocapitalist 10-13-2016 09:52 PM

You also have to have a way to verify the password used, and a way to cross it off the list once it is used.

The CD-RW / CD-R analog won't work because the Yubikey and NitroKey are not flash drives. The OS does not read them, their contents are unavailable to the OS. If you want to think of them as anything, think of them as keyboards. Only one password is available at a time and the dongle types it in for you.

In the case of Yubikey, you press a button and the very small computer inside the dongle will generate and send to USB input a new one-time password (OTP) just as if you typed it out. The OTP consists of a public id for the dongle itself plus an encoded, AES-encrypted version of the OTP. The machine you are authenticating on needs to be able to decrypt the OTP and then verify it's components. First there is a CRC check of sorts. Then various fields inside the OTP are extracted, including a counter to try to prevent replay attacks.

At least that's the case if I interpret it correctly:

https://github.com/Yubico/yubico-c/b...st-vectors.txt

linux4evr5581 10-14-2016 10:31 AM

Quote:

Originally Posted by Turbocapitalist (Post 5617785)
You also have to have a way to verify the password used, and a way to cross it off the list once it is used.

The CD-RW / CD-R analog won't work because the Yubikey and NitroKey are not flash drives. The OS does not read them, their contents are unavailable to the OS. If you want to think of them as anything, think of them as keyboards. Only one password is available at a time and the dongle types it in for you.

In the case of Yubikey, you press a button and the very small computer inside the dongle will generate and send to USB input a new one-time password (OTP) just as if you typed it out. The OTP consists of a public id for the dongle itself plus an encoded, AES-encrypted version of the OTP. The machine you are authenticating on needs to be able to decrypt the OTP and then verify it's components. First there is a CRC check of sorts. Then various fields inside the OTP are extracted, including a counter to try to prevent replay attacks.

At least that's the case if I interpret it correctly:

https://github.com/Yubico/yubico-c/b...st-vectors.txt

I get it now theres a HID device on the dongle that's acts like the keyboard. But just to clear things up are those dongles the only way to make it act as an automatic key, I cant do it on a USB? Or can I use a USB but have to use the token method only, instead of the traditional 2fa with a token and password? I say traditional because pamusb-tools can have 2fa, but it does so by merging the token with the one-time pass...

Turbocapitalist 10-14-2016 12:45 PM

Having your program on your regular USB key will be no different than having it in your home directory except that it might disappear from time to time while it is unplugged. It's still a regular file system and is visible while plugged in and mounted. The dongle is a small, specialized computer that just does one or two things resulting in it acting like a keyboard and sending a steam of fake keystrokes.

With PAM you can require one method of several available or else require two or more methods for authentication.

linux4evr5581 10-14-2016 12:54 PM

So it should still work, that's great, ok I understand now that the dongle keys are more specialized therfor more reliable, efficient and secure.. Thanks for all the help!!


All times are GMT -5. The time now is 11:20 PM.