xref: /netbsd-src/lib/libpam/modules/pam_ssh/pam_ssh.8 (revision 03dcb730d46d34d85c9f496c1f5a3a6a43f2b7b3)
1.\" $NetBSD: pam_ssh.8,v 1.8 2014/03/18 18:20:38 riastradh Exp $
2.\" Copyright (c) 2001 Mark R V Murray
3.\" All rights reserved.
4.\" Copyright (c) 2001-2003 Networks Associates Technology, Inc.
5.\" All rights reserved.
6.\"
7.\" This software was developed for the FreeBSD Project by ThinkSec AS and
8.\" NAI Labs, the Security Research Division of Network Associates, Inc.
9.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
10.\" DARPA CHATS research program.
11.\"
12.\" Redistribution and use in source and binary forms, with or without
13.\" modification, are permitted provided that the following conditions
14.\" are met:
15.\" 1. Redistributions of source code must retain the above copyright
16.\"    notice, this list of conditions and the following disclaimer.
17.\" 2. Redistributions in binary form must reproduce the above copyright
18.\"    notice, this list of conditions and the following disclaimer in the
19.\"    documentation and/or other materials provided with the distribution.
20.\" 3. The name of the author may not be used to endorse or promote
21.\"    products derived from this software without specific prior written
22.\"    permission.
23.\"
24.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
28.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE.
35.\"
36.\" $FreeBSD: src/lib/libpam/modules/pam_ssh/pam_ssh.8,v 1.13 2004/07/02 23:52:18 ru Exp $
37.\"
38.Dd December 16, 2011
39.Dt PAM_SSH 8
40.Os
41.Sh NAME
42.Nm pam_ssh
43.Nd authentication and session management with SSH private keys
44.Sh SYNOPSIS
45.Op Ar service-name
46.Ar module-type
47.Ar control-flag
48.Pa pam_ssh
49.Op Ar options
50.Sh DESCRIPTION
51The
52SSH
53authentication service module for PAM
54provides functionality for two PAM categories:
55authentication
56and session management.
57In terms of the
58.Ar module-type
59parameter, they are the
60.Dq Li auth
61and
62.Dq Li session
63features.
64.Ss SSH Authentication Module
65The
66SSH
67authentication component
68provides a function to verify the identity of a user
69.Pq Fn pam_sm_authenticate ,
70by prompting the user for a passphrase and verifying that it can
71decrypt the target user's SSH key using that passphrase.
72.Pp
73The following options may be passed to the authentication module:
74.Bl -tag -width ".Cm use_first_pass"
75.It Cm use_first_pass
76If the authentication module
77is not the first in the stack,
78and a previous module
79obtained the user's password,
80that password is used
81to authenticate the user.
82If this fails,
83the authentication module returns failure
84without prompting the user for a password.
85This option has no effect
86if the authentication module
87is the first in the stack,
88or if no previous modules
89obtained the user's password.
90.It Cm try_first_pass
91This option is similar to the
92.Cm use_first_pass
93option,
94except that if the previously obtained password fails,
95the user is prompted for another password.
96.It Cm nullok
97Normally, keys with no passphrase are ignored for authentication purposes.
98If this option is set, keys with no passphrase will be taken into
99consideration, allowing the user to log in with a blank password.
100.El
101.Ss SSH Session Management Module
102The
103SSH
104session management component
105provides functions to initiate
106.Pq Fn pam_sm_open_session
107and terminate
108.Pq Fn pam_sm_close_session
109sessions.
110The
111.Fn pam_sm_open_session
112function starts an SSH agent,
113passing it any private keys it decrypted
114during the authentication phase,
115and sets the environment variables
116the agent specifies.
117The
118.Fn pam_sm_close_session
119function kills the previously started SSH agent
120by sending it a
121.Dv SIGTERM .
122.Pp
123The following options may be passed to the session management module:
124.Bl -tag -width ".Cm want_agent"
125.It Cm want_agent
126Start an agent even if no keys were decrypted during the
127authentication phase.
128.El
129.Sh FILES
130.Bl -tag -width ".Pa $HOME/.ssh/identity" -compact
131.It Pa $HOME/.ssh/identity
132SSH1 RSA key
133.It Pa $HOME/.ssh/id_rsa
134SSH2 RSA key
135.It Pa $HOME/.ssh/id_dsa
136SSH2 DSA key
137.It Pa $HOME/.ssh/id_ecdsa
138SSH2 ECDSA key
139.El
140.Sh SEE ALSO
141.Xr ssh-agent 1 ,
142.Xr pam.conf 5 ,
143.Xr pam 8
144.Sh AUTHORS
145The
146.Nm
147module was originally written by
148.An -nosplit
149.An "Andrew J. Korty" Aq Mt ajk@iu.edu .
150The current implementation was developed for the
151.Fx
152Project by
153ThinkSec AS and NAI Labs, the Security Research Division of Network
154Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
155.Pq Dq CBOSS ,
156as part of the DARPA CHATS research program.
157This manual page was written by
158.An "Mark R V Murray" Aq Mt markm@FreeBSD.org .
159.Sh SECURITY CONSIDERATIONS
160The
161.Nm
162module implements what is fundamentally a password authentication scheme.
163Care should be taken to only use this module over a secure session
164.Po
165secure TTY, encrypted session, etc.
166.Pc ,
167otherwise the user's SSH passphrase could be compromised.
168.Pp
169Additional consideration should be given to the use of
170.Nm pam_ssh .
171Users often assume that file permissions are sufficient to protect their
172SSH keys, and thus use weak or no passphrases.
173Since the system administrator has no effective means of enforcing
174SSH passphrase quality, this has the potential to expose the system to
175security risks.
176