Bug 1273290 - amavisd-snmp-subagent runs as init_t on RHEL-7.2
amavisd-snmp-subagent runs as init_t on RHEL-7.2
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy (Show other bugs)
7.2
All Linux
low Severity low
: rc
: ---
Assigned To: Miroslav Grepl
Milos Malik
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-20 03:17 EDT by Milos Malik
Modified: 2016-04-28 08:52 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-28 08:52:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Milos Malik 2015-10-20 03:17:52 EDT
Description of problem:
 * the amavisd* packages come from EPEL
 * amavisd-snmp-subagent runs as antivirus_t on RHEL-6.7

Version-Release number of selected component (if applicable):
amavisd-new-2.10.1-4.el7.noarch
amavisd-new-snmp-2.10.1-4.el7.noarch
selinux-policy-3.13.1-60.el7.noarch
selinux-policy-devel-3.13.1-60.el7.noarch
selinux-policy-doc-3.13.1-60.el7.noarch
selinux-policy-minimum-3.13.1-60.el7.noarch
selinux-policy-mls-3.13.1-60.el7.noarch
selinux-policy-sandbox-3.13.1-60.el7.noarch
selinux-policy-targeted-3.13.1-60.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. get a RHEL-7.2 machine with targeted policy
2. install amavis* packages
3. service amavisd-snmp start
4. ps -efZ | grep amavis

Actual results:
system_u:system_r:init_t:s0     amavis   13275     1  0 09:14 ?        00:00:00 /usr/bin/perl -T /usr/sbin/amavisd-snmp-subagent -D /var/spool/amavisd/db -P /var/run/amavisd/amavisd-snmp-subagent.pid

Expected results:
system_u:system_r:antivirus_t:s0     amavis   13275     1  0 09:14 ?        00:00:00 /usr/bin/perl -T /usr/sbin/amavisd-snmp-subagent -D /var/spool/amavisd/db -P /var/run/amavisd/amavisd-snmp-subagent.pid

Additional information:
# cat /usr/lib/systemd/system/amavisd-snmp.service 
[Unit]
Description=Exports amavisd SNMP data
After=network.target amavisd.service

[Service]
Type=forking
User=amavis
Group=amavis
PIDFile=/var/run/amavisd/amavisd-snmp-subagent.pid
ExecStart=/usr/sbin/amavisd-snmp-subagent -D /var/spool/amavisd/db -P /var/run/amavisd/amavisd-snmp-subagent.pid
Restart=on-failure
PrivateTmp=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
# ls -Z /usr/sbin/amavisd-snmp-subagent
-rwxr-xr-x. root root system_u:object_r:antivirus_exec_t:s0 /usr/sbin/amavisd-snmp-subagent
# sesearch -s init_t -t antivirus_exec_t -T
Found 1 semantic te rules:
   type_transition init_t antivirus_exec_t : process antivirus_t; 

# 

But it still runs as init_t.
Comment 2 Milos Malik 2016-02-01 09:27:49 EST
It is a perl script:

# head -n 4 /usr/sbin/amavisd-snmp-subagent 
#!/usr/bin/perl -T

#------------------------------------------------------------------------------
# This program implements a SNMP AgentX (RFC 2741) subagent for amavisd-new.
#
Comment 3 Miroslav Grepl 2016-02-12 03:13:57 EST
How is /usr/sbin/amavisd-snmp-subagent labeled?
Comment 4 Milos Malik 2016-02-12 04:11:50 EST
# matchpathcon /usr/sbin/amavisd-snmp-subagent
/usr/sbin/amavisd-snmp-subagent	system_u:object_r:antivirus_exec_t:s0
# ls -Z /usr/sbin/amavisd-snmp-subagent
-rwxr-xr-x. root root system_u:object_r:antivirus_exec_t:s0 /usr/sbin/amavisd-snmp-subagent
# ls -l /usr/sbin/amavisd-snmp-subagent
-rwxr-xr-x. 1 root root 54172 Jan 27  2014 /usr/sbin/amavisd-snmp-subagent
# grep ExecStart= /usr/lib/systemd/system/amavisd-snmp.service 
ExecStart=/usr/sbin/amavisd-snmp-subagent -D /var/spool/amavisd/db -P /var/run/amavisd/amavisd-snmp-subagent.pid
#
Comment 5 Miroslav Grepl 2016-02-25 11:05:39 EST
OK it looks we will need to have a helper script here, correct?

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