diff mbox series

[bug#49957] gnu: p11-kit: Fix certificate errors from flatpak apps

Message ID 20210809141431.3889892-1-whatson@gmail.com
State Accepted
Headers show
Series [bug#49957] gnu: p11-kit: Fix certificate errors from flatpak apps | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Andrew Whatson Aug. 9, 2021, 2:14 p.m. UTC
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(-)

Comments

John Kehayias Sept. 28, 2021, 2:26 a.m. UTC | #1
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/50860 Also 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.
John Kehayias Sept. 28, 2021, 5:07 a.m. UTC | #2
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.
Ludovic Courtès Oct. 25, 2021, 7:13 p.m. UTC | #3
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+.)

Thanks,
Ludo’.
John Kehayias Oct. 25, 2021, 7:33 p.m. UTC | #4
Hi Ludo’ and Andrew,

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

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

> 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
Ludovic Courtès Oct. 27, 2021, 2:27 p.m. UTC | #5
Hi,

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

> 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”:

--8<---------------cut here---------------start------------->8---
$ 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
--8<---------------cut here---------------end--------------->8---

To see them all, try this:

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

HTH,
Ludo’.
diff mbox series

Patch

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 _