Re: php sending mail via sendmail

2013-09-06 Thread Tony Berth
I did the tcpdump and I think the following should be the reason?

---
500 5.5.1 Command unrecognized: AUTH LOGIN..
---

it tries to open the session with:

---
250-mydomain Hello www@mydomain [x.x.x.x], pleased to meet
you..250-ENHANCEDSTATUSCODES..250-PIPELINING..250-8BITMIME..250-SIZE..250-DSN..250-ETRN..250-DELIVERBY..250HELP..
---


On Thu, Sep 5, 2013 at 2:18 PM, Stuart Henderson s...@spacehopper.orgwrote:

 On 2013-09-02, Tony Berth tonybe...@googlemail.com wrote:
  well the script does talk to google mail correctly so somehow it should
  work.

 If the script is talking to google mail, it is going to be making
 SMTP connections directly itself. Given the log entry you showed, I would
 probably try sniffing the TCP connection (maybe something like
 tcpdump -A -s 1500 -i lo0 port 25 will do).

  I think all these open source php based solutions use the same way to

  send e-mails.

 No, they don't.

 Sending mail from PHP is a right mess, there is the mail() function
 but it's rather limited (on unix, it just pipes to a program and can't
 do smtp-auth), also some server hosts disable it, so in practice most
 larger PHP apps have another way of sending mail where they either
 execute sendmail, or handle the socket connections themselves, or use a
 library (phpmailer etc).
 @owner ${DRUPAL_OWNER}



Re: php sending mail via sendmail

2013-09-05 Thread Stuart Henderson
On 2013-09-02, Tony Berth tonybe...@googlemail.com wrote:
 well the script does talk to google mail correctly so somehow it should
 work.

If the script is talking to google mail, it is going to be making 
SMTP connections directly itself. Given the log entry you showed, I would
probably try sniffing the TCP connection (maybe something like
tcpdump -A -s 1500 -i lo0 port 25 will do).

 I think all these open source php based solutions use the same way to
 
 send e-mails.

No, they don't.

Sending mail from PHP is a right mess, there is the mail() function
but it's rather limited (on unix, it just pipes to a program and can't
do smtp-auth), also some server hosts disable it, so in practice most
larger PHP apps have another way of sending mail where they either
execute sendmail, or handle the socket connections themselves, or use a
library (phpmailer etc).
@owner ${DRUPAL_OWNER}



php sending mail via sendmail

2013-09-02 Thread Tony Berth
Dear group,

when trying different php based open source packages on a chrooted 5.2 box,
I was faced with the problem not being able to send email from their php
script. All the times I get following entry in the maillog:

 w...@example.com [x.x.x.x] did not issue MAIL/EXPN/VRFY/ETRN during
connection to MTA

Any help is much appreciated.

Thanks



Re: php sending mail via sendmail

2013-09-02 Thread Stefan Sperling
On Mon, Sep 02, 2013 at 08:38:37PM +0200, Tony Berth wrote:
 Dear group,
 
 when trying different php based open source packages on a chrooted 5.2 box,
 I was faced with the problem not being able to send email from their php
 script. All the times I get following entry in the maillog:
 
  w...@example.com [x.x.x.x] did not issue MAIL/EXPN/VRFY/ETRN during
 connection to MTA
 
 Any help is much appreciated.

Try the femail-chroot package.



Re: php sending mail via sendmail

2013-09-02 Thread Scott McEachern

On 09/02/13 14:46, Stefan Sperling wrote:

On Mon, Sep 02, 2013 at 08:38:37PM +0200, Tony Berth wrote:

Dear group,

when trying different php based open source packages on a chrooted 5.2 box,
I was faced with the problem not being able to send email from their php
script. All the times I get following entry in the maillog:

  w...@example.com [x.x.x.x] did not issue MAIL/EXPN/VRFY/ETRN during
connection to MTA

Any help is much appreciated.

Try the femail-chroot package.



The problem there is that femail-chroot requires putting a shell into 
that chroot, which is something I personally avoid.  (Or am I being too 
paranoid?)


Tony, you might want to try using the pear-Mail package.  It makes 
things more complicated, but it doesn't require a shell in the chroot.


--
Scott McEachern

https://www.blackstaff.ca

Those who would give up essential liberty to purchase a little temporary safety 
deserve neither liberty nor safety. -- Benjamin Franklin



Re: php sending mail via sendmail

2013-09-02 Thread Stefan Sperling
On Mon, Sep 02, 2013 at 02:53:09PM -0400, Scott McEachern wrote:
 The problem there is that femail-chroot requires putting a shell
 into that chroot, which is something I personally avoid.

Well, whether you need a shell depends on how scripts run external
programs. E.g. PHPMailer uses popen(), which requires a shell.

I would argue that if you already have php in there, a shell
doesn't really make things much worse :)



Re: php sending mail via sendmail

2013-09-02 Thread Tony Berth
did install both. Now, what are the settings in order to make them work?

Found following for femail:

http://rilk.com/en/doc/node/48

but these changes didn't have any effect. I still get the same error.

Thanks

On Mon, Sep 2, 2013 at 9:11 PM, Stefan Sperling s...@openbsd.org wrote:

 On Mon, Sep 02, 2013 at 02:53:09PM -0400, Scott McEachern wrote:
  The problem there is that femail-chroot requires putting a shell
  into that chroot, which is something I personally avoid.

 Well, whether you need a shell depends on how scripts run external
 programs. E.g. PHPMailer uses popen(), which requires a shell.

 I would argue that if you already have php in there, a shell
 doesn't really make things much worse :)



Re: php sending mail via sendmail

2013-09-02 Thread Stefan Sperling
On Mon, Sep 02, 2013 at 09:23:46PM +0200, Tony Berth wrote:
 did install both. Now, what are the settings in order to make them work?

Depends on your php application. It will probably try to run
/usr/sbin/sendmail, in which case you should ensure that exists
in the chroot. In my case I had to copy /var/www/bin/femail
to /var/www/usr/sbin/sendmail, and copy /bin/sh to /var/www/bin/sh
to make PHPmailer happy.

You'll also need /var/www/usr/libexec/ld.so, copied from
/usr/libexec/ld.so.



Re: php sending mail via sendmail

2013-09-02 Thread Tony Berth
I already have these settings implemented but I still get the same error!
Please note that /var/www/bin and /var/www/usr belong to the daemon group.
I don't know if that should be changed to the www one?

Where should I check in the PHP application in order to find the reason of
the problem? Also, what about the pear-Mail package? Is there something I
should adapt?

Thanks for your help

On Mon, Sep 2, 2013 at 11:58 PM, Stefan Sperling s...@openbsd.org wrote:

 On Mon, Sep 02, 2013 at 09:23:46PM +0200, Tony Berth wrote:
  did install both. Now, what are the settings in order to make them work?

 Depends on your php application. It will probably try to run
 /usr/sbin/sendmail, in which case you should ensure that exists
 in the chroot. In my case I had to copy /var/www/bin/femail
 to /var/www/usr/sbin/sendmail, and copy /bin/sh to /var/www/bin/sh
 to make PHPmailer happy.

 You'll also need /var/www/usr/libexec/ld.so, copied from
 /usr/libexec/ld.so.



Re: php sending mail via sendmail

2013-09-02 Thread Stefan Sperling
On Tue, Sep 03, 2013 at 12:19:14AM +0200, Tony Berth wrote:
 I already have these settings implemented but I still get the same error!
 Please note that /var/www/bin and /var/www/usr belong to the daemon group.
 I don't know if that should be changed to the www one?
 
 Where should I check in the PHP application in order to find the reason of
 the problem? Also, what about the pear-Mail package? Is there something I
 should adapt?
 

The log message you showed earlier seems to be from sendmail
complaining that someone trying to relay mail is not doing smtp
correctly. It comes from the function smtp() in sendmail, see
/usr/src/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c but aaah my eyes!

Perhaps the scripts are not even using the sendmail binaries?
Perhaps a script is trying to shove mail into an smtp server
without actually talking smtp?



Re: php sending mail via sendmail

2013-09-02 Thread Tony Berth
well the script does talk to google mail correctly so somehow it should
work. I think all these open source php based solutions use the same way to
send e-mails. The question is how!? Where should I look inside the php
script?

I was trying the oxwall s/w and this is generating this error. But others
like statusnet are doing the same too. I have to say that vtiger crm is
working fine though!

Thanks


On Tue, Sep 3, 2013 at 1:22 AM, Stefan Sperling s...@openbsd.org wrote:

 On Tue, Sep 03, 2013 at 12:19:14AM +0200, Tony Berth wrote:
  I already have these settings implemented but I still get the same error!
  Please note that /var/www/bin and /var/www/usr belong to the daemon
 group.
  I don't know if that should be changed to the www one?
 
  Where should I check in the PHP application in order to find the reason
 of
  the problem? Also, what about the pear-Mail package? Is there something I
  should adapt?
 

 The log message you showed earlier seems to be from sendmail
 complaining that someone trying to relay mail is not doing smtp
 correctly. It comes from the function smtp() in sendmail, see
 /usr/src/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c but aaah my eyes!

 Perhaps the scripts are not even using the sendmail binaries?
 Perhaps a script is trying to shove mail into an smtp server
 without actually talking smtp?