Bug 1830587 - SELinux prevents opendkim from creating socket in postfix chroot
Summary: SELinux prevents opendkim from creating socket in postfix chroot
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-02 20:11 UTC by Scott Shambarger
Modified: 2021-11-30 18:05 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-11-30 18:05:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Scott Shambarger 2020-05-02 20:11:15 UTC
Description of problem:
opendkim should be able to create a socket in the postfix chroot /var/run directory (similar to spamassassin).  SELinux currently prevents this.

Version-Release number of selected component (if applicable):

selinux-policy-targeted-3.14.4-50.fc31.noarch

How reproducible:

When configuring opendkim to create a socket in /var/spool/postfix/var/run/opendkim (so postfix can access opendkim when set to chroot it's network daemons)

Steps to Reproduce:

1. Configure opendkim.conf with
 Socket  local:/var/spool/postfix/var/run/opendkim/opendkim.sock
2. Create /var/spool/postfix/var/run/opendkim (opendkim:opendkim 0750 
3. Start opendkim.service

Actual results:

1. /var/spool/postfix/var/run/opendkim is labeled with: postfix_spool_t

2. opendkim fails to start, journal shows:
  Started DomainKeys Identified Mail (DKIM) Milter.
  socket cleanup failed: Permission denied

and selinux denials:

type=AVC msg=audit(1588449527.154:712): avc:  denied  { search } for  pid=10618 comm="opendkim" name="postfix" dev="dm-0" ino=134037 scontext=system_u:system_r:dkim_milter_t:s0 tcontext=system_u:object_r:postfix_spool_t:s0 tclass=dir permissive=0

Expected results:

1. /var/spool/postfix/var/run/opendkim is labeled with: dkim_milter_data_t

2. opendkim should be socket as it does in /run/opendkim (also dkim_milter_data_t)

Additional info:

I found the following policy module was necessary to get opendkim to work correctly:

--- opendkim.te ---

policy_module(opendkim,1.0.0)

require {
        type dkim_milter_t;
};

postfix_search_spool(dkim_milter_t);

--- opendkim.fc ---

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

With this policy, opendkim had access to the postfix/var/run directory, and created a correctly labeled socket.

Let me know if you need any more details on the denials :)

Thanks,
Scott

Comment 1 Ben Cotton 2020-11-03 16:40:30 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-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 '31'.

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 31 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 2 Scott Shambarger 2020-11-08 00:00:56 UTC
Tried under Fedora 33, and the problem still exists as described above.

Comment 3 Ben Cotton 2021-11-04 16:01:47 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
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 '33'.

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 33 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 4 Ben Cotton 2021-11-30 18:05:12 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 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.