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.

159 lines
5.0 KiB

  1. ====== Installation ======
  2. Before going ahead, be sure to follow the upgrading instructions if you're using
  3. an older version of pamusb.
  4. ===== Requirements =====
  5. * Requirements for pam_usb and pusb_check:
  6. * libhal-storage
  7. * libxml2
  8. * Requirements for pusb_hotplug and pusb_adm:
  9. * python2.4
  10. * python-celementtree
  11. * python-dbus
  12. * python-gobject
  13. ===== Installing from sources =====
  14. * Step 1: Download the latest release
  15. * Step 2: Unpack the distribution tarball
  16. $ tar -zxvf pam_usb-<version>.tar.gz
  17. $ cd pam_usb-<version>
  18. * Step 3: Compile and install
  19. $ make
  20. # make install
  21. ====== Configuring ======
  22. ===== Devices and Users =====
  23. * Copy the default configuration file to /etc/pusb/pusb.conf:
  24. cp /etc/pusb/pusb.conf-dist /etc/pusb/pusb.conf
  25. * Once you've connected your USB device to the computer, use pusb_adm to add it
  26. to the configuration file:
  27. # pusb_adm --add-device MyDevice
  28. Name : MyDevice
  29. Vendor : SanDisk Corp.
  30. Model : Cruzer Titanium
  31. Serial : SNDKXXXXXXXXXXXXXXXX
  32. Volume UUID : 6F6B-42FC (/dev/sda1)
  33. Save device to /etc/pusb/pusb.conf ?
  34. [y/n] y
  35. Done.
  36. Note that MyDevice can be any arbitrary name you'd like.
  37. If more devices are connected, pusb_adm will ask you which device you want to
  38. use.
  39. * Edit your /etc/pusb/pusb.conf config file to add the users:
  40. <users>
  41. <user id="root">
  42. <device>MyDevice</device>
  43. </user>
  44. <user id="scox">
  45. <device>MyDevice</device>
  46. </user>
  47. </users>
  48. * In order to test if everything went fine, we're gonna use the pusb_check tool
  49. which will simulate an authentication event.
  50. # pusb_check -a -u root -s su
  51. * Authentication request for user "root" (su)
  52. * Device "MyDevice" is connected (good).
  53. * Performing one time pad verification...
  54. * Verification match, updating one time pads...
  55. * Access granted.
  56. ===== PAM Module =====
  57. The PAM module pam_usb.so is used to let applications authenticate you using
  58. your USB device instead of asking your password. The default password-based
  59. authentication will be used as fallback if the device authentication goes wrong.
  60. You don't need to setup the hotplugging feature as pam_usb.so and pusb_hotplug
  61. are independent of each other.
  62. * Depending on the operating system you're using, you have to tell PAM to use
  63. pam_usb.so as default authentication method. There should be a file named
  64. either common-auth (Gentoo) under /etc/pam.d/. If you do NOT have neither of
  65. those files, you'll have to edit each pam.d service file you want to use (e.g.
  66. /etc/pam.d/su, /etc/pam.d/gdm and so on).
  67. * Locate the following line on /etc/pam.d/common-auth or /etc/pam.d/system-auth:
  68. auth required pam_unix.so nullok_secure
  69. * And change it to look something like that:
  70. auth sufficient pam_usb.so
  71. auth required pam_unix.so nullok_secure
  72. * You should now be able to authenticate the users configured in pusb.conf using
  73. your USB device:
  74. scox $ su
  75. * pam_usb v.SVN
  76. * Authentication request for user "root" (su)
  77. * Device "MyDevice" is connected (good).
  78. * Performing one time pad verification...
  79. * Verification match, updating one time pads...
  80. * Access granted.
  81. * Try to authenticate to a different application. pam_usb.so should work with
  82. any application using xscreensaver and many more).
  83. ===== Hotplug =====
  84. Hotplugging is a feature provided by pusb_hotplug that allows you to
  85. automatically execute commands upon locking and unlocking events. Those events
  86. are generated when you insert or remove your authentication device.
  87. For instance, you could automatically start your screensaver as soon as you
  88. remove the device, and deactivate it when you plug the device back:
  89. <user id="scox">
  90. <device>MyDevice</device>
  91. <hotplug event="lock">gnome-screensaver-command --lock</hotplug>
  92. <hotplug event="unlock">gnome-screensaver-command --deactivate</hotplug>
  93. </user>
  94. Replace gnome-screensaver-command --lock and gnome-screensaver-command --unlock
  95. with any command you want to execute. You can also execute more commands by
  96. adding extra <hotplug> entries.
  97. $ pusb_hotplug
  98. pusb_hotplug[18329]: pusb_hotplug up and running.
  99. pusb_hotplug[18329]: Watching device "MyDevice" for user "scox"
  100. pusb_hotplug[18329]: Device "MyDevice" has been removed, locking down user
  101. "scox"...
  102. pusb_hotplug[18329]: Running "gnome-screensaver-command --lock"
  103. pusb_hotplug[18329]: Locked.
  104. pusb_hotplug[18329]: Device "MyDevice" has been inserted. Performing
  105. verification...
  106. pusb_hotplug[18329]: Executing "/usr/bin/pusb_check -q -c /etc/pusb/pusb.conf -u
  107. scox -s pusb_hotplug -a"
  108. pusb_hotplug[18329]: Authentication succeeded. Unlocking user "scox"...
  109. pusb_hotplug[18329]: Running "gnome-screensaver-command --deactivate"
  110. pusb_hotplug[18329]: Unlocked.
  111. Depending on your desktop environment, you have to add pusb_hotplug to the list
  112. of autostarted applications so it will be started automatically.
  113. For instance, with GNOME:
  114. - Open System -> Preferences -> Sessions
  115. - Select Startup Programs and press Add
  116. - Enter pusb_hotplug and press OK
  117. - Press Close
  118. ====== It works - What next ? ======
  119. * Have a look at the configuration documentation