Re: Restart BIND from a php script
| From: | pan | Date: | Mon, 16 Sep 2002 02:35:15 +0000 |
| Subject: | Re: Restart BIND from a php script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116484@lists.php.net to get a copy of this message | ||
Subject: [PHP] Restart BIND from a php script
> Not sure how to go about this. I'd like a way to restart bind from a
php
> script I have.
>
> The biggest problems I have are permission related. Calling exec(),
> system() or using popen() all fail due to the permissions. I tried
> making a suid bash script that did the same thing and this failed too.
> Seems like it failed to set itself suid root while being called from
the
> php script.
>
> Finally I tried make a suid C prog to restart bind and then calling
that
> from a php script but that fails too.
>
> Any ideas?
>
Considering that you don't want world+dog able to independently
supervise the running of any daemon you might:
Write a cron job that examines a php writeable flat file for
a message indicating a named.reload (or ndc restart) is called
for. Script into that cron job all the security you can (source check,
detect accompanying hash, etc.) I.e., let your system supervise
a bind restart request from "outside". And let your cronned
script do the restarts from whatever shell script or c code
you want. Only let your .php yell 'Fire'; make your checking script
'decide' to pull the trigger.
Alternative - script checks a db field - (harder to write from shell
or c )
consider .htaccess plus cookie checks too and .htpasswd
hope this helps