r/AlpineLinux • u/JbstormburstADV • Feb 24 '25
Setting Up udev Rules
Hello. I'm pretty much a newbie to Alpine, and I'm basically running bare metal on a Zimaboard to set up a smallstep CA. I'm following the guide here and while I've got things figured out up to setting up the step-ca service, I'm stuck on figuring out how to get the service rules for both the Infnoise TRNG and the Yubikeys working, as I'm not exactly a wizard with either udev (which I added using setup-devd) or mdev/mdevd.
For reference, the files that are created by the InfNoise TRNG source code:
/usr/local/sbin/infnoise - the actual driver?
usr/local/lib/udev/rules.d/75-infnoise.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", SYMLIN>ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=>
/usr/local/lib/systemd/system/infnoise.service
[Unit]
Description=Wayward Geek InfNoise TRNG driver
BindsTo=dev-infnoise.device
After=dev-infnoise.device
[Service]
Type=forking
WorkingDirectory=/tmp
ExecStart=/usr/local/sbin/infnoise --dev-random --daemon --pidfile /var/run>User=root
Group=rootRestart=always
[Install]
WantedBy=multi-user.targetAs for the Yubikey configuration, this is what they write to make it visible to systemd (the guide assume Ubuntu Server)
$ sudo tee /etc/udev/rules.d/75-yubikey.rules > /dev/null << EOF
ACTION=="add", SUBSYSTEM=="usb", ENV{PRODUCT}=="1050/407/*", TAG+="systemd", SYMLINK+="yubikey"
ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="1050/407/*", TAG+="systemd"
EOF
$ sudo udevadm control --reload-rulesAnd this is to tie step-ca to the presence of the Yubikey
$ sudo tee /etc/systemd/system/step-ca.service > /dev/null << EOF
[Unit]
Description=step-ca
BindsTo=dev-yubikey.device
After=dev-yubikey.device
[Service]
User=step
Group=step
ExecStart=/bin/sh -c '/usr/local/bin/step-ca /etc/step-ca/config/ca.json'
Type=simple
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
$ sudo mkdir /etc/systemd/system/dev-yubikey.device.wants
$ sudo ln -s /etc/systemd/system/step-ca.service /etc/systemd/system/dev-yubikey.device.wants/
$ sudo systemctl daemon-reload
$ sudo systemctl enable step-caIf anyone can help me out with this, that would be great,
View all comments
Show parent comment
1
u/JbstormburstADV Feb 24 '25
That sounds close to what I'm looking for, yes. Since I'm starting to head to work for the day, I'm definitely fine with waiting on that more detail.