There used to be a HOWTO thread on setting up SMTPS, or at least I seem to remember one. A couple other threads discuss quick stunnel commands, but nothing dedicated to this subject.
First some background. SMTP is the service that your mail client uses to send e-mail through your server. Since SMTP is typically in clear-text (unencrypted), anything sent between your mail client and your server could potentially be monitored. This is not such a big deal once your message gets into switched router-land on the 'net, but might be a security concern for you within your company network or shared networks such as cable modems. The risk is greater if you use the authentication features of SMTP, where your username and password are sent over the connection so that you can send e-mail from any network or ISP.
Setting up secure SMTP is pretty simple. Add a new service file named "smtps" in your /etc/xinetd.d/ directory and populate it with this information. Note: here is where I have edited the HOWTO with the results of the discussion below -- thanks to everyone who contribued! The stanza here should be correct:
CODE
service smtps
{
env = ENSIMVWH_nbconf=/etc/virtualhosting/mappings/smtp_relay.domainmap
env += ENSIMVWH_ipconf=/etc/virtualhosting/mappings/smtp_relay.ipmap
env += ENSIMVWH_virthost=1
socket_type = stream
wait = no
user = root
server = /usr/sbin/stunnel
server_args = -n smtp -T -l /usr/sbin/virthost /usr/sbin/sendmail -- sendmail -bs
log_on_success += USERID
log_on_failure += USERID
disable = no
}
{
env = ENSIMVWH_nbconf=/etc/virtualhosting/mappings/smtp_relay.domainmap
env += ENSIMVWH_ipconf=/etc/virtualhosting/mappings/smtp_relay.ipmap
env += ENSIMVWH_virthost=1
socket_type = stream
wait = no
user = root
server = /usr/sbin/stunnel
server_args = -n smtp -T -l /usr/sbin/virthost /usr/sbin/sendmail -- sendmail -bs
log_on_success += USERID
log_on_failure += USERID
disable = no
}
Then cd to /usr/share/ssl/certs and create a certificate file for stunnel either by copying some other .pem file to stunnel.pem (if you don't already have a stunnel.pem file) or by typing "make stunnel.pem". I'd suggest using the same certificate .pem file for both stunnel and ipop3d so that you only need to upload one certificate to your e-mail program (unless of course you bought a "real" certificate from Geotrust or whatever).
Make sure you restart xinetd by typing "/etc/init.d/xinetd restart" so that your smtps server will start.
Also make sure you open port 465/tcp in your firewall settings.
Different e-mail clients behave in different ways, but typically your account settings will have a place to enter the server names and specify whether the outgoing server requires a secure connection and/or authentication. This may be under an "Advanced" tab. The port should be 465 instead of 25. Authentication is configured the same way but separately, and you should generally select to use the same account settings used to retrieve your mail.
If your e-mail client refuses to accept your certificate, then you may need to download it and install it as a trusted certificate. Go back to the stunnel.pem file you created, copy out the bottom part (between and including the BEGIN and END CERTIFICATE lines), and save just that part into a file named with a ".cer" extension. DO NOT COPY THE "PRIVATE KEY" SECTION. The procedure for installing the certificate varies by OS, but Windows users should be able to just double-click the ".cer" file and select to install the certificate into the Trusted Root Store.
Well, there it is. I've probably forgotten about 16 things, but we'll see how it goes.
-britt
A shotgun wedding is a case of wife or death.