SMTP over SSH via PHP

Timothy Stone citylists at petmystone.com
Thu Mar 18 16:21:37 UTC 2004


Rodolfo J. Paiz wrote:

> At 09:19 3/18/2004, you wrote:
> 
>> Can anyone provide a cookbook idea to create a socket/tunnel where by 
>> I can use SSH to talk to the SMTP server on the Linux staging box?
> 
> 
> Isn't this what the "stunnel" package helps you do? I think it's there 
> to SSL-encrypt other data streams like SMTP, and I'm sure it could be 
> made to communicate via the SSH port. Check the docs for it.
> 
> 

Not exactly what I need.

Here's an idea of the configuration.


	DMZ                  |         LAN
                              |
       win2k.host             |    linux.host:25
                              |    +--------------+
     [webserver] PHP > SMTP-| |    o  mail server |
                              |    +--------------+


I'm only allowed to SSH over the DMZ to the LAN

What I'm after is:

	DMZ            |         LAN
                        |
       win2k.host       |      linux.host:25
                    sshsshssh  +--------------+
     [webserver] PHP-> SMTP--->o  mail server |
                    sshsshssh  +--------------+
                        |



Remember, my webservers are running W2K with cygwin.

I need my php script to possibly call a simple SSH tunnelling script.

I'm hacking something I found at 
http://www.slac.com/~mpilone/projects/kde/kmailssh/

This looks like the ticket, only I'll be:

-L 25:$SSH_MAIL_SERVER:25 in the ssh command. But I need this to be 
called by PHP I think.  The problem as I see it is the PHP script calls 
   the PHP mail() function which in turn uses properties defined in the 
php.ini file, such as SMTP = your.smtp.host.here

Can I define a script there? That would be the ideal.

Any further ideas are greatly appreciated! Thanks!

Tim







More information about the redhat-list mailing list