non-root doing "svc -o /service/root-owned-service"
Otavio Exel <[email protected]> Sat, 30 Mar 2019 12:16:34 -0300
| Newsgroups | gmane.comp.djb.syslog |
|---|---|
| Message-ID | <CANB5Hm6+PEY-Lk9jb=mDhXinEZ6q0ye4c04J=QAfzwYnC76_=g@mail.gmail.com> |
--000000000000021a9b05855147d8 Content-Type: text/plain; charset="UTF-8" Hello, my question is related to daemontools but not to multilog. let me know if I should ask this somewhere else. I have to start an important-process from inside a cgi script spawned by Apache. to avoid running important-process in the possibly-dirty environment of Apache I usually: - in the cgi scipt: create a flag file somewhere - wait for a minute-by-minute cron job to notice it and start important-process ...and I hate this solution!!! so I am trying to run important-process under svscan / supervise: - /service/important-process would be "normally down" - the cgi script would issue a mere svc -o /service/important-process now in order to allow www-data to control the service I did (what seemed to me) the bare minimum to give it write access to supervise/control like that: - chgrp www-data supervise - chmod g+x supervise - chgrp www-data supervise/control - chmod g+w supervise/control and it did work! now... beeing the lousy unix admin that I am, before going ahead I would like to ask you some questions: 1. do you see any further security implications? (apart from the fact that now www-data can control the service) 2. would you suggest a better/safer way to do that? thank you! -- Otavio Exel /<\oo/>\ [email protected] <[email protected]> --000000000000021a9b05855147d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,he= lvetica,sans-serif"><div dir=3D"ltr" style=3D"font-family:Arial,Helvetica,s= ans-serif"><div class=3D"gmail_default" style=3D"font-family:arial,helvetic= a,sans-serif">Hello,</div><div class=3D"gmail_default" style=3D"font-family= :arial,helvetica,sans-serif"><br></div><div class=3D"gmail_default" style= =3D"font-family:arial,helvetica,sans-serif">my question is related to daemo= ntools but not to multilog.<br>let me know if I should ask this somewhere e= lse.</div><div><br></div><div><div class=3D"gmail_default" style=3D"font-fa= mily:arial,helvetica,sans-serif">I have to start an important-process from = inside a cgi script spawned by Apache.</div></div></div><span style=3D"font= -family:Arial,Helvetica,sans-serif">to avoid running important-process in t= he possibly-dirty environment of Apache I usually:</span><br style=3D"font-= family:Arial,Helvetica,sans-serif"><span class=3D"gmail_default">-=C2=A0</s= pan>in the cgi scipt<span class=3D"gmail_default">:</span>=C2=A0create a fl= ag file somewhere<br style=3D"font-family:Arial,Helvetica,sans-serif"><span= class=3D"gmail_default">-=C2=A0</span>wait for a minute-by-minute cron job= to notice it and=C2=A0<span class=3D"gmail_default">start</span>=C2=A0impo= rtant-process<br style=3D"font-family:Arial,Helvetica,sans-serif"><span cla= ss=3D"gmail_default">...</span><span style=3D"font-family:Arial,Helvetica,s= ans-serif">and I hate this solution!!!</span><div style=3D"font-family:Aria= l,Helvetica,sans-serif"><br>so I am trying to run important-process under s= vscan / supervise:<br><span style=3D"font-family:arial,helvetica,sans-serif= "><span class=3D"gmail_default">-=C2=A0</span>/</span><font face=3D"monospa= ce, monospace">service/important-process</font><font face=3D"arial, helveti= ca, sans-serif">=C2=A0would be "normally down"</font><br><span st= yle=3D"font-family:arial,helvetica,sans-serif"><span class=3D"gmail_default= ">-=C2=A0</span>the cgi script would issue a mere</span><font face=3D"monos= pace, monospace">=C2=A0svc -o /service/important-process</font><br><br></di= v><div style=3D"font-family:Arial,Helvetica,sans-serif">now in order to all= ow www-data to control the service I did=C2=A0<span class=3D"gmail_default"= style=3D"font-family:arial,helvetica,sans-serif">(what seemed to me)=C2=A0= </span>the bare minimum to give=C2=A0<span class=3D"gmail_default" style=3D= "font-family:arial,helvetica,sans-serif">it=C2=A0</span>write access to<fon= t face=3D"monospace, monospace">=C2=A0supervise/control</font></div><div st= yle=3D"font-family:Arial,Helvetica,sans-serif">like that:<br><span style=3D= "font-family:monospace,monospace"><span class=3D"gmail_default" style=3D"fo= nt-family:arial,helvetica,sans-serif">-=C2=A0</span>chgrp www-data supervis= e</span><br><span style=3D"font-family:monospace,monospace"><span class=3D"= gmail_default" style=3D"font-family:arial,helvetica,sans-serif">-=C2=A0</sp= an>chmod g+x supervise</span><br><span style=3D"font-family:monospace,monos= pace"><span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sa= ns-serif">-=C2=A0</span>chgrp www-data supervise/control</span><br><span st= yle=3D"font-family:monospace,monospace"><span class=3D"gmail_default" style= =3D"font-family:arial,helvetica,sans-serif">-=C2=A0</span>chmod g+w supervi= se/control</span></div><div style=3D"font-family:Arial,Helvetica,sans-serif= "><font face=3D"monospace, monospace"><br></font>and it did work!</div><div= style=3D"font-family:Arial,Helvetica,sans-serif"><br></div><div style=3D"f= ont-family:Arial,Helvetica,sans-serif"><span class=3D"gmail_default" style= =3D"font-family:arial,helvetica,sans-serif">now... beeing the lousy unix ad= min that I am,=C2=A0</span>before go<span class=3D"gmail_default" style=3D"= font-family:arial,helvetica,sans-serif">ing</span>=C2=A0ahead I would like = to ask you some questions:<div><div dir=3D"ltr"><div class=3D"gmail_default= "><ol><li style=3D"margin-left:15px">do you see any further security implic= ations?<br>(apart from the fact that now<font face=3D"monospace, monospace"= >=C2=A0www-data=C2=A0</font>can control the service)<br></li><li style=3D"m= argin-left:15px">would you suggest a better/safer way to do that?</li></ol>= </div><div class=3D"gmail_default">thank you!</div></div></div></div></div>= <div><br></div>-- <br><div dir=3D"ltr" class=3D"gmail_signature" data-smart= mail=3D"gmail_signature"><div dir=3D"ltr">Otavio Exel /<\oo/>\=C2=A0<= a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= m.br</a><br></div></div></div> --000000000000021a9b05855147d8--