Bug 2345752 - SELinux is preventing /usr/sbin/smtpctl from 'write' accesses on the directory /var/spool/smtpd/offline/.
Summary: SELinux is preventing /usr/sbin/smtpctl from 'write' accesses on the director...
Keywords:
Status: CLOSED DUPLICATE of bug 2342843
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 41
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:e8d9b759a12bbebc307d5fcf4da...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-02-14 15:57 UTC by Raman Gupta
Modified: 2025-02-20 19:31 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-02-20 19:31:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: os_info (681 bytes, text/plain)
2025-02-14 15:57 UTC, Raman Gupta
no flags Details
File: description (2.66 KB, text/plain)
2025-02-14 15:57 UTC, Raman Gupta
no flags Details

Description Raman Gupta 2025-02-14 15:57:54 UTC
Description of problem:
When running sendmail (provided by opensmtpd) from a cron job, permission is denied, resulting in an error like this:

sendmail: cannot create temporary file /var/spool/smtpd/offline/1739546283.XXXXXxumpB: Permission denied
SELinux is preventing /usr/sbin/smtpctl from 'write' accesses on the directory /var/spool/smtpd/offline/.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that smtpctl should be allowed write access on the  directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'sendmail' --raw | audit2allow -M my-sendmail
# semodule -X 300 -i my-sendmail.pp

Additional Information:
Source Context                system_u:system_r:logwatch_t:s0-s0:c0.c1023
Target Context                system_u:object_r:mail_spool_t:s0
Target Objects                /var/spool/smtpd/offline/ [ dir ]
Source                        sendmail
Source Path                   /usr/sbin/smtpctl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           opensmtpd-7.6.0p1-1.fc41.x86_64
Target RPM Packages           opensmtpd-7.6.0p1-1.fc41.x86_64
SELinux Policy RPM            selinux-policy-targeted-41.32-1.fc41.noarch
Local Policy RPM              selinux-policy-targeted-41.32-1.fc41.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.12.11-200.fc41.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Fri Jan 24 04:59:58 UTC 2025
                              x86_64
Alert Count                   19
First Seen                    2025-01-28 03:42:03 EST
Last Seen                     2025-02-14 10:18:03 EST
Local ID                      d2b3810f-489a-4ec8-a910-aaf205b4d882

Raw Audit Messages
type=AVC msg=audit(1739546283.70:27335): avc:  denied  { write } for  pid=264850 comm="sendmail" name="offline" dev="dm-4" ino=395366 scontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023 tcontext=system_u:object_r:mail_spool_t:s0 tclass=dir permissive=0


type=SYSCALL msg=audit(1739546283.70:27335): arch=x86_64 syscall=openat success=no exit=EACCES a0=ffffff9c a1=7fff3f877800 a2=c2 a3=180 items=1 ppid=264760 pid=264850 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=917 sgid=917 fsgid=917 tty=(none) ses=4294967295 comm=sendmail exe=/usr/sbin/smtpctl subj=system_u:system_r:logwatch_t:s0-s0:c0.c1023 key=(null)

type=CWD msg=audit(1739546283.70:27335): cwd=/

type=PATH msg=audit(1739546283.70:27335): item=0 name=/var/spool/smtpd/offline/ inode=395366 dev=fd:04 mode=040770 ouid=0 ogid=917 rdev=00:00 obj=system_u:object_r:mail_spool_t:s0 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0

Hash: sendmail,logwatch_t,mail_spool_t,dir,write

Version-Release number of selected component:
selinux-policy-targeted-41.32-1.fc41.noarch

Additional info:
reporter:       libreport-2.17.15
hashmarkername: setroubleshoot
kernel:         6.12.11-200.fc41.x86_64
reason:         SELinux is preventing /usr/sbin/smtpctl from 'write' accesses on the directory /var/spool/smtpd/offline/.
component:      selinux-policy
type:           libreport
package:        selinux-policy-targeted-41.32-1.fc41.noarch
component:      selinux-policy

Comment 1 Raman Gupta 2025-02-14 15:57:56 UTC
Created attachment 2076470 [details]
File: os_info

Comment 2 Raman Gupta 2025-02-14 15:57:58 UTC
Created attachment 2076471 [details]
File: description

Comment 3 Raman Gupta 2025-02-14 16:08:59 UTC
Also related alert:

SELinux is preventing /usr/sbin/smtpctl from 'write' accesses on the sock_file /var/run/smtpd.sock.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that smtpctl should be allowed write access on the smtpd.sock sock_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'sendmail' --raw | audit2allow -M my-sendmail
# semodule -X 300 -i my-sendmail.pp

Additional Information:
Source Context                system_u:system_r:logwatch_t:s0-s0:c0.c1023
Target Context                system_u:object_r:sendmail_var_run_t:s0
Target Objects                /var/run/smtpd.sock [ sock_file ]
Source                        sendmail
Source Path                   /usr/sbin/smtpctl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           opensmtpd-7.6.0p1-1.fc41.x86_64
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-41.32-1.fc41.noarch
Local Policy RPM              selinux-policy-targeted-41.32-1.fc41.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.12.11-200.fc41.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Fri Jan 24 04:59:58 UTC 2025
                              x86_64
Alert Count                   19
First Seen                    2025-01-28 03:42:03 EST
Last Seen                     2025-02-14 10:18:03 EST
Local ID                      31e16056-cb02-4fc8-a6c0-7b05c29c117a

Raw Audit Messages
type=AVC msg=audit(1739546283.70:27334): avc:  denied  { write } for  pid=264850 comm="sendmail" name="smtpd.sock" dev="tmpfs" ino=5339 scontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023 tcontext=system_u:object_r:sendmail_var_run_t:s0 tclass=sock_file permissive=0


type=SYSCALL msg=audit(1739546283.70:27334): arch=x86_64 syscall=connect success=no exit=EACCES a0=3 a1=7fff3f878790 a2=6e a3=55fc6e981790 items=1 ppid=264760 pid=264850 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=917 sgid=917 fsgid=917 tty=(none) ses=4294967295 comm=sendmail exe=/usr/sbin/smtpctl subj=system_u:system_r:logwatch_t:s0-s0:c0.c1023 key=(null)

type=CWD msg=audit(1739546283.70:27334): cwd=/

type=PATH msg=audit(1739546283.70:27334): item=0 name=/var/run/smtpd.sock inode=5339 dev=00:1b mode=0140666 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:sendmail_var_run_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0

Hash: sendmail,logwatch_t,sendmail_var_run_t,sock_file,write

Comment 4 Zdenek Pytela 2025-02-20 19:31:20 UTC

*** This bug has been marked as a duplicate of bug 2342843 ***


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