<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=4&amp;t=1004" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2013-03-18T05:40:46+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=4&amp;t=1004</id>
<entry>
<author><name><![CDATA[coventry]]></name></author>
<updated>2013-03-18T05:40:46+01:00</updated>
<published>2013-03-18T05:40:46+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1004&amp;p=3765#p3765</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1004&amp;p=3765#p3765"/>
<title type="html"><![CDATA[Re: Proper inux udev rule for response when yubikey is inser]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1004&amp;p=3765#p3765"><![CDATA[
&quot;sleep 20&quot; and &quot;pkill xscreensaver&quot; was proving unreliable, in that I still wasn't getting OTPs from a keypress, and the LED would occasionally start flashing again.  So I've worked around it for now by replacing the &quot;add&quot; rule with something which tracks the state of the screensaver.<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">#!/bin/bash<br /><br />function yubiwait() {<br />    while &#91; &quot;`~/bin/chalresp.py 2&gt; /dev/null`&quot; != &quot;OK&quot; &#93; ; do sleep 0.05 ; done<br />    killall xscreensaver<br />}<br /><br />( while &#91; /bin/true &#93; ; do xscreensaver-command -watch ; done ) \<br />    | while read a ; do<br />        echo $a | grep &quot;^LOCK&quot; &amp;&amp; yubiwait<br />      done<br /></div><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2348">coventry</a> — Mon Mar 18, 2013 5:40 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[coventry]]></name></author>
<updated>2013-03-16T22:04:13+01:00</updated>
<published>2013-03-16T22:04:13+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1004&amp;p=3763#p3763</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1004&amp;p=3763#p3763"/>
<title type="html"><![CDATA[Proper inux udev rule for response when yubikey is inserted?]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1004&amp;p=3763#p3763"><![CDATA[
I have the following rules in /etc/udev/rules.d/90-yubikey.rules:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">ACTION==&quot;remove&quot;, ENV{ID_VENDOR}==&quot;Yubico&quot;, RUN+=&quot;/usr/local/bin/ykgone&quot;<br />ACTION==&quot;add&quot;,      ENV{ID_VENDOR}==&quot;Yubico&quot;, RUN+=&quot;/usr/local/bin/ykhere&quot;<br /></div><br />The &quot;remove&quot; rule works great, but the &quot;add&quot; rule is causing problems.  With the &quot;add&quot; rule in place, inserting the yubikey causes /usr/local/bin/ykhere to be executed many times a second, the LED on the yubikey to flash at about the same rate, and the yubikey to stop responding to button presses with an OTP token key sequence (but the OTP loss may be because /usr/local/bin/ykhere is generating so many HMAC-SHA1 challenges.)<br /><br />How can I modify the &quot;add&quot; line so that /usr/local/bin/ykhere is only run once when the key is inserted, and the OTP button works as usual the rest of the time<br /><br />This is on lubuntu 12.10, with packages yubikey-personalization 1.7.0-1, libyubikey0 1.8-1.  yubikey firmware version 2.3.3.<br /><br />The script /usr/local/bin/ykhere is<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">#!/bin/bash<br /><br />if &#91; -n &quot;$(lsusb | grep Yubikey)&quot; &#93; ; then<br />    /bin/su coventry -c /usr/local/bin/unlock<br />fi</div><br /><br />And /usr/local/bin/unlock is<br /><br />#!/bin/bash<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">if &#91; &quot;`~/bin/chalresp.py `&quot; == &quot;OK&quot; &#93;; then <br />    pkill xscreensaver<br />fi<br /></div><br /><br />And finally, this is chalresp.py:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">#!/usr/bin/python<br /><br />import subprocess, os, re<br /><br />recpath = os.path.expanduser('~/.ykchalresp')<br /><br />chal, resp = open(recpath).read().strip().split()<br /><br />def make_resp(chal):<br />    return subprocess.check_output(&#91;'ykchalresp', '-2', '-H', chal&#93;<br />                                   ).strip()<br /><br />tresp = make_resp(chal)<br /><br />if tresp == resp:<br />    # Challenge succeeded; make a new challenge for next time<br />    nresp = make_resp(tresp)<br />    print &gt;&gt; open(recpath, 'w'), tresp, nresp<br />    print 'OK'<br />    exit(0)<br />else:<br />    print 'Failed'<br />    exit(1)<br /></div>    <br /><br />I can &quot;fix&quot; the problem by putting a &quot;sleep 20&quot; after &quot;pkill xscreensaver&quot; in /usr/local/bin/unlock and a &quot;service udev restart&quot; after calling /usr/local/bin/unlock in /usr/local/bin/ykhere.  But that's kind of a horrendous abuse.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2348">coventry</a> — Sat Mar 16, 2013 10:04 pm</p><hr />
]]></content>
</entry>
</feed>