I have tried to find some answers on this and other sites trying to find out the problem, but my attempts failed. The rule is very simple: I want to establish my Ipsec tunnel when my Yubikey is plugged.
- My rule is in the file
/etc/udev/rules.d/local.rules
In which the script goes as:
SUBSYSTEM=="input", ACTION=="add", ENV{ID_MODEL}=="Yubikey_4_OTP+U2F+CCID" , RUN+="/usr/local/bin/Yubikey.sh"
Then the script /usr/local/bin/Yubikey.sh contains:
#!/bin/sh
ipsec restart
if (ipsec status | grep none);then
ipsec up connection
fi
This invokes the script when any input device is plugged, and then the script should restart ipsec and initiate the tunnel if there was not a tunnel initiated before. However, the tunnel doesn't initiate as I get the following error when I run ipsec status command:
connecting to 'unix:///var/run/charon.ctl' failed: Connection refused
failed to connect to stroke socket 'unix"//var/run/charon.ctl'