vlan7@sid7:~$ cat /etc/xinetd.d/gmail-smtp # default: on # description: Gmail SMTP wrapper for clients without SSL support # vlan7 26-10-2010 # Added logging capabilities && one minor fix thanks to this guide: # http://www.linuxfocus.org/English/November2000/article175.shtml service gmail-smtp { disable = no # bind commented. Only from localhost # bind = localhost only_from = localhost port = 10025 socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/gmail-smtp type = unlisted # banner breaks communication :/ # banner = /etc/issue log_on_failure += USERID } vlan7@sid7:~$ sudo cat /usr/bin/gmail-smtp #!/bin/sh /usr/bin/openssl s_client -connect smtp.gmail.com:465 -quiet 2>/dev/null vlan7@sid7:~$ cat /etc/nullmailer/remotes 127.0.0.1 smtp --port=10025 --user=XXX.YYY@gmail.com --pass=********Atencion! El archivo /etc/nullmailer/remotes es legible para todo el mundo! Asi que ojo :/
Comprobamos la conectividad con netcat:
vlan7@sid7:~$ nc -vv 127.0.0.1 10025 localhost [127.0.0.1] 10025 (?) open 220 mx.google.com ESMTP b30sm7257373wbb.22 HELP 214 2.0.0 http://www.google.com/search?btnI&q=RFC+2821 b30sm7257373wbb.22 QUIT 221 2.0.0 closing connection b30sm7257373wbb.22 sent 10, rcvd 168 vlan7@sid7:~$xinetd OK. Probemos a enviarnos un mensaje, a ver si nullmailer lo manda OK desde localhost autenticandose contra la cuenta gmail definida en /etc/nullmailer/remotes y reeenviandolo a XXX@vlan7.org
root@sid7:/home/vlan7# echo 'Esto es un mensaje de test' |mailx XXX@vlan7.orgListamos la cola:
root@sid7:/home/vlan7# mailq 2010-10-26 23:55:03 330 bytes from <root@sid7.xxx.es> to <xxx@vlan7.org>Forzamos un flush de la cola:
root@sid7:/home/vlan7# nullmailer-send Rescanning queue. ^CComprobamos que la cola ha sido procesada y el correspondiente log de syslog:
root@sid7:/home/vlan7# mailq ; tail -f /var/log/syslogr Oct 26 23:56:09 sid7 xinetd[2208]: removing time Oct 26 23:56:09 sid7 xinetd[2208]: removing time Oct 26 23:56:09 sid7 xinetd[2208]: Swapping defaults Oct 26 23:56:09 sid7 xinetd[2208]: readjusting service gmail-smtp Oct 26 23:56:09 sid7 xinetd[2208]: Reconfigured: new=0 old=1 dropped=0 (services) Oct 26 23:57:03 sid7 nullmailer[2087]: Rescanning queue. Oct 26 23:57:03 sid7 nullmailer[2087]: Starting delivery: protocol: smtp host: 127.0.0.1 file: 1288130103.19982 Oct 26 23:57:05 sid7 nullmailer[20012]: smtp: Succeeded: 250 2.0.0 OK 1288130224 f31sm5425073wej.15 Oct 26 23:57:05 sid7 nullmailer[2087]: Sent file. Oct 26 23:57:05 sid7 nullmailer[2087]: Delivery complete, 0 message(s) remain. ^CSegun syslog se ha enviado OK. Para comprobar que lo hemos recibido entramos en nuestro correo y ahi lo tenemos. Todo OK.
A mi me va de lujo para enviarme alertas por correo...
Referencias:
- http://jon.sprig.gs/blog/2009/11/29/use-gmails-smtp-gateway-using-the-command-line-from-ubuntu-without-lots-of-config-tips/
- http://www.linuxfocus.org/English/November2000/article175.shtml
- http://xinetd.org
- nullmailer: Do I need a smarthost?
- MUAs, MTAs, and MDAs
0 comentarios :
Publicar un comentario