Bug 1518027

Summary: SELinux is preventing git-upload-pack from map access on the file /var/lib/git/...
Product: [Fedora] Fedora Reporter: Anthony Messina <amessina>
Component: selinux-policy-targetedAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: unspecified    
Version: 27CC: dwalsh, lvrabec, tmz, trailtotale
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-30 21:01:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1481454    

Description Anthony Messina 2017-11-27 23:05:53 UTC
With selinux-policy-3.13.1-283.16.fc27.noarch, getting tons of denied "map" AVCs for git like the following.  The following is using git-daemon, though similar errors occur when using /var/www/git and git-http-backend

type=AVC msg=audit(1511823417.555:12215): avc:  denied  { map } for  pid=11637 comm="git-upload-pack" path="/var/lib/git/rpms/dahdi-linux-kmod.git/objects/a8/0bdc4ec4bfc14f273b92bfadf46571354a2a0a" dev="md1" ino=112943180 scontext=system_u:system_r:git_system_t:s0 tcontext=system_u:object_r:git_sys_content_t:s0 tclass=file permissive=1

Sidenote: F27 came with lots of these denied "map" AVCs across many applications.  Is there some bigger SELinux fix coming, or are these to be dealt with one-by-one?

Comment 1 John Florian 2018-01-20 21:09:55 UTC
I can confirm this.  I had to use the following local policy for now:

"""
module local 1.0;

require {
        type nfs_t;
        type httpd_t;
        class file map;
}

#============= httpd_t ==============
allow httpd_t nfs_t:file map;
"""

Comment 2 Todd Zullinger 2018-04-12 20:28:06 UTC
Lukas, any word on this?  I just ran into this on f28 beta with selinux-policy-3.14.1-19.fc28 while testing git-daemon.

Comment 3 Todd Zullinger 2018-04-12 22:56:01 UTC
I filed a PR in the GitHub repo:

    https://github.com/fedora-selinux/selinux-policy-contrib/pull/53

As I mentioned there, I'm not sure whether this works for use with the git-http-backend or not.  I haven't had time to test that yet.  I'll try to do so, but if anyone else beats me to it that would be great.  If anyone has specific AVC's from use with git-http-backend it would be helpful.

Comment 4 Todd Zullinger 2018-04-15 17:45:37 UTC
I tested with git-http-backend and found that it was not sufficient.  I submitted a second pull request which should resolve that issue:

    https://github.com/fedora-selinux/selinux-policy-contrib/pull/54

Comment 5 Todd Zullinger 2018-04-15 22:52:24 UTC
In case it helps with testing, here are f27 and f28 scratch builds with the changes:

f27: https://koji.fedoraproject.org/koji/taskinfo?taskID=26382332 (koji)
     https://src.fedoraproject.org/fork/tmz/rpms/selinux-policy/branch/f27 (git)

f28: https://koji.fedoraproject.org/koji/taskinfo?taskID=26384218 (koji)
     https://src.fedoraproject.org/fork/tmz/rpms/selinux-policy/branch/f28 (git)

I've only tested the f28 builds.

Comment 6 Ben Cotton 2018-11-27 16:10:44 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. 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 '27'.

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 27 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 7 Ben Cotton 2018-11-30 21:01:41 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 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.