Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Send mail from outside a firewalll via Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Send mail from outside a firewalll via Mail.app
Authored by: JasonPro on Mar 03, '04 01:51:20AM
Just to bring this hint up do date with xinetd (Panther), here are some instructions: create a file called imap-sshforward (imap can be any service, substitute if you want) in /etc/xinetd.d/ with the following contents:

service imap-sshforward                                                         
{                                                                               
    type        = UNLISTED                                                      
    only_from   = localhost                                                     
    port        = 10143                                                         
    disable     = no                                                            
    socket_type = stream                                                        
    wait        = no                                                            
    user        = YOURUSERNAMEHERE                                                      
    groups      = yes                                                           
    server      = /usr/bin/ssh                                            
    server_args =  -T -q YOURSSHHOST nc YOURMAILEXCHANGER
}
YOURSSHHOST and YOURMAILEXCHANGER may be the same machine but they don't have to be. In my case, I can ssh into a machine that is on a secured network to my mail exchanger. Also, notice that I used port 10143 instead of the usual 143. I don't know if you can use 143 since that is a privaleged port and this service is set to not run as root. In any case, Mail and any other mail program can easily be configured to use other ports so it doesn't matter.

When you've set up this file, simply kill -HUP XINETD'sPID where XINETID'sPID can be found by doing ps xac | grep xinetd. Xinetd should pick up the new service and be all set.

In order to set up other services such as SMTP and POP3 in this way, just create a new file as before and substitute the new service name wherever imap occurs. Then change the port numbers accordingly and you should be set.

[ Reply to This | # ]
can't get this to work... help anyone?
Authored by: nick on Nov 20, '04 06:26:11AM
i made a file called pop3-tunnel in /etc/xinetd with the following content:
service pop3-tunnel
{
type = UNLISTED
only_from = localhost
port = 55110
disable = no
socket_type = stream
wait = no
user = SSHSERVER-USERNAME
groups = yes
server = /usr/bin/ssh
server_args = -T -q SSHSERVER /usr/bin/nc POPSERVER
}

then i registerd the service in /etc/services:
pop3-tunnel 55110/udp # Post Office Protocol - Version 3
pop3-tunnel 55110/tcp # Post Office Protocol - Version 3

then i killed xinetd and started it in debug mode.

then i tried to telnet to the popserver:
# telnet localhost 55110
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
no port[s] to connect to
Connection closed by foreign host.

if i start the ssh-tunnel handish with the following command, it works fine:
niko$ ssh -N -C -L 55110:POPSERVER:110 niko@SSHSERVER


with xinetd-method, how does the SSHSERVER know that it should use port 110 to connect to the POPSERVER? any help is highly appreciated.

[ Reply to This | # ]
can't get this to work... help anyone?
Authored by: jurg on Feb 05, '05 06:28:50AM

The server also has to have netcat installed. Then use:
server_args = -T -q SSHSERVER /usr/bin/nc POPSERVER 110



[ Reply to This | # ]