|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
PHP+chroot+mail()+mini_sendmail
From: Jolan Luff (jolan
protection.cx)
Date: Wed Oct 13 2004 - 03:13:39 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I wrote the guide below since a lot of people have problems figuring
this out. I was going to include it in the documentation for the
mini_sendmail port but maybe it would fit better in PHP itself.
Also, I'm curious if anyone uses mini_sendmail for anything other
than chroot'd apache. If not, I'll ditch the dynamically linked binary
which goes into ${PREFIX}/bin.
BTW, are there any alternative methods (lighter or not) for making
mail() work in chroot that are worth mentioning?
Please comment, send wording/grammar diffs my way, etc.
$OpenBSD$
Author: Jolan Luff <jolan
openbsd.org>
First things first, we need to install the chroot subpackage of
mini_sendmail if you have not done so already. This will put a
statically linked mini_sendmail binary into a location reachable by
Apache when it is under chroot(2), /var/www/bin/mini_sendmail to be
precise.
Next, we need to tell PHP about our fake sendmail binary. The php.ini
examples leave the sendmail_path directive commented out. We need to
change it to point to mini_sendmail:
;sendmail_path =
sendmail_path = "/bin/mini_sendmail -t -i"
PHP executes mini_sendmail by using the popen(3) function.
Unfortunately, this means we are required to copy /bin/sh into the
Apache chroot area:
# cp -p /bin/sh /var/www/bin/sh
If everything has been performed correctly, after a stop and restart of
Apache (if it is running), we should now be able to utilize the PHP
mail() function.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]