Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
DescriptionJan Pazdziora (Red Hat)
2018-02-01 12:08:16 UTC
Description of problem:
In program which is run as systemd service in container, we try to write to stdout. For some reasons, the bash script is actually doing equivalent of
echo Test > /dev/stdout
It fails.
Version-Release number of selected component (if applicable):
docker-1.13.1-1.gitddee18e.el7.x86_64
selinux-policy-3.13.1-186.el7.noarch
container-selinux-2.40-1.gitdf0c335.el7.noarch
How reproducible:
Deterministic.
Steps to Reproduce:
1. Have Dockerfile:
FROM rhel7
ADD test-service /usr/bin/
ADD test-service.service /etc/systemd/system/
RUN systemctl enable test-service
2. Have test-service:
#!/bin/bash
echo This is test service.
ls -la /dev/std* /dev/console
( echo This is test service with stdout. ) > /dev/stdout
3. Run # chmod a+x test-service
4. Have test-service.service:
[Unit]
Description=Test proc AVC denials
[Service]
Type=oneshot
ExecStart=/usr/bin/test-service
[Install]
WantedBy=multi-user.target
5. Build container: docker build -t systemd .
6. Run the container: docker run --name systemd systemd /usr/sbin/init
7. Check audit.log.
8. From another terminal, run: docker exec systemd journalctl _COMM=test-service -l
Actual results:
type=AVC msg=audit(1517486803.253:7237): avc: denied { sendto } for pid=28004 comm="test-service" path="socket:[1487457]" dev="sockfs" ino=1487457 scontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tcontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tclass=unix_stream_socket
type=AVC msg=audit(1517486803.253:7238): avc: denied { sendto } for pid=28004 comm="test-service" path="socket:[1487457]" dev="sockfs" ino=1487457 scontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tcontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tclass=unix_stream_socket
-- Logs begin at Thu 2018-02-01 12:06:43 UTC, end at Thu 2018-02-01 12:06:43 UTC. --
Feb 01 12:06:43 f65e66d72159 test-service[26]: This is test service.
Feb 01 12:06:43 f65e66d72159 test-service[26]: ls: cannot access /dev/console: No such file or directory
Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stderr -> /proc/self/fd/2
Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdin -> /proc/self/fd/0
Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdout -> /proc/self/fd/1
Feb 01 12:06:43 f65e66d72159 test-service[26]: /usr/bin/test-service: line 5: /dev/stdout: Permission denied
Expected results:
No AVC denials.
-- Logs begin at Thu 2018-02-01 12:06:43 UTC, end at Thu 2018-02-01 12:06:43 UTC. --
Feb 01 12:06:43 f65e66d72159 test-service[26]: This is test service.
Feb 01 12:06:43 f65e66d72159 test-service[26]: ls: cannot access /dev/console: No such file or directory
Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stderr -> /proc/self/fd/2
Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdin -> /proc/self/fd/0
Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdout -> /proc/self/fd/1
Feb 01 12:06:43 f65e66d72159 test-service[26]: This is test service with stdout.
Additional info:
Comment 2Jan Pazdziora (Red Hat)
2018-02-01 12:16:57 UTC
On Fedora 27, things fail as well but the AVC denial is different and the error is about No such device or address, not Permission denied -- see bug 1540963.
Comment 4Jan Pazdziora (Red Hat)
2018-02-23 14:41:33 UTC
Running in permissive changes the error message in journal from
Feb 23 14:39:19 1c5991a7a4e8 test-service[28]: /usr/bin/test-service: line 4: /dev/stdout: Permission denied
to
Feb 23 14:40:02 21b99de0e44d test-service[26]: /usr/bin/test-service: line 4: /dev/stdout: No such device or address
but things still do not work.
Tested with
docker-1.13.1-53.git774336d.el7.x86_64
container-selinux-2.42-1.gitad8f0f7.el7.noarch
We have no plans to ship another version of Docker at this time. RHEL7 is in final support stages where only security fixes will get released. Customers should move to use Podman which is available starting in RHEL 7.6.
Description of problem: In program which is run as systemd service in container, we try to write to stdout. For some reasons, the bash script is actually doing equivalent of echo Test > /dev/stdout It fails. Version-Release number of selected component (if applicable): docker-1.13.1-1.gitddee18e.el7.x86_64 selinux-policy-3.13.1-186.el7.noarch container-selinux-2.40-1.gitdf0c335.el7.noarch How reproducible: Deterministic. Steps to Reproduce: 1. Have Dockerfile: FROM rhel7 ADD test-service /usr/bin/ ADD test-service.service /etc/systemd/system/ RUN systemctl enable test-service 2. Have test-service: #!/bin/bash echo This is test service. ls -la /dev/std* /dev/console ( echo This is test service with stdout. ) > /dev/stdout 3. Run # chmod a+x test-service 4. Have test-service.service: [Unit] Description=Test proc AVC denials [Service] Type=oneshot ExecStart=/usr/bin/test-service [Install] WantedBy=multi-user.target 5. Build container: docker build -t systemd . 6. Run the container: docker run --name systemd systemd /usr/sbin/init 7. Check audit.log. 8. From another terminal, run: docker exec systemd journalctl _COMM=test-service -l Actual results: type=AVC msg=audit(1517486803.253:7237): avc: denied { sendto } for pid=28004 comm="test-service" path="socket:[1487457]" dev="sockfs" ino=1487457 scontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tcontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tclass=unix_stream_socket type=AVC msg=audit(1517486803.253:7238): avc: denied { sendto } for pid=28004 comm="test-service" path="socket:[1487457]" dev="sockfs" ino=1487457 scontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tcontext=system_u:system_r:svirt_lxc_net_t:s0:c734,c741 tclass=unix_stream_socket -- Logs begin at Thu 2018-02-01 12:06:43 UTC, end at Thu 2018-02-01 12:06:43 UTC. -- Feb 01 12:06:43 f65e66d72159 test-service[26]: This is test service. Feb 01 12:06:43 f65e66d72159 test-service[26]: ls: cannot access /dev/console: No such file or directory Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stderr -> /proc/self/fd/2 Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdin -> /proc/self/fd/0 Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdout -> /proc/self/fd/1 Feb 01 12:06:43 f65e66d72159 test-service[26]: /usr/bin/test-service: line 5: /dev/stdout: Permission denied Expected results: No AVC denials. -- Logs begin at Thu 2018-02-01 12:06:43 UTC, end at Thu 2018-02-01 12:06:43 UTC. -- Feb 01 12:06:43 f65e66d72159 test-service[26]: This is test service. Feb 01 12:06:43 f65e66d72159 test-service[26]: ls: cannot access /dev/console: No such file or directory Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stderr -> /proc/self/fd/2 Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdin -> /proc/self/fd/0 Feb 01 12:06:43 f65e66d72159 test-service[26]: lrwxrwxrwx. 1 root root 15 Feb 1 12:06 /dev/stdout -> /proc/self/fd/1 Feb 01 12:06:43 f65e66d72159 test-service[26]: This is test service with stdout. Additional info: