• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

build-aux/H20-Apr-2018-15,83412,297

doc/H20-Apr-2018-1,6971,255

m4/H20-Apr-2018-9,9689,069

tests/H20-Apr-2018-2,0121,599

AUTHORSH A D01-Apr-2016867 4530

COPYINGH A D30-Apr-20141.3 KiB2722

ChangeLogH A D20-Apr-201885.4 KiB2,9641,683

Makefile.amH A D30-Aug-20174.8 KiB14787

Makefile.inH A D10-Apr-201843.5 KiB1,2741,117

NEWSH A D20-Apr-20189.8 KiB347205

READMEH A D18-Apr-201811.8 KiB372263

aclocal.m4H A D10-Apr-201853.4 KiB1,4991,360

configureH A D10-Apr-2018483.3 KiB16,42513,815

configure.acH A D09-Apr-20186.4 KiB176152

drop_privs.cH A D30-Aug-20174 KiB12573

drop_privs.hH A D30-Aug-20172.2 KiB6528

pam_yubico.8H A D10-Apr-20187.5 KiB250225

pam_yubico.cH A D13-Apr-201835.8 KiB1,3141,050

util.cH A D13-Apr-201814.4 KiB581415

util.hH A D30-Aug-20173.9 KiB10248

ykpamcfg.1H A D30-Aug-20174.1 KiB143118

ykpamcfg.cH A D13-Apr-20188.2 KiB333244

README

1== Yubico PAM module
2
3The Yubico PAM module provides an easy way to integrate the Yubikey
4into your existing user authentication infrastructure.  PAM is used by
5GNU/Linux, Solaris and Mac OS X for user authentication, and by other
6specialized applications such as NCSA MyProxy.
7
8Status and Roadmap
9------------------
10
11The module is working for multi-user systems. The primary mode of
12operation is by doing online validation using a YubiKey validation
13service (such as the YubiCloud, or a private one configured using
14the 'urllist' parameter).
15
16In version 2.6, offline validation was also made possible through
17the use of HMAC-SHA1 Challenge-Response found in YubiKey 2.2 and
18later. This has introduced a dependency of libykpers-1 from the
19ykpersonalize package. Pass `--without-cr` to `configure` to avoid
20this dependency.
21
22The development community is co-ordinated via
23https://github.com/Yubico/yubico-pam[the GitHub project page].
24
25The project is licensed under a BSD license.  See the file COPYING for
26exact wording.  For any copyright year range specified as YYYY-ZZZZ in
27this package note that the range specifies every single year in that
28closed interval.
29
30
31Building from Git
32-----------------
33
34Skip to the next section if you are using an official packaged
35version.
36
37You may check out the sources using Git with the following command:
38
39------
40$ git clone https://github.com/Yubico/yubico-pam.git
41------
42
43This will create the directory `yubico-pam`.
44
45Autoconf, automake, asciidoc and libtool must be installed to create a
46compilable source tree.
47
48Generate the build system using:
49
50------
51$ cd yubico-pam
52$ autoreconf --install
53------
54
55
56=== Building
57
58You will need to have https://developers.yubico.com/yubico-c-client[libykclient]
59(ykclient.h, libykclient.so) and libpam-dev (security/pam_appl.h, libpam.so)
60installed. It in turn requires cURL, which you need to have installed, and
61https://developers.yubico.com/yubico-c[libyubikey].
62
63The Challenge-Response offline authentication requires libykpers-1
64from the
65https://developers.yubico.com/yubikey-personalization[yubikey-personalization]
66project:
67
68The selftests require perl with the module Net::LDAP::Server installed.
69
70The build system uses Autoconf, to set up the build system run:
71
72 ./configure
73
74Use --without-ldap to disable ldap support.
75
76Then build the code, run the self-test and install the binaries:
77
78 make check install
79
80
81== Installation
82
83=== Fedora/EPEL
84
85There is already a package in Fedora/EPEL of yubico-pam that can be installed
86by using yum:
87
88 $ sudo yum install pam_yubico
89
90
91=== Ubuntu PPA
92
93There is an Ubuntu PPA (Personal Package Archive) for yubico-pam that
94can be installed using the following commands on reasonably modern
95Ubuntu platforms :
96
97  $ sudo add-apt-repository ppa:yubico/stable
98  $ sudo apt-get update
99  $ sudo apt-get install libpam-yubico
100
101See the file `/usr/share/doc/libpam-yubico/README.Debian` after installing.
102
103
104=== FreeBSD ports
105
106yubico-pam and the supporting Yubico packages have corresponding FreeBSD ports. To install:
107
108  $ cd /usr/ports/security/pam_yubico
109  $ make install clean
110
111Advanced configuration notes are available http://mjslabs.com/yubihow.html[here].
112
113
114Configuration
115-------------
116
117Install it in your PAM setup by adding a line to an appropriate file
118in `/etc/pam.d/`:
119
120----
121auth sufficient pam_yubico.so id=[Your API Client ID] debug
122----
123
124and move pam_yubico.so into /lib/security/ (or wherever PAM modules
125live in your system) :
126
127----
128mv /usr/local/lib/security/pam_yubico.so /lib/security/
129----
130
131For more information, see the project documentation.
132
133Supported PAM module parameters are:
134
135[horizontal]
136authfile::
137To indicate the location of the file that holds the
138mappings of Yubikey token IDs to user names.
139
140id::
141Your API Client ID in the Yubico validation server.
142If you want to use the default YubiCloud service,
143go https://upgrade.yubico.com/getapikey[here].
144
145key::
146To indicate your client key in base64 format.
147The client key is also known as API key, and provides
148integrity in the communication between the client (you)
149and the validation server.
150If you want to get one for use with the default YubiCloud
151service, go https://upgrade.yubico.com/getapikey[here].
152
153debug:: to enable debug output.
154
155debug_file:: filename to write debug to, file must exist and
156be a regular file. stdout is default.
157
158alwaysok::
159to enable all authentication attempts to succeed
160(aka presentation mode).
161
162try_first_pass::
163Before prompting the user for their password, the module
164first tries the previous stacked module´s password in case
165that satisfies this module as well.
166
167use_first_pass::
168The argument use_first_pass forces the module to use a previous
169stacked modules password and will never prompt the user - if no
170password is available or the password is not appropriate, the user
171will be denied access.
172
173nullok::
174If set, don't fail when there are no tokens declared for the user
175in the authorization mapping files or in LDAP.
176This can be used to make YubiKey authentication optional unless
177the user has associated tokens.
178
179urllist::
180List  of  URL  templates to be used. This is set by calling
181ykclient_set_url_bases. The list should be in the format :
182`https://server/wsapi/2.0/verify;https://server/wsapi/2.0/verify`
183
184url::
185This option should not be used, please use the urllist
186option instead.
187Specify the URL template to use, this is set by calling
188yubikey_client_set_url_template, which defaults to:
189`https://api.yubico.com/wsapi/verify?id=%d&otp=%s`
190or
191`https://api.yubico.com/wsapi/2.0/verify?id=%d&otp=%s`
192depending on your version of yubico-c-client.
193
194capath::
195specify the path where X509 certificates are stored. This is
196required if 'https' or 'ldaps' are used in 'url' and 'ldap_uri'
197respectively.
198
199proxy::
200specify a proxy to connect to the validation server. Valid schemes are
201http://, https://, socks4://, socks4a://, socks5:// or socks5h://.
202Socks5h asks the proxy to do the dns resolving. If no scheme or port is
203specified HTTP proxy port 1080 will be used.
204
205verbose_otp::
206   This argument is used to show the OTP (One-Time Password) when it
207   is entered, i.e. to enable terminal echo of entered characters.
208   You are advised to not use this, if you are using two factor
209   authentication because that will display your password on the
210   screen.
211   This requires the service using the PAM module to
212   display custom fields.  This option can not be used with OpenSSH.
213
214ldap_uri:: specify the LDAP server URI (e.g. ldap://localhost).
215
216
217ldapserver::
218specify the LDAP server host (default LDAP port is used).
219_Deprecated.  Use "ldap_uri" instead._
220
221ldapdn::
222specify the dn where the users are stored
223(eg: ou=users,dc=domain,dc=com).
224
225user_attr:: specify the LDAP attribute used to store user names (eg:cn).
226
227yubi_attr::  specify the LDAP attribute used to store the Yubikey ID.
228
229yubi_attr_prefix::
230specify the prefix of the LDAP attribute's value, in case
231of a generic attribute, used to store several types of IDs.
232
233token_id_length::
234Length of ID prefixing the OTP (this is 12 if using the
235YubiCloud).
236
237mode::
238Mode of operation. Use "client" for online validation with
239a YubiKey validation service such as the YubiCloud, or use
240"challenge-response" for offline validation using YubiKeys
241with HMAC-SHA-1 Challenge-Response configurations. See the
242man-page ykpamcfg(1) for further details on how to configure
243offline Challenge-Response validation.
244
245If you are using "debug" you may find it useful to create a
246world-writable log file:
247
248[source, sh]
249----
250touch /var/run/pam-debug.log
251chmod go+w /var/run/pam-debug.log
252----
253
254
255Authorization Mapping Files
256---------------------------
257A mapping must be made between the YubiKey token ID and the user ID it is
258attached to. There are two ways to do this, either centrally in one file, or
259individually, where users can create the mapping in their home directories.
260If the central authorization mapping file is being used, user home directory
261mappings will not be used and the opposite applies if user home directory
262mappings are being used, the central authorization mappings file will not
263be used.
264
265
266=== Central authorization mapping
267Create a `/etc/yubikey_mappings`, the file must contain a user name and the
268Yubikey token ID separated by colons (same format as the passwd file) for
269each user you want to allow onto the system using a Yubikey.
270
271The mappings should look like this, one per line:
272
273 <first user name>:<Yubikey token ID1>:<Yubikey token ID2>:….
274 <second user name>:<Yubikey token ID3>:<Yubikey token ID4>:….
275
276Now add `authfile=/etc/yubikey_mappings` to your PAM configuration line, so it
277looks like:
278
279 auth sufficient pam_yubico.so id=[Your API Client ID] authfile=/etc/yubikey_mappings
280
281
282=== Individual authorization mapping by user
283Each user creates a `~/.yubico/authorized_yubikeys` file inside of their home
284directory and places the mapping in that file, the file must have only one
285line:
286
287
288 <user name>:<Yubikey token ID1>:<Yubikey token ID2>
289
290
291This is much the same concept as the SSH authorized_keys file.
292
293
294Obtaining the Yubikey token ID (a.k.a. public ID)
295-------------------------------------------------
296
297You can obtain the Yubikey token ID in several ways.  One is by
298removing the last 32 characters of any OTP (One Time Password)
299generated with your Yubikey.  Another is by using the
300http://demo.yubico.com/php-yubico/Modhex_Calculator.php[modhex calculator].
301
302Enter your Yubikey OTP and convert it, your Yubikey token ID is 12
303characters and listed as:
304
305   Modhex encoded: XXXXXXX
306
307Not sure what that last bit meant? Here is how to get a copy of your OTP.
308
309=== Fast way
310. Open a terminal
311. Press the YubiKey's button
312  It will output an OTP into the shell:
313+
314[source, sh]
315------
316$ cccccccgklgcvnkcvnnegrnhgrjkhlkfhdkclfncvlgj
317bash: cccccccgklgcvnkcvnnegrnhgrjkhlkfhdkclfncvlgj: command not found
318------
319+
320This can be pasted into the Modhex_Calculator page.
321
322=== Harder way
323This requires you to have the pam module enabled with 'debug' turned on. When
324prompted for the YubiKey press the button. The pam module will print out debug
325information including the OTP and ID of your token to the shell -- copy the ID
326into your config file and you should be up and going.
327
328------
329Yubikey for `youruser':
330[pam_yubico.c:pam_sm_authenticate(867)] conv returned 44 bytes
331[pam_yubico.c:pam_sm_authenticate(885)] Skipping first 0 bytes. Length is 44, token_id set to 12 and token OTP always 32.
332[pam_yubico.c:pam_sm_authenticate(892)] OTP: ccccccclabcabkhbdncicglfltnukadfoifadfhhhhfe ID: cccccclabcab
333------
334
335
336Yubico PAM module and SELinux.
337------------------------------
338Users with SELinux in enforcing mode (the default on Fedora 17+) may experience
339login problems with services including those validated via
340polkit-agent-helper-1, sshd and login.
341
342This is https://bugzilla.redhat.com/show_bug.cgi?id=841693#c3[documented in Red Hat bugzilla]
343including a work around for ssh (Equivalent files could be created for
344other services). Systems in 'permissive' mode will generate AVC warnings but
345authentication will succeed.
346
347To determine if you have SELinux enforcing or not run the `sestatus` command.
348
349Examples
350--------
351
352If you want to use the YubiKey to authenticate you on Linux console
353logins, add the following to the top of `/etc/pam.d/login`:
354
355   auth sufficient pam_yubico.so id=[Your API Client ID] debug
356
357OpenVPN and ActiveDirectory
358---------------------------
359See Michael Ludvig's sample Active Directory schema extensions for YubiKey public ID attribute storage / association with a particular user account:  https://github.com/mludvig/yubikey-ldap/tree/master/microsoft-schema
360
361create file '/etc/pam.d/openvpn':
362
363   auth  required  pam_yubico.so ldap_uri=ldap://contoso.com debug id=[Your API ID] yubi_attr=yubiKeyId
364      ldapdn=DC=contoso,DC=com
365      ldap_filter=(&(sAMAccountName=%u)(objectClass=user)(memberOf=CN=somegroup,DC=contoso,DC=com))
366      [ldap_bind_user=CN=binduser,OU=Service Accounts,DC=contoso,DC=com] ldap_bind_password=bind_password try_first_pass
367   account required  pam_yubico.so
368
369create file 'openvpn.conf'
370
371   plugin openvpn-plugin-auth-pam.so openvpn
372