[PATCH] gnu: p11-kit: Fix certificate errors from flatpak apps

  • Done
  • quality assurance status badge
Details
3 participants
  • John Kehayias
  • Ludovic Courtès
  • Andrew Whatson
Owner
unassigned
Submitted by
Andrew Whatson
Severity
normal
A
A
Andrew Whatson wrote on 9 Aug 2021 16:14
(address . guix-patches@gnu.org)(name . Andrew Whatson)(address . whatson@gmail.com)
20210809141431.3889892-1-whatson@gmail.com
Flatpak has a soft dependency on p11-kit, which was configured without
knowledge of the system-wide CA certificate store. This caused some
flatpak apps to fail with ERR_CERT_AUTHORITY_INVALID errors.

* gnu/packages/tls.scm (p11-kit): Configure with
/etc/ssl/certs/ca-certificates.crt as a trusted path.
---
gnu/packages/tls.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index d98a724b5f..4af95e2798 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -143,7 +143,7 @@ in intelligent transportation networks.")
`(("libffi" ,libffi)
("libtasn1" ,libtasn1)))
(arguments
- `(#:configure-flags '("--without-trust-paths")
+ `(#:configure-flags '("--with-trust-paths=/etc/ssl/certs/ca-certificates.crt")
#:phases (modify-phases %standard-phases
(add-before 'check 'prepare-tests
(lambda _
--
2.32.0
J
J
John Kehayias wrote on 28 Sep 2021 04:26
(name . 49957@debbugs.gnu.org)(address . 49957@debbugs.gnu.org)
VlzZOd8ZedUysvC5Qfuhk1TJpPygT_P7tInaIkOuWqInX9Rw0MV9Z4UkML4_Ax8WCpaPzaC_d59tn4z0FdwPxwUhtkWyma9OJUP8WWRgZ6g=@protonmail.com
Interestingly, I just hit this issue after moving to core-updates-frozen. Not sure what caused it now, p11-kit nor flatpak has changed, but must be something between them.

Unfortunately, this would cause a huge rebuild from what I can tell, so I tried --with-graft and it didn't seem to make a difference. Also, p11-kit is now out of date, with the latest version being 0.24.0.

So, perhaps this could make its way into core-updates-frozen with the upcoming world rebuild coming? https://bugs.gnu.org/50860Also wanted to note that this change would match what nix does with p11-kit for the same reason.

Open to other suggestions, hoping to not break flatpak in core-updates-frozen.
J
J
John Kehayias wrote on 28 Sep 2021 07:07
(name . 49957@debbugs.gnu.org)(address . 49957@debbugs.gnu.org)(name . Andrew Whatson)(address . whatson@gmail.com)
nBwW7sAMBJXkPw2BGM94-IoOV7pUOtDZyrEVlYVEGMwgwf-Mj3-hLZlVhZxRuee8qQoIf28eWbbfrUpluZUONUbyS--VFJtQPuBpASHpemo=@protonmail.com
For the record, I'm using the beta of Flatpak (installs fine with --with-source transformation), version 1.11.3.

Also, I found a workaround by manually killing the p11-kit server and running a new one that I built with this patch and updated to the latest version. In case this helps anyone, I ran with the parameters Flatpak tries to launch:

p11-kit server --sh -n /run/user/1000/.flatpak-helper/pkcs11-flatpak-#### --provider p11-kit-trust.so "pkcs11:model=p11-kit-trust?write-protected=yes"

where the -n argument #### came from trying to run a Flatpak app and seeing it fail not finding the p11-kit server at that socket. Probably you can do this more easily by forcing Flatpak when it first runs to use the fixed p11-kit version (through a patch in Flatpak or some environment setting? or what the system starts?). But with p11-kit server already running for me, this did the trick for testing.
L
L
Ludovic Courtès wrote on 25 Oct 2021 21:13
Re: bug#49957: [PATCH] gnu: p11-kit: Fix certificate errors from flatpak apps
(name . Andrew Whatson)(address . whatson@gmail.com)
87h7d4kjdl.fsf@gnu.org
Hi,

Andrew Whatson <whatson@gmail.com> skribis:

Toggle quote (7 lines)
> Flatpak has a soft dependency on p11-kit, which was configured without
> knowledge of the system-wide CA certificate store. This caused some
> flatpak apps to fail with ERR_CERT_AUTHORITY_INVALID errors.
>
> * gnu/packages/tls.scm (p11-kit): Configure with
> /etc/ssl/certs/ca-certificates.crt as a trusted path.

I pushed a similar fix on ‘master’ based on John’s patch as
b4d29851e412c6f4fea5b2d98160258b9768dee3.

We might as well update the default p11-kit though? (Somehow I was
assuming it had many dependents, but it only has 80+.)

Thanks,
Ludo’.
Closed
J
J
John Kehayias wrote on 25 Oct 2021 21:33
(name . Ludovic Courtès)(address . ludo@gnu.org)
Br6tZRqMBEAbSgh7nqcJkIgiin-ogy54r81SQ1EaTl5sO4xycbqNWVb46anlntbNcswp7lvUq9k0brr-tRdEkstvAdKRzO8sjw6dUSIsW4I=@protonmail.com
Hi Ludo’ and Andrew,

??????? Original Message ???????

On Monday, October 25th, 2021 at 3:13 PM, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (18 lines)
> Hi,
>
> Andrew Whatson whatson@gmail.com skribis:
>
> > Flatpak has a soft dependency on p11-kit, which was configured without
> > knowledge of the system-wide CA certificate store. This caused some
> > flatpak apps to fail with ERR_CERT_AUTHORITY_INVALID errors.
> >
> > - gnu/packages/tls.scm (p11-kit): Configure with
> > /etc/ssl/certs/ca-certificates.crt as a trusted path.
>
> I pushed a similar fix on ‘master’ based on John’s patch as
> b4d29851e412c6f4fea5b2d98160258b9768dee3.
>
> We might as well update the default p11-kit though? (Somehow I was
> assuming it had many dependents, but it only has 80+.)
>

Flatpak's dependency doesn't show up on a guix refresh --list-dependents p11-kit, as it comes through some other package somehow (I never looked how exactly). But I guess that is more "using" than needing to build against? Wondering if there are some hidden runtime cases to look out for. (Probably more relevant when thinking of changing that configure flag?)

For this bug, the fixes that I wrote did need a cleaning out of previous Flatpaks (checking how you launch Flatpak apps as our previous version put the full store path in .desktop files) as p11-kit gets started in some indirect way. I think via D-Bus and its portal, but the system p11-kit could be used instead of the fixed version. I made sure to remove previous Flatpak installs from my profile and did a restart to be sure. Noting here for completeness.

John
Closed
L
L
Ludovic Courtès wrote on 27 Oct 2021 16:27
(name . John Kehayias)(address . john.kehayias@protonmail.com)
87wnlyfsps.fsf@gnu.org
Hi,

John Kehayias <john.kehayias@protonmail.com> skribis:

Toggle quote (7 lines)
> Flatpak's dependency doesn't show up on a guix refresh
> --list-dependents p11-kit, as it comes through some other package
> somehow (I never looked how exactly). But I guess that is more "using"
> than needing to build against? Wondering if there are some hidden
> runtime cases to look out for. (Probably more relevant when thinking
> of changing that configure flag?)

‘guix refresh -l’ doesn’t list all the dependents, only the “contour”:

Toggle snippet (4 lines)
$ guix refresh -l p11-kit@0.23
Building the following 40 packages would ensure 81 dependent packages are rebuilt: inxi@3.3.07-1 autofs@5.1.8 network-manager-openvpn@1.8.12 network-manager-vpnc@1.2.6 eolie@0.9.101 gramps@5.1.4 glimpse@0.2.0 openttd@1.11.2 gimp-fourier@0.4.3-2 gimp-resynthesizer@2.0.3 gmic-qt-gimp@2.9.7 rapid-photo-downloader@0.9.18 entangle@3.0 gnome-todo@3.28.1 geary@3.34.1 chatty@0.1.17 shotwell@0.30.12 rhythmbox@3.4.4 gnome-photos@3.34.2 claws-mail@4.0.0 seahorse@3.36.2 network-manager-openconnect@1.2.6 evolution@3.34.2 gnome-music@3.34.5 gnome-tweaks@3.34.1 lxde@0.99.2 caja-extensions@1.24.1 spacefm@1.0.6 xfce@4.16.0 vinagre@3.22.0 liferea@1.13.4 remmina@1.4.20 arc-theme@20201013 gnome-shell-extension-gsconnect@33 numix-gtk-theme@2.6.7 gnome@3.34.5 mate@1.24.1 surf@2.1 midori@9.0 eid-mw@5.0.28

To see them all, try this:

guix graph -t reverse-package p11-kit@0.23 | xdot -

HTH,
Ludo’.
Closed
?