Skip to content

Commit 2d7bee7

Browse files
innovarapvalena
authored andcommitted
Fix pkcs11 and pcsc modules
pkcs11 and pcsc don't seem to have ever worked. In the case of pkcs11, the following install line is incorrect (note the dot before *): {"tls/$_arch/",tls/,"$_arch/",}"/cryptsetup/libcryptsetup-token-systemd-pkcs11.so.*" And it should be: {"tls/$_arch/",tls/,"$_arch/",}"/cryptsetup/libcryptsetup-token-systemd-pkcs11.so*" I opened a PR and it was merged a while ago: dracutdevs/dracut#2540 In the case of pcsc there are two problems. One, the installation file is missing /usr/share/p11-kit/modules/opensc.module and without that, you can't really do anything. Two, dracut doesn't include polkit and pcsc is compiled with it enabled by default. The option --disable-polkit was added to pcscd in 2.0, precisely to address this issue. It needs to be added to pcscd.service in the module for it to work on initramfs. I opened another PR which has been approved by 2 reviewers and merged into openSUSE: dracutdevs/dracut#2547 Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
1 parent 8f3935c commit 2d7bee7

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 1c762c0da6ed2bb6fa44d5e0968605cc4d45361c Mon Sep 17 00:00:00 2001
2+
From: innovara <fombuena@outlook.com>
3+
Date: Fri, 27 Oct 2023 11:53:49 +0100
4+
Subject: [PATCH] fix(pkcs11): delete trailing dot on
5+
libcryptsetup-token-systemd-pkcs11.so
6+
7+
libcryptsetup-token-systemd-pkcs11.so.* doesn't match the file libcryptsetup-token-systemd-pkcs11.so
8+
---
9+
modules.d/91pkcs11/module-setup.sh | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/modules.d/91pkcs11/module-setup.sh b/modules.d/91pkcs11/module-setup.sh
13+
index 547631db66..5675efb580 100755
14+
--- a/modules.d/91pkcs11/module-setup.sh
15+
+++ b/modules.d/91pkcs11/module-setup.sh
16+
@@ -30,6 +30,6 @@ install() {
17+
{"tls/$_arch/",tls/,"$_arch/",}"libffi.so.*" \
18+
{"tls/$_arch/",tls/,"$_arch/",}"libp11-kit.so.*" \
19+
{"tls/$_arch/",tls/,"$_arch/",}"libcryptsetup.so.*" \
20+
- {"tls/$_arch/",tls/,"$_arch/",}"/cryptsetup/libcryptsetup-token-systemd-pkcs11.so.*"
21+
+ {"tls/$_arch/",tls/,"$_arch/",}"/cryptsetup/libcryptsetup-token-systemd-pkcs11.so*"
22+
23+
}

2547-fix-pcsc-module.patch

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 6da61a2c0e38da4e6e880e1bb7f47d55d2c54c65 Mon Sep 17 00:00:00 2001
2+
From: Manuel Fombuena <mfombuena@innovara.co.uk>
3+
Date: Fri, 3 Nov 2023 09:04:53 +0000
4+
Subject: [PATCH 1/2] fix(pcsc): add opensc load module file
5+
6+
On Fedora, and possibly others, this file loads opensc-pkcs11.so which you need to interact with the smart card to unlock a LUKS encrypted volume.
7+
---
8+
modules.d/91pcsc/module-setup.sh | 3 ++-
9+
1 file changed, 2 insertions(+), 1 deletion(-)
10+
11+
diff --git a/modules.d/91pcsc/module-setup.sh b/modules.d/91pcsc/module-setup.sh
12+
index 6f8b2c88e1..26b463d436 100755
13+
--- a/modules.d/91pcsc/module-setup.sh
14+
+++ b/modules.d/91pcsc/module-setup.sh
15+
@@ -29,7 +29,8 @@ install() {
16+
inst_simple "$moddir/pcscd.socket" "${systemdsystemunitdir}"/pcscd.socket
17+
18+
inst_multiple -o \
19+
- pcscd
20+
+ pcscd \
21+
+ /usr/share/p11-kit/modules/opensc.module
22+
23+
# Enable systemd type unit(s)
24+
for i in \
25+
26+
From 842be0c89fe0cc8cac9efa88e68b07ae1c2d2464 Mon Sep 17 00:00:00 2001
27+
From: Manuel Fombuena <mfombuena@innovara.co.uk>
28+
Date: Fri, 3 Nov 2023 11:53:38 +0000
29+
Subject: [PATCH 2/2] fix(pcsc): add --disable-polkit to pcscd.service
30+
31+
Needs pcsc >= 2.0.0
32+
33+
polkit is not included in dracut and without this option, pcscd simply fails
34+
---
35+
modules.d/91pcsc/pcscd.service | 2 +-
36+
1 file changed, 1 insertion(+), 1 deletion(-)
37+
38+
diff --git a/modules.d/91pcsc/pcscd.service b/modules.d/91pcsc/pcscd.service
39+
index 639decd275..7d4e0a2b30 100644
40+
--- a/modules.d/91pcsc/pcscd.service
41+
+++ b/modules.d/91pcsc/pcscd.service
42+
@@ -5,7 +5,7 @@ Documentation=man:pcscd(8)
43+
Requires=pcscd.socket
44+
45+
[Service]
46+
-ExecStart=/usr/sbin/pcscd --foreground --auto-exit
47+
+ExecStart=/usr/sbin/pcscd --foreground --auto-exit --disable-polkit
48+
ExecReload=/usr/sbin/pcscd --hotplug
49+
50+
[Install]

dracut.spec

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
%global __requires_exclude pkg-config
88

99
# rpmdev-bumpspec and releng automation compatible variable
10-
%global baserelease 20
10+
%global baserelease 21
1111

1212
Name: dracut
1313
Version: 059
@@ -98,6 +98,15 @@ Patch17: 2481-remove-microcode-check-based-on-CONFIG_MICROCODE_.patch
9898
# https://github.com/dracutdevs/dracut/pull/2531
9999
Patch: 2531.patch
100100

101+
# fix(pkcs11): delete trailing dot on libcryptsetup-token-systemd-pkcs11.so
102+
# https://github.com/dracutdevs/dracut/pull/2540
103+
Patch19: 2540-fix-pkcs11-libcryptsetup-token-systemd-pkcs11-so-path.patch
104+
105+
# fix(pcsc): add opensc load module file
106+
# fix(pcsc): add --disable-polkit to pcscd.service
107+
# https://github.com/dracutdevs/dracut/pull/2547
108+
Patch20: 2547-fix-pcsc-module.patch
109+
101110
BuildRequires: bash
102111
BuildRequires: git-core
103112
BuildRequires: pkgconfig(libkmod) >= 23
@@ -498,6 +507,11 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
498507
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
499508

500509
%changelog
510+
* Sat Jan 27 2024 Manuel Fombuena <fombuena@outlook.com> - 059-21
511+
- fix(pkcs11): delete trailing dot on libcryptsetup-token-systemd-pkcs11.so
512+
- fix(pcsc): add opensc load module file
513+
- fix(pcsc): add --disable-polkit to pcscd.service
514+
501515
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 059-20
502516
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
503517

0 commit comments

Comments
 (0)