# The following was performed on Debian Stretch # # See: # http://opensc.1086184.n5.nabble.com/eventmgr-tp8093p8094.html # https://github.com/OpenSC/pam_pkcs11/blob/master/etc/pkcs11_eventmgr.conf.example # # Note: A working PAM integration is required. See: # https://pastebin.com/cx6T3L9H # ===================================================================== # Create /etc/pam_pkcs11/pkcs11_eventmgr.conf # --------------------------------------------------------------------- pkcs11_eventmgr { # Run in background. daemon = true; # show debug messages debug = false; # polling time in seconds polling_time = 1; # expire time in seconds # default = 0 ( no expire ) expire_time = 0; # pkcs11 module to use pkcs11_module = /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so # # list of events and actions # Card inserted event card_insert { # what to do if an action fail? # ignore : continue to next action # return : end action sequence # quit : end program on_error = ignore ; # You can enter several, comma-separated action entries # they will be executed in turn action = "/usr/bin/xscreensaver-command -deactivate"; } # Card has been removed event card_remove { on_error = ignore; action = "/usr/bin/xscreensaver-command -lock"; } # Too much time locked session event timeout { on_error = ignore; action = "/bin/false"; } } # Start /usr/bin/pkcs11_eventmgr on login # --------------------------------------------------------------------- # # Option 1: ~/.xsession # # add /usr/bin/pkcs11_eventmgr to the ~/.xsession file # Option 2: add to Window Manager # # Example in xfce4: # 1. Applications > Settings > Session and Startup # 2. Application Autostart tab > Add... # 3. Enter a description and "/usr/bin/pkcs11_eventmgr"