Bug 2152418 - SELinux denied { map } on /var/lib/pdns/*
Summary: SELinux denied { map } on /var/lib/pdns/*
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: pdns
Version: epel9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Morten Stevens
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-11 18:27 UTC by Carlos Mogas da Silva
Modified: 2023-06-06 08:56 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-06-06 08:56:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Carlos Mogas da Silva 2022-12-11 18:27:26 UTC
Description of problem:

Setting up PowerDNS with an SQLite database currently fails to start do to a SELinux permission fail when PDNS tries to `map` the sqlite -shm file.


Version-Release number of selected component (if applicable):
4.6.2-1.el9


How reproducible:
Everytime


Steps to Reproduce:
1. dnf install pdns pdns-backend-sqlite
2. edit /etc/pdns/pdns.conf to use the sqlite backend
3. setup an sqlite database on /var/lib/pdns/
4. try to start the pdns

Actual results:
after setting all the correct selinux permissions, audit.log shows this:

type=AVC msg=audit(1670783172.019:9025): avc:  denied  { map } for  pid=21704 comm="pdns_server" path="/var/lib/pdns/r3pek.org.sqlite-shm" dev="dm-0" ino=50763508 scontext=system_u:system_r:pdns_t:s0 tcontext=system_u:object_r:pdns_var_lib_t:s0 tclass=file permissive=0


Expected results:
pdns should start normally

Additional info:
[root@dns01 pdns]# pwd
/var/lib/pdns
[root@dns01 pdns]# ls -lhZa
total 108K
drwx------.  2 pdns pdns system_u:object_r:pdns_var_lib_t:s0   86 Dec 11 18:15 .
drwxr-xr-x. 25 root root system_u:object_r:var_lib_t:s0      4.0K Dec 11 18:03 ..
-rw-------.  1 pdns pdns system_u:object_r:pdns_var_lib_t:s0  72K Dec 11 18:15 r3pek.org.sqlite
-rw-------.  1 pdns pdns system_u:object_r:pdns_var_lib_t:s0  32K Dec 11 18:27 r3pek.org.sqlite-shm
-rw-------.  1 pdns pdns system_u:object_r:pdns_var_lib_t:s0    0 Dec 11 18:15 r3pek.org.sqlite-wal

Comment 1 Carlos Mogas da Silva 2022-12-11 18:34:42 UTC
OK, after using audit2why I've found out that we can use `setsebool -P domain_can_mmap_files 1` to allow for this behaviour.

Please close if NOTABUG.


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