Bug 808

Summary: iolog terminate process sent to background
Product: Sudo Reporter: Daniele Palumbo <daniele>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED DUPLICATE    
Severity: normal CC: daniele
Priority: low    
Version: 1.8.21   
Hardware: PC   
OS: Linux   
Attachments: replicator 1/2
replicator 2/2

Description Daniele Palumbo 2017-11-21 04:53:38 MST
Created attachment 502 [details]
replicator 1/2

With log_output set, a process sent to background may fail to start.

I was able to replicate the bug with the latest sudo version available.

Adding a sleep after the background process start, the process does start.

daniele@build-jessie-amd64:~$ ./replicator.sh 
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, log_output, log_output, maxseq=150, iolog_dir=/var/log/sudo-io/%{user}, !requiretty
/usr/bin/iperf3 
running KO test
no sleep
iperf3 KO
iperf3: no process found
running OK test
sleeping 3s
iperf3 KO
iperf3: no process found
daniele@build-jessie-amd64:~$ 

To replicate the problem please just deploy the two script in the same folder and run ./replicator.sh.
Ensure that the user (even root) may run 
sudo ./iperf-daemon.sh
Comment 1 Daniele Palumbo 2017-11-21 04:54:10 MST
Created attachment 503 [details]
replicator 2/2
Comment 2 Daniele Palumbo 2017-11-21 04:55:12 MST
Forgot to mention that i have used the latest bits from sudo.ws.

daniele@build-jessie-amd64:~$ sudo -V
Sudo version 1.8.21p2
Sudoers policy plugin version 1.8.21p2
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.21p2
daniele@build-jessie-amd64:~$
Comment 3 Todd C. Miller 2017-11-21 10:34:37 MST
When I/O logging is enabled, if the process run by sudo exits, the pseudo-tty will be closed.  As a result of this, any process with the tty open will receive SIGHUP.

In your example, when the iperf-daemon.sh scripts exits, iperf3 receives SIGHUP and exits.  If you run iperf3 like this:

    iperf3 -s </dev/null >/dev/null 2>&1 &

or better yet:

    iperf3 -s -D

you will not have this problem.
Comment 4 Todd C. Miller 2017-12-01 14:08:20 MST

*** This bug has been marked as a duplicate of bug 502 ***