I am setting up step-ca and a Nitrokey HSM 2.
As a root user, I can start the CA, which finds the private keys on the HSM and operates normally.
It fails if I attempt to use an unprivileged service account in a systemd unit service.
I believe this is because the service account does not have enough rights.
i.e. It only sees the local system and not the hardware token:
An unprivileged user gets access to the token via a socket provided by pcscd. Maybe your distributions has special group (e.g. pcscd) that you need to add to get access to that socket.
You can try to run the pcscd in debug mode as root with
I figured out how to grant my unprivileged user rights by adding a rules file for polkit in /etc/polkit-1/rules.d/[your-filename].rules. Here I am granting my unprivileged account “step” to pcsc and the HSM
Isn’t there a reasonable default policy in Ubuntu ?
If access to Smartcards is denied by default to all non-root users, then this will become a major support issue. I don’t see users programming polkit rules to make this work.
I am using my own account to SSH to the machine. step-ca and the HSM are used by a local system user (step).
It is my understanding that if a user has local (keyboard) access to the machine, it will just work. I have not tested this.
It is also my understanding that groups can be used in a rule, so administration may not be a huge undertaking.
I’ll post a question with Ubuntu to get their take in case I have overlooked anything.