Stunnel to Gmail on Fedora 20 with systemd
by tgutwin
Posted on Monday Jan 25, 2016 at 06:24PM in Linux
How to setup stunnel to simply redirect a non-SSL email client to send mail through a Gmail or (Google Apps) account. Installed on Fedora 20 (or o other Fedora with systemd) as a systemd.service.
I have some devices in my network that are not capable of SSL email required by Gmail accounts. No problem stunnel can easily wrap the messages in SSL from GMail. Stunnel can do soooo much more, but for this simple usage, the setup is very easy.
1) yum install stunnel
2) edit the /etc/stunnel/stunnel.conf to look like...
client = yes pid=/var/run/stunnel.pid [ssmtp] accept = YOURSERVERIP:465 connect = smtp.gmail.com:465 |
Make sure to change YOURSERVERIP to your own IP addr.
3) create a systemd.service file to start and autostart stunnel at startup:
[Unit] Description=Stunnel SSL Tunnel After=syslog.target After=network.target [Service] Type=simple PIDFile=/var/run/stunnel.pid ExecStart=/bin/stunnel /etc/stunnel/stunnel.conf # Give a reasonable amount of time for the server to start up/shut down TimeoutSec=30 [Install] WantedBy=multi-user.target |
4) Start stunnel with systemctl start stunnel.service
5) enable it to autostart systemctl enable stunnel.service
6) send a test email, but point your client at YOURSERVERIP with your Gmail user password.
Works for me!