RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1273290 - amavisd-snmp-subagent runs as init_t on RHEL-7.2
Summary: amavisd-snmp-subagent runs as init_t on RHEL-7.2
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-20 07:17 UTC by Milos Malik
Modified: 2016-04-28 12:52 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-28 12:52:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Milos Malik 2015-10-20 07:17:52 UTC
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 14:27:49 UTC
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 08:13:57 UTC
How is /usr/sbin/amavisd-snmp-subagent labeled?

Comment 4 Milos Malik 2016-02-12 09:11:50 UTC
# 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 16:05:39 UTC
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.