Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-24-2010, 03:31 PM
|
#1
|
Member
Registered: Sep 2008
Posts: 50
Rep:
|
One-time passwords by OTPW
I want to give my users option of logging to the system. They should have posibillity for choosing option betweend logging to the system with their default password or one-time password OTPW.
I installed OTPW in my Debian.
Here is my /etc/pam.d/sshd file:
Quote:
# PAM configuration for the Secure Shell service
# Read environment variables from /etc/environment and
# /etc/security/pam_env.conf.
auth required pam_env.so # [1]
# In Debian 4.0 (etch), locale-related environment variables were moved to
# /etc/default/locale, so read that as well.
auth required pam_env.so envfile=/etc/default/locale
# OTPW support
auth sufficient pam_otpw.so
# Standard Un*x authentication.
@include common-auth
# Disallow non-root logins when /etc/nologin exists.
account required pam_nologin.so
# Uncomment and edit /etc/security/access.conf if you need to set complex
# access limits that are hard to express in sshd_config.
# account required pam_access.so
# Standard Un*x authorization.
@include common-account
# Standard Un*x session setup and teardown.
@include common-session
# Print the message of the day upon successful login.
session optional pam_motd.so # [1]
# Print the status of the user's mailbox upon successful login.
#session optional pam_mail.so standard noenv # [1]
# OTWP support
session optional pam_otpw.so
# Set up user limits from /etc/security/limits.conf.
session required pam_limits.so
# Set up SELinux capabilities (need modified pam)
# session required pam_selinux.so multiple
# Standard Un*x password updating.
@include common-password
|
Here is my /etc/ssh/sshd_config file:
Quote:
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 666
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication yes
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
# Wyswietalnie MOTD. Wlaczenie tej opcji spowoduje podwojne
# wyswietlenie MOTD
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
# Monit pokazujacy sie przed zalogowaniem
Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
# Czas na zalogowanie sie do serwera
#LoginGraceTime 120
# Maksymalna liczba proba zalogowania sie
MaxAuthTries 3
# Maksymalna liczba otwartych sesji
MaxSessions 2
LoginGraceTime 1800
ClientAliveInterval 0
UsePrivilegeSeparation yes
|
During logging I don't have information of what password I have to put. Here is information from my logs:
Quote:
Nov 24 22:13:41 borekfalecki sshd[8152]: pam_unix(sshd:session): session opened for user seprob by (uid=0)
Nov 24 22:13:41 borekfalecki sshd(pam_otpw)[8152]: pam_get_data() failed
|
|
|
|
11-25-2010, 03:56 PM
|
#2
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
Just checking that you generated some one time passwords and the file ~/.otpw exists .. ?
|
|
|
11-26-2010, 07:25 AM
|
#3
|
Member
Registered: Sep 2008
Posts: 50
Original Poster
Rep:
|
Yes, I did. It looks like following: I'm logging and system ask me about one-time password. After this ask me about my system password and then I'm in. Error in logs appears again.
|
|
|
11-27-2010, 01:04 AM
|
#4
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
I'm not sure this will work but try making the change below:
Code:
auth sufficient pam_otpw.so debug
Maybe we'll be able to get some more info out of it
|
|
|
11-27-2010, 06:03 AM
|
#5
|
Member
Registered: Sep 2008
Posts: 50
Original Poster
Rep:
|
From /var/log/auth.log:
Quote:
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: pam_sm_authenticate called, flags=1
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: username is seprob
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: uid=0, euid=0, gid=0, egid=0
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: challenge: 009
Nov 27 12:59:21 borekfalecki sshd(pam_otpw)[16240]: calling conversation function
Nov 27 12:59:36 borekfalecki sshd(pam_otpw)[16240]: conversation function returned 0
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Password 0 = '++==Sq7t'
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Prefix = ''
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: hash(password): 'by6aE7Wq+arn', hash from file: 'Nt55czUhzBY%'
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Entered password did not match.
Nov 27 12:59:36 borekfalecki (pam_otpw)[16240]: Removing lock file
Nov 27 12:59:36 borekfalecki sshd(pam_otpw)[16240]: incorrect password from user seprob
Nov 27 12:59:41 borekfalecki sshd[16236]: Accepted keyboard-interactive/pam for seprob from 91.150.220.49 port 29925 ssh2
Nov 27 12:59:41 borekfalecki sshd[16236]: pam_unix(sshd:session): session opened for user seprob by (uid=0)
Nov 27 12:59:41 borekfalecki sshd(pam_otpw)[16236]: pam_get_data() failed
Nov 27 12:59:45 borekfalecki sshd[16048]: pam_unix(sshd:session): session closed for user seprob
|
Hmm, password should looks like "++== Sq7t". It looks like system doesn't see or doesn't get ma spacebar.
|
|
|
11-27-2010, 05:46 PM
|
#6
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
Maybe try generating some new passwords and retest .. ?
|
|
|
11-29-2010, 01:11 AM
|
#7
|
Member
Registered: Sep 2008
Posts: 50
Original Poster
Rep:
|
All passwords allways have spacebar, so it won't help.
|
|
|
11-29-2010, 03:23 AM
|
#8
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
I'm not sure I understand .. are you saying that every password generated contains the [space] character ?
|
|
|
11-29-2010, 02:58 PM
|
#9
|
Member
Registered: Sep 2008
Posts: 50
Original Poster
Rep:
|
That's right.
|
|
|
11-29-2010, 05:05 PM
|
#10
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
I don't think you're supposed to enter the spaces, that's just the way the output is formatted when you generate them for readability - please try without
(borrowed from http://www.cl.cam.ac.uk/~mgk25/otpw.html)
Code:
OTPW list generated 2003-08-31 21:06 on trillium.cl.cam.ac.uk
000 IZdB bqyH 006 rF62 k6zi 012 JCFe 6at3 018 uaYT azuu 024 Nt7n b=fQ
001 yCSo /VQs 007 Phvb =6ZW 013 8Pm7 DbYJ 019 OdAk H62c 025 /pOm :ZEA
002 mESf +nWK 008 J9fH iXrn 014 MAds 6TTS 020 Aj6W 9O4P 026 DhCc yrPY
003 x4vX HXr2 009 DGPC amts 015 B=xZ waPx 021 MzUP Ahsc 027 UWTe G3Fh
004 A5z9 japt 010 s6cr xwZ5 016 sCgq Da5Y 022 Q=XK 4I7w 028 xszW Ha9L
005 YCcA k29/ 011 inn6 Rsa/ 017 m8za o/HB 023 umS= gYoU 029 +HmG Rr6P
Eg.
Password 015 should be entered as 'B=xZwaPx'
|
|
|
11-30-2010, 12:32 AM
|
#11
|
Member
Registered: Sep 2008
Posts: 50
Original Poster
Rep:
|
I did it. I receive the same message in /var/log/auth.log.
|
|
|
11-30-2010, 04:49 PM
|
#12
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
I just noticed that my sshd_config has "UsePrivilegeSeparation no", please change yours, restart sshd and retry
example session:
Code:
[root@xxx ~]# ssh me@localhost
Password 160:
Last login: Wed Dec 1 09:39:41 2010 from localhost.localdomain
[me@xxx ~]$
Password file excerpt:
Code:
...
160 kCF+ YWBW
...
Entered without spaces as:
Code:
<prefix_password>kCF+YWBW
I also noticed that selinux will prevent access to ~/.otpw and ~/otpw.lock for sshd
hth
|
|
|
12-01-2010, 05:01 AM
|
#13
|
Member
Registered: Sep 2008
Posts: 50
Original Poster
Rep:
|
Still doesn't work. I have Debian.
|
|
|
All times are GMT -5. The time now is 04:01 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|