Unable to use SSL for email

I have created a self signed certificate and copied it to dovecot and postfix. In /etc/postfix/master.cf I have the following:

[code]

Postfix master process configuration file. For details on the format

of the file, see the master(5) manual page (command: “man 5 master”).

Do not forget to execute “postfix reload” after editing this file.

==========================================================================

service type private unpriv chroot wakeup maxproc command + args

(yes) (yes) (yes) (never) (100)

==========================================================================

smtp inet n - n - - smtpd -o smtpd_sasl_auth_enable=yes
#smtp inet n - n - 1 postscreen
#smtpd pass - - n - - smtpd
#dnsblog unix - - n - 0 dnsblog
#tlsproxy unix - - n - 0 tlsproxy
submission inet n - n - - smtpd

-o syslog_name=postfix/submission

-o smtpd_tls_security_level=encrypt

-o smtpd_sasl_auth_enable=yes

-o smtpd_reject_unlisted_recipient=no

-o smtpd_client_restrictions=$mua_client_restrictions

-o smtpd_helo_restrictions=$mua_helo_restrictions

-o smtpd_sender_restrictions=$mua_sender_restrictions

-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject

-o milter_macro_daemon_name=ORIGINATING

smtps inet n - n - - smtpd -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_reject_unlisted_recipient=no -o smtpd_client_restrictions=$mua_client_restrictions -o smtpd_helo_restrictions=$mua_helo_restrictions -o smtpd_sender_restrictions=$mua_sender_restrictions -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING
#628 inet n - n - - qmqpd
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp

-o smtp_helo_timeout=5 -o smtp_connect_timeout=5

showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache

====================================================================

Interfaces to non-Postfix software. Be sure to examine the manual

pages of the non-Postfix software to find out what options it wants.

Many of the following services use the Postfix pipe(8) delivery

agent. See the pipe(8) man page for information about ${recipient}

and other message envelope options.

====================================================================[/code]

Which if any of these lines do I need to uncomment?
Which ports should I tell Apple Mail to use for POP and SMTP?

I keep getting (depending on what I try in the settings) ‘this certificate is invalid’ (even when I try to add it by trusting it) or it says it can’t connect or just keeps asking for my password.

netstat -an | grep :465 tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN tcp6 0 0 :::465 :::* LISTEN

Any ideas on how I can set this up?

Howdy,

If you just have one SSL certificate in Postfix, that would show up in /etc/postfix/main.cf. What output do you receive if you run this command:

postconf -n

When connecting, what port are you connecting to – port 465 or 587? Do you receive the same results with both?

-Eric

Hi Eric, here’s the output:

[code]

postconf -n

postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, rock.tmruby.com
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_use_tls = yes
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual[/code]

I’ve tried both ports, and it’s the same (with current config, it’s keep asking for password).

Just a note that format for emails is name@domain.com but I have made sure the FLAGS="-r" line is uncommented (was already uncommented).

I’ve also tried uncommenting these lines - but still the same:

postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions

EDIT: Just a quick update to say I put Ubuntu on the server and everything is working. I will try CentOS again later.

I’m not immediately certain of why it wasn’t working, but I’m glad to hear it’s working properly now!

If you try CentOS again and continue to have problems, feel free to let us know and we can troubleshoot it further.

-Eric

Hi Eric, I’m back on CentOS 7 and it’s not working on this install either :frowning:

I thought it might be a bug so opened an issue here: https://www.virtualmin.com/node/37599 though I don’t think it’s the reason I first thought it is. Odd that it works on ubuntu but not centos 7 :confused: