Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • lemonldap-ng lemonldap-ng
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 311
    • Issues 311
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • LemonLDAP NGLemonLDAP NG
  • lemonldap-nglemonldap-ng
  • Issues
  • #2401
Closed
Open
Issue created Nov 30, 2020 by Maxime Besson@maxbes🔧Maintainer

Selinux policy blocks cache after restorecon

Concerned version

Version: %2.0.9

Platform: Apache / CentOS

Summary

Since #2254 (closed), the cache is stored in /var/cache/lemonldap-ng to avoid systemd private directory issues.

However, after running restorecon on /var/cache/lemonldap-ng, the files become tagged var_t instead of httpd_cache_t (upon initial creation). From this point on, /var/cache/lemonldap-ng becomes polluted with temporary files

Logs

system_u:object_r:var_t:s0               .
system_u:object_r:var_t:s0               ./2
system_u:object_r:var_t:s0               ./2/d
system_u:object_r:var_t:s0               ./2/d/4
system_u:object_r:var_t:s0               ./2/d/4/2d4de2ba4d00f51dd7031724d2fbe7ff899ea508
system_u:object_r:httpd_cache_t:s0       ./2/d/4/_lj1q4t1OB
system_u:object_r:httpd_cache_t:s0       ./2/d/4/Gh6lS8HaWp
system_u:object_r:httpd_cache_t:s0       ./2/d/4/UIrWvLjhsY

audit.log:

type=AVC msg=audit(1606731077.821:963): avc:  denied  { getattr } for  pid=11712 comm="index.fcgi" path="/var/cache/lemonldap-ng/lemonldap-ng-config/2/d/4/2d4de2ba4d00f51dd7031724d2fbe7ff899ea508" dev="dm-0" ino=4656864 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file permissive=0

Possible fixes

A temporary fix:

semanage fcontext --add -t httpd_cache_t -f a '/var/cache/lemonldap-ng(/.*)?'

However we need to integrate this modification in our RPMS

@xavierb can you give me some pointers on the proper way to do this? I found this doc https://fedoraproject.org/wiki/PackagingDrafts/SELinux#File_contexts but it seems pretty old, and adding semanage as a LemonLDAP dependancy doesn't seem like a great idea.

Assignee
Assign to
Time tracking