Bug 741023

Summary: Socket-activated services with TCPWrapName ignore setenv in /etc/hosts.allow
Product: [openSUSE] openSUSE 12.1 Reporter: Peter Conrad <conrad-novell.com>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: pgajdos
Version: Final   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Peter Conrad 2012-01-12 13:59:31 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.14 (KHTML, like Gecko) Chrome/18.0.972.0 Safari/535.14 SUSE/18.0.972.0

The manpage systemd.exec implies that specifying a TCPWrapName uses /etc/hosts.{allow,deny} in the same way as tcpd(8). However, this is not the case: when /etc/hosts.allow is used for setting environment variables, these variables are not handed over to the executed program by systemd.

---Example env.socket---
[Unit]
Description=Network socket for incoming env connections

[Install]
WantedBy=sockets.target

[Socket]
ListenStream=13131
Accept=true
---/Example---

---Example env@.service---
[Unit]
Description=test daemon
After=local-fs.target

[Service]
Environment=PATH=/bin:/usr/bin:/sbin:/usr/sbin
WorkingDirectory=/tmp
#ExecStart=@/usr/sbin/tcpd /usr/bin/env
ExecStart=/usr/bin/env

StandardInput=socket
StandardOutput=inherit
StandardError=syslog

TCPWrapName=env
---/Example---

---Example /etc/hosts.allow---
env : 127.0.0.1 : setenv TEST working
---/Example---




Reproducible: Always

Steps to Reproduce:
1. Create env.socket, env@.service and /etc/hosts.allow as above
2. netcat 127.0.0.1 13131

Actual Results:  
The output does not contain "TEST=working"

Expected Results:  
The expected result can be seen by activating the out-commented ExecStart line in env@.service: the output contains the line
TEST=working

As can be seen by the example, explicitly running /usr/sbin/tcpd in ExecStart is an (ugly) workaround for the problem.
Comment 1 Petr Gajdos 2012-01-23 07:35:59 UTC
Frederic, it's yours?
Comment 2 Frederic Crozat 2012-01-23 10:11:21 UTC
yes, sounds like a systemd issue, either in the manpage (I'm not sure systemd is supposed to handle the "shell" part of /etc/hosts.*) or in the implementation. I'd suggest to report upstream directly.
Comment 3 Peter Conrad 2012-01-23 19:46:58 UTC
Posted upstream: https://bugs.freedesktop.org/show_bug.cgi?id=45143
Comment 4 Bernhard Wiedemann 2012-02-20 13:00:56 UTC
This is an autogenerated message for OBS integration:
This bug (741023) was mentioned in
https://build.opensuse.org/request/show/106032 12.1 / systemd
Comment 5 Frederic Crozat 2012-03-14 16:43:47 UTC
update released