RE: Is it possible to restart Windows Apache (service) on a PHP script?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What we do is setup 'sudo' to run certain commands (or a shell/ruby script
for example), then have PHP/Apache exec() the script via sudo (or use a DBUS
call to a 'root' enabled ruby daemon), which then restarts apache or
whatever we want.

Be VERY careful with the way you do this or you can give crackers all kinds
of ways to cause you pain.


For example:

root@daevid111:/etc# cat /etc/sudoers
        Cmnd_Alias CHMOD = /bin/chmod
        Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown

        root            ALL=(ALL) ALL
        www-data        ALL=NOPASSWD: /bin/date, /sbin/hwclock,
                                REBOOT,  /usr/bin/dpkg, /usr/sbin/chpasswd,
                                /usr/bin/passwd, /usr/sbin/srvwatch,
                                /usr/sbin/srvtalk

Then in the PHP web page:

        exec("/usr/bin/sudo /sbin/reboot");


D.Vin

"Voice or no voice, the people can alway be brought to the bidding of the
leaders. This is easy. All you have to do is tell them that they are being
attacked, and denounce the pacifists for a lack of patriotism and exposing
the country to danger. It works the same in every country." --Hermann
Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII

Sound like G.W.Bush?



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux