Bug 2322523

Summary: SELinux change removes label for OpenDKIM
Product: [Fedora] Fedora Reporter: Anthony Messina <amessina>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 41CC: dwalsh, esm, hany, info, lvrabec, marek.gresko, michael.schlechtinger, mironov.ivan, mmalik, nphilipp, omosnacek, pkoncity, redhat-bugzilla, redhat, stefano.biagiotti, vmojzis, y9t7sypezp, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-41.46-1.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-08-01 01:55:26 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:

Description Anthony Messina 2024-10-29 18:45:22 UTC
After upgrading to Fedora 41 with selinux-policy-41.24-1.fc41, I noticed that OpenDKIM/Postfix aren't working properly and that the /run/opendkim directory is labeled var_run_t when it should be dkim_milter_data_t.

Upstream https://github.com/fedora-selinux/selinux-policy/commit/eaa8cf1d7f187819a4c82c1fa52704a669ec780b also removed the entry:

/run/opendkim(/.*)?         gen_context(system_u:object_r:dkim_milter_data_t,s0)

which should probably be put back and a new policy package released.

Comment 1 Steve 2024-11-01 18:25:13 UTC
I am not an selinux maintainer, but I noticed that the commit message says:

"Remove a few lines duplicated between {dkim,milter}.fc"

However, this is present in both files:

/var/spool/opendkim(/.*)?	gen_context(system_u:object_r:dkim_milter_data_t,s0)

More to the point, there don't seem to be any file contexts from dkim.fc in selinux-policy-targeted-41.24-1.fc41.noarch:

$ sudo semanage fcontext -l | fgrep dkim
/etc/mail/dkim-milter/keys(/.*)?                   all files          system_u:object_r:dkim_milter_private_key_t:s0 
/run/opendmarc(/.*)?                               all files          system_u:object_r:dkim_milter_data_t:s0 
/usr/bin/dkim-filter                               regular file       system_u:object_r:dkim_milter_exec_t:s0 
/usr/bin/opendkim                                  regular file       system_u:object_r:dkim_milter_exec_t:s0 
/usr/bin/opendmarc                                 regular file       system_u:object_r:dkim_milter_exec_t:s0 
/var/spool/opendkim(/.*)?                          all files          system_u:object_r:dkim_milter_data_t:s0 
/var/spool/opendmarc(/.*)?                         all files          system_u:object_r:dkim_milter_data_t:s0 

The problem appears to be that the dkim module is missing:

$ sudo semodule --list-modules=full | fgrep 'dkim'

In contrast:

$ sudo semodule --list-modules=full | fgrep 'milter'
100 milter               pp

Comment 2 Steve 2024-11-01 19:46:55 UTC
From https://github.com/fedora-selinux/selinux-policy/archive/refs/tags/v41.24.zip:

$ egrep -n 'dkim|milter' ./selinux-policy-41.24/dist/targeted/modules.conf
1377:# Module: milter
1381:milter = module

Comment 3 Anthony Messina 2024-11-02 14:43:21 UTC
(In reply to Steve from comment #1)
> I am not an selinux maintainer, but I noticed that the commit message says:
> 
> "Remove a few lines duplicated between {dkim,milter}.fc"
> 
> However, this is present in both files:
> 
> /var/spool/opendkim(/.*)?
> gen_context(system_u:object_r:dkim_milter_data_t,s0)
> 
> More to the point, there don't seem to be any file contexts from dkim.fc in
> selinux-policy-targeted-41.24-1.fc41.noarch:
> 
> $ sudo semanage fcontext -l | fgrep dkim
> /etc/mail/dkim-milter/keys(/.*)?                   all files         
> system_u:object_r:dkim_milter_private_key_t:s0 
> /run/opendmarc(/.*)?                               all files         
> system_u:object_r:dkim_milter_data_t:s0 
> /usr/bin/dkim-filter                               regular file      
> system_u:object_r:dkim_milter_exec_t:s0 
> /usr/bin/opendkim                                  regular file      
> system_u:object_r:dkim_milter_exec_t:s0 
> /usr/bin/opendmarc                                 regular file      
> system_u:object_r:dkim_milter_exec_t:s0 
> /var/spool/opendkim(/.*)?                          all files         
> system_u:object_r:dkim_milter_data_t:s0 
> /var/spool/opendmarc(/.*)?                         all files         
> system_u:object_r:dkim_milter_data_t:s0 
> 
> The problem appears to be that the dkim module is missing:
> 
> $ sudo semodule --list-modules=full | fgrep 'dkim'
> 
> In contrast:
> 
> $ sudo semodule --list-modules=full | fgrep 'milter'
> 100 milter               pp

That is also correct.  The entry for /run/opendkim(/.*)? is missing from the install and either updating milter.fc or ensuring the dkim policy is included could resolve the issue.

Comment 4 Anthony Messina 2025-01-11 16:36:16 UTC
Still present in selinux-policy-41.28-1.fc41.noarch

Please re-add the following to milter.fc, since it appears dkim isn't built in Fedora targeted policy

/run/opendkim(/.*)?         gen_context(system_u:object_r:dkim_milter_data_t,s0)

Comment 5 Anthony Messina 2025-02-11 17:46:11 UTC
This upstream pull request would resolve the issue: https://github.com/fedora-selinux/selinux-policy/pull/2447

Comment 6 Fedora Update System 2025-07-16 08:01:27 UTC
FEDORA-2025-37c20d2140 (selinux-policy-41.46-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-37c20d2140

Comment 7 Fedora Update System 2025-07-17 01:07:27 UTC
FEDORA-2025-37c20d2140 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-37c20d2140`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-37c20d2140

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Anthony Messina 2025-07-17 11:53:49 UTC
Will there be a Fedora 42 release with the same fix?

Comment 9 Anthony Messina 2025-07-17 12:08:43 UTC
(In reply to Anthony Messina from comment #8)
> Will there be a Fedora 42 release with the same fix?

Nevermind. It looks updated in F42.

Comment 10 Fedora Update System 2025-08-01 01:55:26 UTC
FEDORA-2025-37c20d2140 (selinux-policy-41.46-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.