Auteur: W B Hacker Date: À: exim-users Sujet: Re: [exim] exim php shell_exec question
Steffen Heil wrote:
> Hi
>
>
>>$mailqueue = shell_exec("exim -bpc");
>>exim: permission denied
>>Any ideas how I could get round this?
>
>
> A way around this would be:
> install sudo, write the command above to a script, set root execution rights
> for the script to everyone, call "sudo script" from php.
>
> But I am not really sure, you wanna do this.
> Do you really think it is a good idea to have a web server execute something
> as root?
>
> Another way would be to have a cron job that outlput the needed information
> into a file and you read this file from php.
>
> Advantages:
> - more secure
> - less cpu time needed with many page hits
>
> Disadvantages:
> - more cpu time needed with few page hits
> - no current value, updated only after some time
>
> Regards,
> Steffen
>
As Exim itself can 'facedance', UID:GID storage location, and
dir/file perms-wise, perhaps it could call up, then write the
info to a place from whence a patchy httpd could serve it?
Or trigger it only when you need to by sending a special e-mail
to it - return the data via e-mail or post it to a web page.
Else 'monitord', which can execute a script of your choosing, on
very short time intervals.
Either:
- give 'monitord' a non-existent process to monitor and it acts
like a nano-chron but keeps out of chron's way,
- or have it watch for a file or flag you could set from the
web, pull the info on demand, erase the file or reset the flag,
and cycle.
That's also a way to give luserland the ability to restart
things w/o a shell account.