{"id":840,"date":"2008-09-10T14:58:54","date_gmt":"2008-09-10T12:58:54","guid":{"rendered":"http:\/\/my.stargazer.at\/?p=840"},"modified":"2008-09-10T14:58:54","modified_gmt":"2008-09-10T12:58:54","slug":"login-with-the-usb-stick","status":"publish","type":"post","link":"https:\/\/my.stargazer.at\/de\/2008\/09\/10\/login-with-the-usb-stick\/","title":{"rendered":"Login per USB Stick"},"content":{"rendered":"<p>Dass ich tippfaul bin, sollte ich an dieser Stelle vielleicht nicht all zusehr betonen, jedoch um bei der Wahrheit zu bleiben, es war der ausschlaggebende Faktor um nach einer angenehmen Methode zu suchen. Authentifizieren per Fingerabdruck ist zwar eine M\u00f6glichkeit, jedoch bietet sie immer wieder ihre Macken, wenn es darum geht, das &#8218;Passwort&#8216; einmal weiterzugeben. Au\u00dferdem ist die Sicherheit fragw\u00fcrdig.<\/p>\n<p><!--more-->Netterweise habe ich ja das Problem nicht als einziger Benutzer, und so kommt es, dass es das Paket sys-auth\/pam_usb gibt &#8211; Authentifizieren via USB Ger\u00e4t. Damit es klappt, empfiehlt es sich eine Version gr\u00f6\u00dfer 0.4.1, welche wir unter Gentoo zuerst unmaskieren m\u00fcssen:<\/p>\n<blockquote><p># echo &#8222;sys-auth\/pam_usb&#8220; >> \/etc\/portage\/package.keywords<br \/>\n# emerge -av &#8222;>=sys-auth\/pam_usb-0.4.1&#8220;<\/p><\/blockquote>\n<p>Ist der Bau abgeschlossen, geht es an den Lieblingsteil, die Konfiguration, f\u00fcr welche ich mir einen SanDisk Corp. Cruzer Titanium ausgesucht habe. Mit den beigelegten Werkzeugen konfigurieren wir einmal den USB Stick:<\/p>\n<blockquote><p># pamusb-conf &#8211;add-device MySecretDevice<br \/>\nPlease select the device you wish to add.<br \/>\n* Using &#8222;SanDisk Corp. Cruzer Titanium (SNDKXXXXXXXXXXXXXXXX)&#8220; (only option)<br \/>\nWhich volume would you like to use for storing data ?<br \/>\n* Using &#8222;\/dev\/sdb1 (UUID: <6F6B-42FC>)&#8220; (only option)<br \/>\nName            : MySecretDevice<br \/>\nVendor          : SanDisk Corp.<br \/>\nModel           : Cruzer Titanium<br \/>\nSerial          : SNDKXXXXXXXXXXXXXXXX<br \/>\nVolume UUID     : 6F6B-42FC (\/dev\/sdb1)<br \/>\nSave to \/etc\/pamusb.conf ?<br \/>\n[Y\/n] y<br \/>\nDone.<\/p><\/blockquote>\n<p>Wenn das genauso wie bei mir geklappt hat, dann wird es Zeit die entsprechenden Benutzer zu konfigurieren. Weil ich es einfach praktisch finde, nehme ich hier &#8218;root&#8216; als unser Opfer:If things work the same way they do on my howto, the USB stick is now set up for authentication in general. Now let&#8217;s add users. I&#8217;d say using root is pretty cool &#8211; so let&#8217;s try. <\/p>\n<blockquote><p># pamusb-conf &#8211;add-user root<br \/>\nWhich device would you like to use for authentication ?<br \/>\n* Using &#8222;MyDevice&#8220; (only option)<br \/>\nUser            : root<br \/>\nDevice          : MySecretDevice<br \/>\nSave to \/etc\/pamusb.conf ?<br \/>\n[Y\/n] y<br \/>\nDone.<\/p><\/blockquote>\n<p>Nun sollte der Benutzer &#8218;root&#8216; theoretisch mit dem Ger\u00e4t authentifiziert werden k\u00f6nnen. Ob dem wirklich so ist, zeigt uns folgender Test:<\/p>\n<blockquote><p># pamusb-check root<br \/>\n* Authentication request for user &#8222;root&#8220; (pamusb-check)<br \/>\n* Device &#8222;MySecretDevice&#8220; is connected (good).<br \/>\n* Performing one time pad verification&#8230;<br \/>\n* Verification match, updating one time pads&#8230;<br \/>\n* Access granted.<\/p><\/blockquote>\n<p>Da das geschafft ist, ist es Zeit, unser System zu versauen. Um also in der generellen System-Authentifikation herumschrauben zu k\u00f6nnen, passe ich die Datei \/etc\/pam.d\/system-auth an:Well &#8211; the basic stuff is done. Now let&#8217;s start with the difficult part: we&#8217;re dangling on PAM. As I want to make the changes system wide, I&#8217;m working with the file \/etc\/pam.d\/system-auth where I am looking for the line saying<\/p>\n<blockquote><p>auth    required        pam_unix.so nullok_secure<\/p><\/blockquote>\n<p>wird somit zu:<\/p>\n<blockquote><p>auth    sufficient      pam_usb.so<br \/>\nauth    required        pam_unix.so nullok_secure<\/p><\/blockquote>\n<p>Es folgt der Praxistest:<\/p>\n<p>pavilion $ su<br \/>\n* pam_usb v.0.4.3<br \/>\n* Authentication request for user &#8222;root&#8220; (su)<br \/>\n* Device &#8222;MySecretDevice&#8220; is connected (good).<br \/>\n* Performing one time pad verification&#8230;<br \/>\n* Verification match, updating one time pads&#8230;<br \/>\n* Access granted.<\/p>\n<p>Klappt doch wunderbar. Durch anpassen der entsprechenden PAM-Module kann man sogar mit kdm, gdm oder gar den Bildschirmschonern herumbasteln. Wobei &#8211; da f\u00e4llt mir ein, dass es doch auch cool w\u00e4re, wenn der USB Stick gleich den Bildschirmschoner ausl\u00f6st, wenn man ihn abzieht.<\/p>\n<p>Doch selbst dazu gibt es eine L\u00f6sung. Der pamusb-agent. Ein Eintrag in der Config dazu k\u00f6nnte etwa so aussehen, wenn man wie ich KDE benutzt:<\/p>\n<blockquote>\n<pre><user id=\"stargazer\">\r\n    <device>MySecretDevice<\/device>\r\n    <agent event=\"lock\">dcop kdesktop KScreensaverIface lock<\/agent>\r\n    <agent event=\"unlock\">dcop kdesktop KScreensaverIface quit<\/agent>\r\n  <\/user><\/pre>\n<\/blockquote>\n<p>Nun muss nur noch der Agent beim Starten des KDE geladen werden und die Sache sollte rund laufen.<\/p>\n<blockquote><p>\ncd ~\/.kde\/Autostart<br \/>\nln -s \/usr\/bin\/pamusb-agent pamusb-agent<\/p><\/blockquote>\n<p>Das war&#8217;s dann auch schon &#8211; Viel Spass beim Nachbau<\/p>","protected":false},"excerpt":{"rendered":"<p>Dass ich tippfaul bin, sollte ich an dieser Stelle vielleicht nicht all zusehr betonen, jedoch um bei der Wahrheit zu bleiben, es war der ausschlaggebende Faktor um nach einer angenehmen Methode zu suchen. Authentifizieren per Fingerabdruck ist zwar eine M\u00f6glichkeit, jedoch bietet sie immer wieder ihre Macken, wenn es darum geht, das &#8218;Passwort&#8216; einmal weiterzugeben. Au\u00dferdem ist die [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[39,24,170],"class_list":["post-840","post","type-post","status-publish","format-standard","hentry","category-it-related-stuff","tag-gentoo","tag-kde","tag-security"],"_links":{"self":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/posts\/840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/comments?post=840"}],"version-history":[{"count":0,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/posts\/840\/revisions"}],"wp:attachment":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/media?parent=840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/categories?post=840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/tags?post=840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}