Yup -- that's the right fix, methinks.<div><br></div><div>Thanks for helping look at that!</div><div><br></div><div>I'll sync this wisdom into git and github.</div><div><br></div><div><br></div><div>I was cleaning this all up with the groups and everything so that I can get auto-generate Asterisk IAX2 user accounts for soft phones. If you have a door code, you would then get a way to call into Noisebridge phones, as we don't currently have a DID.</div>
<div><br></div><div>Cheers,</div><div>jof<br><div><br><div class="gmail_quote">On Tue, Jan 22, 2013 at 12:23 PM, Michael C. Toren <span dir="ltr"><<a href="mailto:mct@toren.net" target="_blank">mct@toren.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Jan 22, 2013 at 12:01:01PM -0800, Michael C. Toren wrote:<br>
> (We could write a silly little C program to run as root that would call<br>
> setgid(), setgroups(), and setuid() before exec()ing baron, but I suspect<br>
> there's some standard-ish utility that does this already which we could<br>
> utilize.)<br>
<br>
</div>I changed /etc/init/baron.conf to:<br>
<br>
        # Use su(1) to set our desired UID/GID rather than upstart's setuid/setgid<br>
        # stanzas, because upstart only sets the primary groups, ignoring all of the<br>
        # supplementary groups.  We need the baron process to be a member of both the<br>
        # barons group to read the codes.txt file, the dialout group to read from the<br>
        # TTY.<br>
        setuid root<br>
        exec su -c 'exec /usr/local/share/baron/noisebridge-baron/baron.py --codefile /usr/local/share/baron/codes.txt --port /dev/ttyS5 --logfile /usr/local/share/baron/baron.log' baron<br>
<br>
This works. But because su does a fork() before exec(), there are two<br>
processes in the process group:<br>
<br>
        baron    11460  0.3  0.0  70824  2016 ?        Ss   12:16   0:00 su -c exec /usr/local/share/baron/noisebridge-baron/baron.py --codefile /usr/local/share/baron/codes.txt --port /dev/ttyS5 --logfile /usr/local/share/baron/baron.log baron<br>

        baron    11467  6.3  0.4  46040  9600 ?        S    12:16   0:00  \_ /usr/bin/python /usr/local/share/baron/noisebridge-baron/baron.py --codefile /usr/local/share/baron/codes.txt --port /dev/ttyS5 --logfile /usr/local/share/baron/baron.log<br>

<br>
There doesn't seem to be any negative impact of this, though, and upstart<br>
is still able to stop/restart the service just fine.<br>
<span class="HOEnZb"><font color="#888888"><br>
-mct<br>
</font></span></blockquote></div><br></div></div>