Bug 1303531 - SELinux is preventing gpg2 from 'write' accesses on the file trustdb.gpg.
Summary: SELinux is preventing gpg2 from 'write' accesses on the file trustdb.gpg.
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: fwupd
Version: 24
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Richard Hughes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:5b840da17248cfeff034ad2f20d...
: 1309998 1310979 1315028 (view as bug list)
Depends On:
Blocks: 1310976
TreeView+ depends on / blocked
 
Reported: 2016-02-01 08:31 UTC by Vít Ondruch
Modified: 2017-08-08 12:43 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-08 12:43:52 UTC
Type: ---


Attachments (Terms of Use)

Description Vít Ondruch 2016-02-01 08:31:59 UTC
Description of problem:
SELinux is preventing gpg2 from 'write' accesses on the file trustdb.gpg.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that gpg2 should be allowed write access on the trustdb.gpg file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep gpg2 /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:fwupd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:gpg_secret_t:s0
Target Objects                trustdb.gpg [ file ]
Source                        gpg2
Source Path                   gpg2
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-168.fc24.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.4.0-1.fc24.x86_64 #1 SMP Mon Jan
                              11 16:48:24 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-02-01 09:30:58 CET
Last Seen                     2016-02-01 09:30:58 CET
Local ID                      c2c4013f-d3c1-48cf-8576-9a4217c5e3eb

Raw Audit Messages
type=AVC msg=audit(1454315458.961:5137): avc:  denied  { write } for  pid=9894 comm="gpg2" name="trustdb.gpg" dev="dm-1" ino=1312688 scontext=system_u:system_r:fwupd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:gpg_secret_t:s0 tclass=file permissive=1


Hash: gpg2,fwupd_t,gpg_secret_t,file,write

Version-Release number of selected component:
selinux-policy-3.13.1-168.fc24.noarch

Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.4.0-1.fc24.x86_64
type:           libreport

Comment 1 Lukas Vrabec 2016-02-08 13:01:29 UTC
commit b7f12bd37716a3312f943667aab467813a614208
Author: Lukas Vrabec <lvrabec>
Date:   Mon Feb 8 13:28:26 2016 +0100

    Allow fwupd domain transition to gpg domain. Fwupd signing firmware updates by gpg. rhbz#1303531

Comment 2 Lukas Vrabec 2016-02-10 11:53:02 UTC
Fix above was reverted, we need to find another solution how to fix it.

Comment 3 Lukas Vrabec 2016-02-10 11:55:51 UTC
Fwdupd folks, 

Could you check: 
https://github.com/fedora-selinux/selinux-policy/commit/b7f12bd37716a3312f943667aab467813a614208

and come up with some solution? 

Thank you.

Comment 4 dac.override 2016-02-12 08:39:25 UTC
Yea, and can we also get fwupd to bail out when it is done because currently we have a fwupd and gpg-agent process associated with the root uid dangling long after it has done what it is supposed to do.

if you in gnome-software force a refresh it will spawn fwupd, that will spawn gpg, which with spawn gpg-agent. When done they dont quit. Also when fwupd for some reason fails then the refresh procedure will refuse to continue. (should fwupd not be optional in the first place?)

Comment 5 dac.override 2016-02-12 08:48:40 UTC
So:

fwupd should run gpg with $GPG_HOME=/var/lib/fwupd/.gnupg, then when fwupd is done with gpg, it should make sure that it terminates the gpg-agent process that it indirectly spawned, and then when fwupd is done, it should terminate and not sick around indefinetely

Comment 6 dac.override 2016-02-12 08:58:03 UTC
.. maybe even better run gpg with "-no-use-agent" if possible, as i suspect that this will cause gpg not not spawn a gpg-agent process

Comment 7 Jan Kurik 2016-02-24 15:52:22 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 8 Lukas Vrabec 2016-02-25 10:03:54 UTC
*** Bug 1309998 has been marked as a duplicate of this bug. ***

Comment 9 Lukas Vrabec 2016-03-07 09:29:42 UTC
*** Bug 1315028 has been marked as a duplicate of this bug. ***

Comment 10 Richard Hughes 2016-06-28 07:44:50 UTC
*** Bug 1310979 has been marked as a duplicate of this bug. ***

Comment 11 Richard Hughes 2016-06-28 08:23:33 UTC
commit 4eb527f873c2fa0a0ba1373defdb88fdddb7fee1
Author: Richard Hughes <richard>
Date:   Tue Jun 28 09:17:39 2016 +0100

    Use a private gnupg key store
    
    Although it's convenient that you can just log in as root and add another
    trusted key, it makes the selinux developers unhappy. Use a private keystore
    in /var/lib/fwupd/gnupg to avoid the possibility of a somehow hacked fwupd
    being able to export the root gpg secrets if any happened to exist.
    
    If you've trusted keys other than the LVFS for metadata or firmware you'll need
    to re-import them into this new location.
    
    See https://github.com/fedora-selinux/selinux-policy/commit/b7f12bd37716a3312f943667aab467813a614208
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1303531

:100644 100644 347bef9... 6891ca8... M  contrib/fwupd.spec.in
:100644 100644 265198f... 6eec671... M  src/fu-keyring.c

Comment 12 Fedora End Of Life 2017-07-25 19:52:47 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2017-08-08 12:43:52 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.