Bluehost.com Web Hosting $6.95

Problem with mail() function and exec

This is a discussion on Problem with mail() function and exec within the PHP General forums, part of the PHP Programming Forums category; -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I have a great problem. I hava an apache 1.3.28 + php ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-27-2003
Th3 Th1nk3r
 
Posts: n/a
Default Problem with mail() function and exec

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I have a great problem. I hava an apache 1.3.28 + php 4.3.3 installation into
a chroot jail in my Linux box. Into the jail I have installed postfix (with
his sendmail executable) and I can send mails with it (I run it like a chroot
user to test it). But, with a simple script like this doesn't work:

<?php
if(mail("th1nk@blacklord.net","hello world!!","Msg"))
echo "OK";
else
echo "Opsss!!!";
?>

If I run apache from outside the jail, the scripts runs perfectly and send the
mail, but inside it doesn't send anything (php don't exec the program
sendmail).
I have the same config in and out the jail, the execs have root like owner (I
have test it with apache like owner, but doesn't work) I have test it with
safe_mode on and off, with safe_mode_exec_dir and sendmail_path, but don't
work.

The run functions like exec, don't work. I'm curious because don't work inside
and outside the jaul, but the mail function works outside. I have test it
with a script that works in an old install of php.

The mail perhaps could function with sockets and contacting the localhost smtp
server, but I continu with the exec problem. I think of it like a security
problem, because I don't know why is failing.

Any Idea? suggestions?

sorry for my bad english, and thanks ;)
Byez
- --
- -----------------------------------------------------------
Jabber ID: th1nk3r@jabber.org
GNU/Linux User# 266578
http://www.blacklord.net/

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/CM d-- s: a? C++++ UL+++ P >++ L+++ E--- W+++ N-- o-- K--- w--- O M- V-
PS+++ PE-- Y++ PGP+++ t+ 5+ X+++ R+++ tv-- b++ DI++ D++ G e+++ h r++ y+
------END GEEK CODE BLOCK------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/xU2pXlg6KvYpupERAlDrAJ9Wc7UW7gEj8dJViFQG1g38lOcV+g CgkrIg
4Ysp0QFLZruAWlWh4pBs9Qs=
=RiOv
-----END PGP SIGNATURE-----

Reply With Quote
  #2 (permalink)  
Old 11-27-2003
Rasmus Lerdorf
 
Posts: n/a
Default Re: [PHP] Problem with mail() function and exec

Do you have /bin/sh inside your jail?

On Thu, 27 Nov 2003, th3 th1nk3r wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
> I have a great problem. I hava an apache 1.3.28 + php 4.3.3 installation into
> a chroot jail in my Linux box. Into the jail I have installed postfix (with
> his sendmail executable) and I can send mails with it (I run it like a chroot
> user to test it). But, with a simple script like this doesn't work:
>
> <?php
> if(mail("th1nk@blacklord.net","hello world!!","Msg"))
> echo "OK";
> else
> echo "Opsss!!!";
> ?>
>
> If I run apache from outside the jail, the scripts runs perfectly and send the
> mail, but inside it doesn't send anything (php don't exec the program
> sendmail).
> I have the same config in and out the jail, the execs have root like owner (I
> have test it with apache like owner, but doesn't work) I have test it with
> safe_mode on and off, with safe_mode_exec_dir and sendmail_path, but don't
> work.
>
> The run functions like exec, don't work. I'm curious because don't work inside
> and outside the jaul, but the mail function works outside. I have test it
> with a script that works in an old install of php.
>
> The mail perhaps could function with sockets and contacting the localhost smtp
> server, but I continu with the exec problem. I think of it like a security
> problem, because I don't know why is failing.
>
> Any Idea? suggestions?
>
> sorry for my bad english, and thanks ;)
> Byez
> - --
> - -----------------------------------------------------------
> Jabber ID: th1nk3r@jabber.org
> GNU/Linux User# 266578
> http://www.blacklord.net/
>
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GCS/CM d-- s: a? C++++ UL+++ P >++ L+++ E--- W+++ N-- o-- K--- w--- O M- V-
> PS+++ PE-- Y++ PGP+++ t+ 5+ X+++ R+++ tv-- b++ DI++ D++ G e+++ h r++ y+
> ------END GEEK CODE BLOCK------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.2 (GNU/Linux)
>
> iD8DBQE/xU2pXlg6KvYpupERAlDrAJ9Wc7UW7gEj8dJViFQG1g38lOcV+g CgkrIg
> 4Ysp0QFLZruAWlWh4pBs9Qs=
> =RiOv
> -----END PGP SIGNATURE-----
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply With Quote
  #3 (permalink)  
Old 11-27-2003
Th3 Th1nk3r
 
Posts: n/a
Default Re: [PHP] Problem with mail() function and exec

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stardate Thursday 27 November 2003 02:08
Capt. Lord th1nk3r
Class C-1 msg from Rasmus Lerdorf
> Do you have /bin/sh inside your jail?


Thanks
I'm stupid. It was that easy. Thanks again ;)
- --
- -----------------------------------------------------------
Jabber ID: th1nk3r@jabber.org
GNU/Linux User# 266578
http://www.blacklord.net/

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/CM d-- s: a? C++++ UL+++ P >++ L+++ E--- W+++ N-- o-- K--- w--- O M- V-
PS+++ PE-- Y++ PGP+++ t+ 5+ X+++ R+++ tv-- b++ DI++ D++ G e+++ h r++ y+
------END GEEK CODE BLOCK------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/xWKYXlg6KvYpupERAsQrAJ9zUKIacQZzuTAzN14tembqK0+2uw CcCvTV
WxZ3K2COKmeQzJHXiYM9fc8=
=Fq60
-----END PGP SIGNATURE-----
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:26 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0