Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to start pcscd appropriately #491

Merged

Conversation

sarroutbi
Copy link
Collaborator

No description provided.

@sarroutbi sarroutbi force-pushed the 202410071254-groom-pcscd-startup branch 4 times, most recently from f8082cf to abf1cd6 Compare October 7, 2024 17:30
Signed-off-by: Sergio Arroutbi <[email protected]>
@oldium
Copy link
Contributor

oldium commented Oct 8, 2024

Just curious - the tcscd cannot be started by SystemD? I was solving the same service problem in TPM 1.2 code with tcsd (from trousers package, one letter less 😁) and have it working both for SystemD (Dracut) and non-SystemD (Dracut without SystemD, initramfs-tools).

@sarroutbi
Copy link
Collaborator Author

Just curious - the tcscd cannot be started by SystemD? I was solving the same service problem in TPM 1.2 code with tcsd (from trousers package, one letter less 😁) and have it working both for SystemD (Dracut) and non-SystemD (Dracut without SystemD, initramfs-tools).

Do you mean pcscd? We need it started in dracut, before Systemd appears ...

@oldium
Copy link
Contributor

oldium commented Oct 8, 2024

Yes, I mean pcscd 🙈 (typo, ehm).

You need to start pcscd before unlocking, not before SystemD, right? I added Wants+After tcsd dependency to clevis-luks-askpass.service, so that it is started before unlocking by SystemD automatically. I am now talking about the case when Dracut has SystemD enabled.

But maybe I just miss something...

Edit: This is not the only change. I also added a patch to tcsd SystemD service (via system-wide tcsd.service.d override) to allow starting it early (it adds DefaultDependencies=no and few dependencies).

My goal was to use as much existing configuration (service, data) as possible to remove the need to maintain full parallel configuration to third-party tools.

@sarroutbi
Copy link
Collaborator Author

Yes, I mean pcscd 🙈 (typo, ehm).

You need to start pcscd before unlocking, not before SystemD, right? I added Wants+After tcsd dependency to clevis-luks-askpass.service, so that it is started before unlocking by SystemD automatically. I am now talking about the case when Dracut has SystemD enabled.

But maybe I just miss something...

Edit: This is not the only change. I also added a patch to tcsd SystemD service (via system-wide tcsd.service.d override) to allow starting it early (it adds DefaultDependencies=no and few dependencies).

My goal was to use as much existing configuration (service, data) as possible to remove the need to maintain full parallel configuration to third-party tools.

Sincerely, I don't feel comfortable changing this so that it is called by systemd inside Dracut. IMHO, this is far more simple.

@oldium
Copy link
Contributor

oldium commented Oct 8, 2024

Ok, understood.

I was also afraid originally, but that was before I got more experience with it. SystemD inside Dracut (“initrd” bootup) works actually very similar to normal bootup (“system manager” bootup), so my goal was simple - if it works in one SystemD environment, it will work in the other environment. It not only unlocks the boot disk in the initrd phase, but it is also able to unlock other disks early in normal boot. So that I had to make it work once and it works great. Moreover, I do not have to care about parallel startup of my tcsd and the one started by SystemD service. I see that clevis-luks-pkcs11 is trying to prevent this situation (ps auxf | grep "[p]cscd"), but that does not stop SystemD from starting its instance. I decided to leave it on SystemD entirely because I did not want to cope with parallel startup of services and startup failures.

Edit: This is just my rationale for my implementation, I felt it is good to mention it when there is new implementation coming. But of course do whatever you feel fits better. 😊

Copy link
Collaborator

@sergio-correia sergio-correia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@sarroutbi sarroutbi merged commit ea01ad0 into latchset:master Oct 17, 2024
12 checks passed
@sarroutbi sarroutbi deleted the 202410071254-groom-pcscd-startup branch October 17, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants