Stuart Henderson <stu <at> spacehopper.org> writes: > > On 2009-01-04, patrick keshishian <sidster <at> boxsoft.com> wrote: > > Hi, > > > > I'm curious about why privileges are revoked before executing > > ip-{up,down} scripts? > > > > "ROUTING" section of pppd(8) says: > > > > +--- pppd(8) > > | When IPCP negotiation is completed successfully, > > | pppd will inform the kernel of the local and remote > > | IP addresses ... to create a host route to the remote > > | end ... which will enable the peers to exchange IP > > | packets. Communication with other machines generally > > | requires further modification to routing tables. In > > | most cases the defaultroute [is] sufficient for this, > > | but in some cases further intervention is required. > > | The /etc/ppp/ip-up script can be used for this. > > +- > > > > However, if ip-up is to change the routing table it will require > > root privilege. > > > > Am I missing something?
> Looks like a bug to me. The actual behaviour is not what is documented > in the SCRIPTS section of the manual "The scripts are executed as root > (with the real and effective user ID set to 0)". > > Upstream (now hosted at ppp.samba.org) changed this to setuid(0), we > haven't synced since then. > > - (void) chdir ("/"); /* no current directory. */ > - setuid(geteuid()); > + (void) chdir ("/"); /* no current directory. */ > + setuid(0); /* set real UID = root */ > > http://git.ozlabs.org/?p=ppp.git;a=commit;h=a00baab063b349591289cbde22ab40cf80b8f0af > > We changed to use setresuid() rather than setuid(), but this didn't change > behaviour here. I guess many people will run pppd as root so they won't > notice the problem (afaict, it only happens if you start as a non-root > member of the group "network"). As discussed (off-line) this was changed in -r1.45 by d...@. Since no one else is chiming in, I'm asking if someone will looking into updating this, or was there a valid reason why it was decided to prevent scripts to run with root privilege in our local copy of pppd? I'm not a heavy pppd user so I can't test this patch thoroughly. But if there are not glaring issues with running the scripts from pppd (ip-up, ip-down, ...) with uid set to 0 I can give it a go. --patrick