Bug 976548 - SELinux is preventing /usr/bin/perl from 'write' accesses on the directory clamd.amavisd.
Summary: SELinux is preventing /usr/bin/perl from 'write' accesses on the directory cl...
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 19
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:09555deb488de3dd4c0149e03ed...
: 976564 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-20 18:49 UTC by W Agtail
Modified: 2013-07-30 20:29 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-3.12.1-57.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-30 20:29:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description W Agtail 2013-06-20 18:49:56 UTC
Description of problem:
This happened when attempting to start clamd.amavisd. Also, from the logs, clamd_use_jit does not exist:

Jun 20 19:42:58 f19 systemd: Starting SYSV: The clamd server running for amavisd...
Jun 20 19:43:03 f19 clamd.amavisd: Starting clamd.amavisd: LibClamAV Warning: RWX mapping denied: Can't allocate RWX Memory: Permission denied
Jun 20 19:43:03 f19 clamd.amavisd: LibClamAV Warning: Bytecode: disabling JIT because SELinux is preventing 'execmem' access.
Jun 20 19:43:03 f19 clamd.amavisd: Run  'setsebool -P clamd_use_jit on'.
Jun 20 19:43:03 f19 dbus[950]: [system] Activating service name='org.fedoraproject.Setroubleshootd' (using servicehelper)
Jun 20 19:43:03 f19 dbus-daemon: dbus[950]: [system] Activating service name='org.fedoraproject.Setroubleshootd' (using servicehelper)
Jun 20 19:43:03 f19 clamd.amavisd: [  OK  ]
Jun 20 19:43:03 f19 systemd: Started SYSV: The clamd server running for amavisd.
Jun 20 19:43:04 f19 dbus[950]: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd'
Jun 20 19:43:04 f19 dbus-daemon: dbus[950]: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd'
Jun 20 19:43:06 f19 setroubleshoot: SELinux is preventing /usr/bin/perl from write access on the directory clamd.amavisd. For complete SELinux messages. run sealert -l 3ffed360-feda-4cd4-a0ee-74dde4029547

> setsebool -P clamd_use_jit on
libsemanage.dbase_llist_set: record not found in the database (No such file or directory).
libsemanage.dbase_llist_set: could not set record value (No such file or directory).
Could not change boolean clamd_use_jit
Could not change policy booleans
SELinux is preventing /usr/bin/perl from 'write' accesses on the directory clamd.amavisd.

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

If you believe that perl should be allowed write access on the clamd.amavisd 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:
# grep /usr/sbin/amavi /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:antivirus_t:s0
Target Context                unconfined_u:object_r:var_run_t:s0
Target Objects                clamd.amavisd [ dir ]
Source                        /usr/sbin/amavi
Source Path                   /usr/bin/perl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           clamav-server-0.97.8-2.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-52.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.6-301.fc19.x86_64 #1 SMP Mon
                              Jun 17 14:26:26 UTC 2013 x86_64 x86_64
Alert Count                   5
First Seen                    2013-06-20 19:05:49 BST
Last Seen                     2013-06-20 19:43:03 BST
Local ID                      3ffed360-feda-4cd4-a0ee-74dde4029547

Raw Audit Messages
type=AVC msg=audit(1371753783.648:8591): avc:  denied  { write } for  pid=17826 comm="clamd" name="clamd.amavisd" dev="tmpfs" ino=6169992 scontext=system_u:system_r:antivirus_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=dir


type=SYSCALL msg=audit(1371753783.648:8591): arch=x86_64 syscall=open success=no exit=EACCES a0=1dca280 a1=241 a2=1b6 a3=1 items=0 ppid=17824 pid=17826 auid=4294967295 uid=389 gid=388 euid=389 suid=389 fsuid=389 egid=388 sgid=388 fsgid=388 ses=4294967295 tty=(none) comm=clamd exe=/usr/sbin/clamd subj=system_u:system_r:antivirus_t:s0 key=(null)

Hash: /usr/sbin/amavi,antivirus_t,var_run_t,dir,write

Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.6-301.fc19.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-06-21 11:36:36 UTC
*** Bug 976564 has been marked as a duplicate of this bug. ***

Comment 2 Miroslav Grepl 2013-06-21 12:38:39 UTC
Ok, I see the same problem. I am adding fixes.

Comment 3 Fedora Update System 2013-06-26 20:19:10 UTC
selinux-policy-3.12.1-57.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-57.fc19

Comment 4 Fedora Update System 2013-06-27 15:49:33 UTC
Package selinux-policy-3.12.1-57.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-57.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-11846/selinux-policy-3.12.1-57.fc19
then log in and leave karma (feedback).

Comment 5 W Agtail 2013-06-30 19:04:44 UTC
i have applied the update and still see these messages:
Jun 30 19:57:49 f19 clamd.amavisd: Starting clamd.amavisd: LibClamAV Warning: RWX mapping denied: Can't allocate RWX Memory: Permission denied
Jun 30 19:57:49 f19 clamd.amavisd: LibClamAV Warning: Bytecode: disabling JIT because SELinux is preventing 'execmem' access.
Jun 30 19:57:49 f19 clamd.amavisd: Run  'setsebool -P clamd_use_jit on'.
Jun 30 19:57:49 f19 clamd.amavisd: [  OK  ]

> setsebool -P clamd_use_jit on
libsemanage.dbase_llist_set: record not found in the database
libsemanage.dbase_llist_set: could not set record value
Could not change boolean clamd_use_jit
Could not change policy booleans


amavisd-snmp also fails to start with:
SELinux is preventing /usr/bin/perl from write access on the sock_file /var/agentx/master.

*****  Plugin catchall_labels (83.8 confidence) suggests  ********************

If you want to allow perl to have write access on the master sock_file
Then you need to change the label on /var/agentx/master
Do
# semanage fcontext -a -t FILE_TYPE '/var/agentx/master'
where FILE_TYPE is one of the following: abrt_var_run_t, antivirus_db_t, antivirus_log_t, antivirus_tmp_t, antivirus_var_run_t, avahi_var_run_t, dccifd_var_run_t, devlog_t, init_var_run_t, lsassd_var_socket_t, mysqld_var_run_t, nscd_var_run_t, nslcd_var_run_t, pcscd_var_run_t, setrans_var_run_t, snmpd_var_lib_t, spamd_var_run_t, sssd_var_lib_t, syslogd_var_run_t, systemd_passwd_var_run_t, winbind_var_run_t. 
Then execute: 
restorecon -v '/var/agentx/master'


*****  Plugin catchall (17.1 confidence) suggests  ***************************

If you believe that perl should be allowed write access on the master 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:
# grep amavisd-snmp-su /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:antivirus_t:s0
Target Context                system_u:object_r:var_t:s0
Target Objects                /var/agentx/master [ sock_file ]
Source                        amavisd-snmp-su
Source Path                   /usr/bin/perl
Port                          <Unknown>
Host                          f19
Source RPM Packages           perl-5.16.3-265.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-57.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     f19
Platform                      Linux f19 3.9.6-301.fc19.x86_64 #1 SMP
                              Mon Jun 17 14:26:26 UTC 2013 x86_64 x86_64
Alert Count                   15992
First Seen                    2013-06-28 01:07:43 BST
Last Seen                     2013-06-30 20:04:01 BST
Local ID                      f21d4ed4-8301-4801-81ee-e34e9dbc74dc

Raw Audit Messages
type=AVC msg=audit(1372619041.679:45568): avc:  denied  { write } for  pid=21537 comm="amavisd-snmp-su" name="master" dev="dm-8" ino=260100 scontext=system_u:system_r:antivirus_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=sock_file


type=SYSCALL msg=audit(1372619041.679:45568): arch=x86_64 syscall=connect success=no exit=EACCES a0=8 a1=7ffffb194360 a2=6e a3=0 items=0 ppid=1 pid=21537 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=amavisd-snmp-su exe=/usr/bin/perl subj=system_u:system_r:antivirus_t:s0 key=(null)

Hash: amavisd-snmp-su,antivirus_t,var_t,sock_file,write

Comment 6 Miroslav Grepl 2013-07-01 11:57:18 UTC
What does

# rpm -qf /var/agentx

Comment 7 W Agtail 2013-07-01 12:20:17 UTC
> ls -ldZ /var/agentx/
drwx------. root root system_u:object_r:var_t:s0       /var/agentx/

> ls -lZ /var/agentx/master 
srwxr-xr-x. root root system_u:object_r:var_t:s0       /var/agentx/master

> rpm -qf /var/agentx/
file /var/agentx is not owned by any package

> rpm -qf /var/agentx/master 
file /var/agentx/master is not owned by any package

Comment 8 Daniel Walsh 2013-07-02 11:40:50 UTC
restorecon  -R -v /var/agentx

Comment 9 W Agtail 2013-07-02 15:29:39 UTC
I ran restorecon  -R -v /var/agentx and now have the following:

ls -ldZ /var/agentx/; ls -lZ /var/agentx/master 
drwx------. root root system_u:object_r:snmpd_var_lib_t:s0 /var/agentx/
srwxr-xr-x. root root system_u:object_r:snmpd_var_lib_t:s0 /var/agentx/master

and a different selinux error:

SELinux is preventing /usr/bin/perl (deleted) from connectto access on the unix_stream_socket /var/agentx/master.

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

If you believe that perl (deleted) should be allowed connectto access on the master unix_stream_socket 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:
# grep amavisd-snmp-su /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:antivirus_t:s0
Target Context                system_u:system_r:fsadm_t:s0
Target Objects                /var/agentx/master [ unix_stream_socket ]
Source                        amavisd-snmp-su
Source Path                   /usr/bin/perl (deleted)
Port                          <Unknown>
Host                          f19
Source RPM Packages           perl-5.16.3-265.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-57.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     f19
Platform                      Linux f19 3.9.6-301.fc19.x86_64 #1 SMP
                              Mon Jun 17 14:26:26 UTC 2013 x86_64 x86_64
Alert Count                   144
First Seen                    2013-06-28 17:04:05 BST
Last Seen                     2013-07-02 16:25:10 BST
Local ID                      e69f5777-d9b9-4d24-a444-ad76b0e27a47

Raw Audit Messages
type=AVC msg=audit(1372778710.524:64412): avc:  denied  { connectto } for  pid=3267 comm="amavisd-snmp-su" path="/var/agentx/master" scontext=system_u:system_r:antivirus_t:s0 tcontext=system_u:system_r:fsadm_t:s0 tclass=unix_stream_socket


type=SYSCALL msg=audit(1372778710.524:64412): arch=x86_64 syscall=connect success=no exit=EACCES a0=8 a1=7fff3a0bbbf0 a2=6e a3=0 items=1 ppid=1 pid=3267 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=amavisd-snmp-su exe=/usr/bin/perl subj=system_u:system_r:antivirus_t:s0 key=(null)

type=PATH msg=audit(1372778710.524:64412): item=0 name=(null) inode=260100 dev=fd:08 mode=0140755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:snmpd_var_lib_t:s0

Hash: amavisd-snmp-su,antivirus_t,fsadm_t,unix_stream_socket,connectto

Comment 10 Fedora Update System 2013-07-04 00:55:46 UTC
selinux-policy-3.12.1-57.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 W Agtail 2013-07-04 12:34:23 UTC
Re comment 9 above, I have installed selinux-policy as shown:
> rpm -q selinux-policy
selinux-policy-3.12.1-57.fc19.noarch

starting amavisd-snmp producing the following:

SELinux is preventing /usr/bin/perl (deleted) from connectto access on the unix_stream_socket /var/agentx/master.

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

If you believe that perl (deleted) should be allowed connectto access on the master unix_stream_socket 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:
# grep amavisd-snmp-su /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:antivirus_t:s0
Target Context                system_u:system_r:fsadm_t:s0
Target Objects                /var/agentx/master [ unix_stream_socket ]
Source                        amavisd-snmp-su
Source Path                   /usr/bin/perl (deleted)
Port                          <Unknown>
Host                          f19
Source RPM Packages           perl-5.16.3-265.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-57.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     f19
Platform                      Linux f19 3.9.6-301.fc19.x86_64 #1 SMP
                              Mon Jun 17 14:26:26 UTC 2013 x86_64 x86_64
Alert Count                   251
First Seen                    2013-06-28 17:04:05 BST
Last Seen                     2013-07-04 13:32:59 BST
Local ID                      e69f5777-d9b9-4d24-a444-ad76b0e27a47

Raw Audit Messages
type=AVC msg=audit(1372941179.123:73934): avc:  denied  { connectto } for  pid=25728 comm="amavisd-snmp-su" path="/var/agentx/master" scontext=system_u:system_r:antivirus_t:s0 tcontext=system_u:system_r:fsadm_t:s0 tclass=unix_stream_socket


type=SYSCALL msg=audit(1372941179.123:73934): arch=x86_64 syscall=connect success=no exit=EACCES a0=8 a1=7fffb5c2b0c0 a2=6e a3=0 items=1 ppid=1 pid=25728 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=amavisd-snmp-su exe=/usr/bin/perl subj=system_u:system_r:antivirus_t:s0 key=(null)

type=PATH msg=audit(1372941179.123:73934): item=0 name=(null) inode=260100 dev=fd:08 mode=0140755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:snmpd_var_lib_t:s0

Hash: amavisd-snmp-su,antivirus_t,fsadm_t,unix_stream_socket,connectto

Comment 12 Miroslav Grepl 2013-07-22 11:16:59 UTC
What does

# ps -efZ |grep fsadm

Comment 13 W Agtail 2013-07-30 19:20:35 UTC
I have reinstall Fedora 19 and am unable to reproduce this.


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