]> err.no Git - yubikey-personalization/commitdiff
Fix support for setting ACL through udev
authorMaxim Burgerhout <maxim@wzzrd.com>
Fri, 12 Oct 2012 12:25:23 +0000 (14:25 +0200)
committerMaxim Burgerhout <maxim@wzzrd.com>
Fri, 12 Oct 2012 12:28:40 +0000 (14:28 +0200)
Needs recent udev (>= 188) that has ID_SECURITY_TOKEN in 70-uaccess.rules /
70-udev-acl.rules.

No longer uses the deprecated udev-acl tool for setting ACL's on the
/dev/input/event* files created by the Yubikey.

69-yubikey.rules [new file with mode: 0644]
Makefile.am
configure.ac

diff --git a/69-yubikey.rules b/69-yubikey.rules
new file mode 100644 (file)
index 0000000..c13cd88
--- /dev/null
@@ -0,0 +1,10 @@
+ACTION!="add|change", GOTO="yubico_end"
+
+# Udev rules for letting the console user access the Yubikey USB
+# device node, needed for challenge/response to work correctly.
+
+# Yubico Yubikey II
+ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0010", \
+    ENV{ID_SECURITY_TOKEN}="1"
+
+LABEL="yubico_end"
index c43c0407517821069b223382645f6733b73f1d8e..a6e9ece1fa40d2a414e1d84c2d1a78382f57445c 100644 (file)
@@ -83,7 +83,7 @@ EXTRA_DIST += ykpers4win.mk
 
 udevrulesdir=@udevrulesdir@
 dist_udevrules_DATA = \
-        70-yubikey.rules
+        @udevrulesfile@
 
 # Release
 
index aa87a233f1ebde51cdbdfbe955930e33e78eaf1b..192b4ea440bf5f121da1095cbb8e54fd2282dce0 100644 (file)
@@ -126,10 +126,23 @@ AM_CONDITIONAL([BACKEND_OSX], test x$with_backend = xosx)
 AM_CONDITIONAL([BACKEND_WINDOWS], test x$with_backend = xwindows)
 
 AC_ARG_WITH([udevrulesdir],
-  AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules]),
+  AS_HELP_STRING([--with-udevrulesdir=DIR], [Install udev rules into this directory]),
   [], [])
 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
 
+# It would be more clear to wrap this in AC_MSG_CHECKING and AC_MSG_RESULT, but
+# this works too. If udevrulesdir is set, check for udev >= 188, which should
+# have the ID_SECURITY_TOKEN tag in 70-uaccess.rules / 70-udev-acl-rules. If
+# a recent enough udev is not found, fall back to using the old
+# 70-yubikey.rules file.
+if test -n "$udevrulesdir"; then
+    PKG_CHECK_MODULES([UDEV], [udev >= 188],
+        udevrulesfile=69-yubikey.rules,
+        udevrulesfile=70-yubikey.rules,
+    )
+    AC_SUBST([udevrulesfile], [$udevrulesfile])
+fi
+
 gl_LD_VERSION_SCRIPT
 gl_VALGRIND_TESTS
 
@@ -178,5 +191,6 @@ AC_MSG_NOTICE([summary of build options:
   Compiler:         ${CC}
   Library types:    Shared=${enable_shared}, Static=${enable_static}
   USB backend:      ${with_backend}
-  udev rules:       ${with_udevrulesdir:-N/A}
+  udev rules dir:   ${with_udevrulesdir:-N/A}
+  udev rules file:  ${udevrulesfile:-N/A}
 ])