OpenSSH and PAM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I'd like to use only PAM(for requiring additional restrictions) for
OpenSSH authentications and I'd like to have:
*key authentications
*s/key like authentications but more secure(because I was told that the
randomness of the s/key passwords is not secure nowadays)
(and additional things such as anti-brute-force system for PAM and logins
restrictions based on the time/date)

but I haven't been successful so far...
I first wanted to forbid others account than the ones listed in
/etc/ssh/sshd.allow: I've done the following
in /etc/ssh/sshd_config I've used PAM:
UsePAM yes
normal passwords were disabled,key enabled and s/key disabled
and I added:
auth           required        pam_listfile.so item=user sense=allow
file=/etc/ssh/sshd.allow onerr=fail
to /etc/pam.d/ssh

but it didn't work...account not listed in the file could still login via SSH

then I removed the key authentication in /etc/ssh/sshd_config and then
when login via SSH I was asked a password...and entering a password from
an  account that was in the file didn't work

but adding auth           required        pam_listfile.so item=user
sense=allow file=/etc/ssh/sshd.allow onerr=fail to /etc/pam.d/login
prevent non-listed users from login in

and according to theses logs sshd uses pam:
# /usr/sbin/sshd -f /etc/ssh/sshd_config -d
debug1: sshd version OpenSSH_5.1p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-f'
debug1: rexec_argv[2]='/etc/ssh/sshd_config'
debug1: rexec_argv[3]='-d'
debug1: Bind to port 443 on ::.
Server listening on :: port 443.
debug1: Bind to port 443 on 0.0.0.0.
Server listening on 0.0.0.0 port 443.
debug1: Bind to port 223 on ::.
Server listening on :: port 223.
debug1: Bind to port 223 on 0.0.0.0.
Server listening on 0.0.0.0 port 223.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 7 out 7 newsock 7 pipe -1 sock 10
debug1: inetd sockets after dupping: 3, 3
Connection from 127.0.0.1 port 39216
debug1: Client protocol version 2.0; client software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: permanently_set_uid: 22/22
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user xxx service ssh-connection method none
debug1: attempt 0 failures 0
debug1: userauth-request for user xxx service ssh-connection method publickey
debug1: attempt 1 failures 0
debug1: test whether pkalg/pkblob are acceptable
debug1: PAM: initializing for "xxx"
debug1: PAM: setting PAM_RHOST to "localhost"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: temporarily_use_uid: 1008/1020 (e=0/0)
debug1: trying public key file /home/xxx/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: matching key found: file /home/xxx/.ssh/authorized_keys, line 1
Found matching RSA key: 26:f1:81:ae:13:2f:3d:31:bd:96:1d:62:01:96:62:de
debug1: restore_uid: 0/0
Postponed publickey for xxx from 127.0.0.1 port 39216 ssh2
debug1: userauth-request for user xxx service ssh-connection method publickey
debug1: attempt 2 failures 0
debug1: temporarily_use_uid: 1008/1020 (e=0/0)
debug1: trying public key file /home/xxx/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: matching key found: file /home/xxx/.ssh/authorized_keys, line 1
Found matching RSA key: 26:f1:81:ae:13:2f:3d:31:bd:96:1d:62:01:96:62:de
debug1: restore_uid: 0/0
debug1: ssh_rsa_verify: signature correct
debug1: do_pam_account: called
Accepted publickey for xxx from 127.0.0.1 port 39216 ssh2
debug1: monitor_child_preauth: xxx has been authenticated by privileged
process
debug1: PAM: establishing credentials
debug1: PAM: establishing credentials
debug1: permanently_set_uid: 1008/1020
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max
16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype no-more-sessions@xxxxxxxxxxx
want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
User child is on pid 30159
debug1: session_new: session 0
debug1: session_pty_req: session 0 alloc /dev/pts/7
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
debug1: Setting controlling tty using TIOCSCTTY.
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 30160
debug1: session_exit_message: session 0 channel 0 pid 30160
debug1: session_exit_message: release channel 0
debug1: session_by_tty: session 0 tty /dev/pts/7
debug1: session_pty_cleanup: session 0 release /dev/pts/7
debug1: session_by_channel: session 0 channel 0
debug1: session_close_by_channel: channel 0 child 0
debug1: session_close: session 0 pid 0
debug1: channel 0: free: server-session, nchannels 1
Connection closed by 127.0.0.1
debug1: do_cleanup
Transferred: sent 3016, received 2528 bytes
Closing connection to 127.0.0.1 port 39216
debug1: PAM: cleanup
debug1: PAM: deleting credentials
debug1: PAM: closing session


[Index of Archives]     [Open SSH Unix Development]     [Fedora Users]     [Fedora Desktop]     [Yosemite Backpacking]     [KDE Users]     [Gnome Users]

  Powered by Linux