1. command line arguments
to run at any time must have /etc/ssl/certs/stunnel.pem

command line arguments

stunnel -d imaps -r localhost:imap
-d as a daemon
-d specifies the port
-r use the existing service imap on host localhost
stunnel -d imaps -l /usr/sbin/imapd
-l start the service yourself
-d specifies the port