Hardware authentication for Linux using ordinary USB Flash Drives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
6.5 KiB

18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. ====== Installation ======
  2. Before going ahead, be sure to follow the upgrading instructions if you're using
  3. an older version of pam_usb.
  4. ===== Requirements =====
  5. * Requirements for pam_usb and pusb_check:
  6. * libpam
  7. * libhal-storage
  8. * libxml2
  9. * Requirements for pusb_hotplug and pusb_conf:
  10. * python2.4
  11. * python-celementtree
  12. * python-dbus
  13. * python-gobject
  14. ===== Installing from sources =====
  15. * Step 1: Download the latest release
  16. * Step 2: Unpack the distribution tarball
  17. $ tar -zxvf pam_usb-<version>.tar.gz
  18. $ cd pam_usb-<version>
  19. * Step 3: Compile and install
  20. $ make
  21. # make install
  22. ====== Configuring ======
  23. ===== Devices and Users =====
  24. * Copy the default configuration file to /etc/pusb/pusb.conf:
  25. cp /etc/pusb/pusb.conf-dist /etc/pusb/pusb.conf
  26. * Once you've connected your USB device to the computer, use pusb_conf to add it
  27. to the configuration file:
  28. # pusb_conf --add-device MyDevice
  29. Name : MyDevice
  30. Vendor : SanDisk Corp.
  31. Model : Cruzer Titanium
  32. Serial : SNDKXXXXXXXXXXXXXXXX
  33. Volume UUID : 6F6B-42FC (/dev/sda1)
  34. Save device to /etc/pusb/pusb.conf ?
  35. [y/n] y
  36. Done.
  37. Note that MyDevice can be any arbitrary name you'd like.
  38. If more devices are connected, pusb_conf will ask you which device you want to
  39. use.
  40. * Edit your /etc/pusb/pusb.conf config file to add the users:
  41. <users>
  42. <user id="root">
  43. <device>MyDevice</device>
  44. </user>
  45. <user id="scox">
  46. <device>MyDevice</device>
  47. </user>
  48. </users>
  49. * In order to test if everything went fine, we're gonna use the pusb_check tool
  50. which will simulate an authentication event.
  51. # pusb_check -a -u root -s su
  52. * Authentication request for user "root" (su)
  53. * Device "MyDevice" is connected (good).
  54. * Performing one time pad verification...
  55. * Verification match, updating one time pads...
  56. * Access granted.
  57. ===== PAM Module =====
  58. The PAM module pam_usb.so is used to let applications authenticate you using
  59. your USB device instead of asking your password. The default password-based
  60. authentication will be used as fallback if the device authentication goes wrong.
  61. You don't need to setup the hotplugging feature as pam_usb.so and pusb_hotplug
  62. are independent of each other.
  63. * Depending on the operating system you're using, you have to tell PAM to use
  64. pam_usb.so as default authentication method. There should be a file named
  65. either common-auth (Gentoo) under /etc/pam.d/. If you do NOT have neither of
  66. those files, you'll have to edit each pam.d service file you want to use (e.g.
  67. /etc/pam.d/su, /etc/pam.d/gdm and so on).
  68. * Locate the following line on /etc/pam.d/common-auth or /etc/pam.d/system-auth:
  69. auth required pam_unix.so nullok_secure
  70. * And change it to look something like that:
  71. auth sufficient pam_usb.so
  72. auth required pam_unix.so nullok_secure
  73. * You should now be able to authenticate the users configured in pusb.conf using
  74. your USB device:
  75. scox $ su
  76. * pam_usb v.SVN
  77. * Authentication request for user "root" (su)
  78. * Device "MyDevice" is connected (good).
  79. * Performing one time pad verification...
  80. * Verification match, updating one time pads...
  81. * Access granted.
  82. * Try to authenticate to a different application. pam_usb.so should work with
  83. any application using xscreensaver and many more).
  84. ===== Hotplug =====
  85. Hotplugging is a feature provided by pusb_hotplug that allows you to
  86. automatically execute commands upon locking and unlocking events. Those events
  87. are generated when you insert or remove your authentication device.
  88. For instance, you could automatically start your screensaver as soon as you
  89. remove the device, and deactivate it when you plug the device back.
  90. * GNOME (gnome-screensaver):
  91. <user id="scox">
  92. <device>MyDevice</device>
  93. <hotplug event="lock">gnome-screensaver-command --lock</hotplug>
  94. <hotplug event="unlock">gnome-screensaver-command --deactivate</hotplug>
  95. </user>
  96. * KDE (kscreensaver):
  97. <user id="scox">
  98. <device>MyDevice</device>
  99. <hotplug event="lock">dcop kdesktop KScreensaverIface lock</hotplug>
  100. <hotplug event="unlock">dcop kdesktop KScreensaverIface quit</hotplug>
  101. </user>
  102. You can also execute more commands by adding extra <hotplug> entries.
  103. $ pusb_hotplug
  104. pusb_hotplug[18329]: pusb_hotplug up and running.
  105. pusb_hotplug[18329]: Watching device "MyDevice" for user "scox"
  106. pusb_hotplug[18329]: Device "MyDevice" has been removed, locking down user
  107. "scox"...
  108. pusb_hotplug[18329]: Running "gnome-screensaver-command --lock"
  109. pusb_hotplug[18329]: Locked.
  110. pusb_hotplug[18329]: Device "MyDevice" has been inserted. Performing
  111. verification...
  112. pusb_hotplug[18329]: Executing "/usr/bin/pusb_check -q -c /etc/pusb/pusb.conf -u
  113. scox -s pusb_hotplug -a"
  114. pusb_hotplug[18329]: Authentication succeeded. Unlocking user "scox"...
  115. pusb_hotplug[18329]: Running "gnome-screensaver-command --deactivate"
  116. pusb_hotplug[18329]: Unlocked.
  117. Depending on your desktop environment, you have to add pusb_hotplug to the list
  118. of autostarted applications so it will be started automatically.
  119. * GNOME:
  120. - Open System -> Preferences -> Sessions
  121. - Select Startup Programs and press Add
  122. - Enter pusb_hotplug and press OK
  123. - Press Close
  124. * KDE:
  125. - cd ~/.kde/Autostart
  126. - ln -s /usr/bin/pusb_hotplug pusb_hotplug
  127. ====== Troubleshooting ======
  128. ===== Log Analysis =====
  129. Both pam_usb.so and pusb_hotplug use the syslog facility to log authentication
  130. attempts.
  131. This can be useful for GUI-driven applications (for instance GDM) where you
  132. don't get to see console output.
  133. Messages are logged with the AUTH facility, they are usually written to
  134. /var/log/auth.log but may vary
  135. depending on the operating system you're using.
  136. # tail -f /var/log/auth.log
  137. pusb_hotplug[25429]: Device "sandisk" has been inserted. Performing
  138. verification...
  139. pusb_hotplug[25429]: Executing "/usr/bin/pusb_check -q -c /etc/pusb/pusb.conf -u
  140. scox -s pusb_hotplug -a"
  141. pam_usb[25485]: Authentication request for user "scox" (pusb_hotplug)
  142. pam_usb[25485]: Device "sandisk" is connected (good).
  143. pam_usb[25485]: Access granted.
  144. pusb_hotplug[25429]: Authentication succeeded. Unlocking user "scox"...
  145. pusb_hotplug[25429]: Unlocked.
  146. ===== Enabling debug =====
  147. Enabling debug messages may help you find out what's wrong.
  148. To enable them, edit /etc/pusb/pusb.conf and set the following option:
  149. <defaults>
  150. <option name="debug">true</option>
  151. </defaults>
  152. If you wish, you could enable debug messages only for a specific user, device or
  153. service.
  154. For instance, if you want to enable debug messages only for the sudo service,
  155. you could do the following:
  156. <services>
  157. <service id="sudo">
  158. <option name="debug">true</option>
  159. </service>
  160. </services>
  161. ====== It works - What next ? ======
  162. * Have a look at the configuration documentation