Yubico Forum

...visit our web-store at store.yubico.com
It is currently Tue Jan 30, 2018 3:28 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Nov 25, 2008 7:35 am 
Offline

Joined: Tue Nov 25, 2008 7:24 am
Posts: 2
I had problems with the pam yubikey module so I wrote an extremely simple script to force the use of a yubikey for ssh login to a linux box. You have to enter your normal password and then the yubikey.

Is it secure? As secure as just the password; more than that, I can't say.

To install, take this code and put it into ~/.ssh/rc
---cut here--
#!/bin/bash

trap "pkill -HUP -g 0" INT

# change this to your specific ID
ID=79

echo -n "Press key then enter ctrl-d: " > /dev/stderr

otp=`tr -c -d a-z < /dev/tty`

if wget -O - "https://api.yubico.com/wsapi/verify?id=$ID&otp=$otp" 2> /dev/null | grep status=OK > /dev/null
then
echo Yubikey ok > /dev/stderr
exec /bin/bash
fi

echo bad > /dev/stderr
pkill -HUP -g 0
exit 3


Top
 Profile  
Reply with quote  

Share On:

Share on Facebook FacebookShare on Twitter TwitterShare on Tumblr TumblrShare on Google+ Google+

PostPosted: Thu Nov 27, 2008 11:56 am 
Offline
Site Admin
Site Admin

Joined: Tue May 06, 2008 7:22 pm
Posts: 151
Cool. That's a more lightweight solution than PAM, thanks for sharing.

/Simon


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 30, 2009 5:18 pm 
Offline

Joined: Fri Jan 30, 2009 5:00 pm
Posts: 1
I had issues with the official PAM solution. The pam part worked fine but sshd would keep segfaulting. I think this will be less intrusive to get working on some of my work servers. I liked this because of its simplicity but wanted to be sure that it was my Yubikey not just some random one. There was not facility to verify this is my key. I did not see any way to add my key id to the api.yubico.com url. I used a simple check instead:
Code:
#!/bin/bash

trap "pkill -HUP -g 0" INT

# change this to your specific ID
ID=79

echo -n "Press key then enter ctrl-d: " > /dev/stderr

otp=`tr -c -d a-z < /dev/tty`

#Verifying that this is MY yubikey, not just some random one.
if echo $otp | grep staticpartofkey > /dev/null
then
echo Greetings
else
#Failed test
echo Intruders are not permitted, Begone with you > /dev/stderr
pkill -HUP -g 0
exit 3
fi

#Check the Yubi
if wget -O - "https://api.yubico.com/wsapi/verify?id=$ID&otp=$otp" 2> /dev/null | grep status=OK > /dev/null
then
echo Yubikey ok > /dev/stderr
exec /bin/bash
fi

#Failed test
echo bad Yubikey > /dev/stderr
pkill -HUP -g 0
exit 3


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 06, 2009 3:59 pm 
Offline

Joined: Thu Feb 05, 2009 2:34 am
Posts: 4
Good job on the script work around. I'm also experiencing segfaults with the pam module compiled on RHEL5 64bit. I'm using the latest subversion google code source code.

Is anyone else also trying to figure out why the pam module is segfaulting?

Cheers
Lucien


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 07, 2009 6:11 am 
Offline

Joined: Mon Feb 02, 2009 4:12 pm
Posts: 9
I just started a separate thread for that. Would be nice to know if the original poster was on 64 bit. I'm failing on both 64 bit Centos and Ubuntu at the moment, and will try Fedora 10 64 bit in the morning to verify.

32 bit version of Debian, Ubuntu, and Fedora all work fine.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group