• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Mail SSL

CJZ

Basic Pleskian
Currently (base install) my mail server is using the Plesk default SSL certificate. I have applied my own personal certificate to the sites (which apparently does not get applied to mail server).

How can I apply my certificate to courrior-imap and postfix?

Thanks.
 
have a look here: http://kb.parallels.com/en/1062

Note the following though:

It is important that the client specifies the domain that the certificate is issued for in order to avoid a warning that the certificate name does not match that of the host you are connecting to. For example, if the certificate was issued for the "example.com" domain, then you should specify "example.com" as the connection string in your mail client preferences for SMTP/POP3/IMAP servers.

NOTE: There is a single certificate for each of these services: SMTP, IMAP4, and POP3 over SSL; multiple certificates cannot be used for multiple Plesk domains.

It seems to me that this is requested quite often, so it would be nice to see a way to select one of the SSL certificates already installed for http via the GUI and have it applied to imap, smtp and pop3. We'll have to add it as a feature request.
 
Last edited:
NOTE: There is a single certificate for each of these services: SMTP, IMAP4, and POP3 over SSL; multiple certificates cannot be used for multiple Plesk domains.

Let say I set the new SSL cert (following KB 1062) to my maindomain.tld but then all my clients will get an error because it doesn't match their domain.... Agggg

So how can I get my clients from getting a Certificate error when connecting to mail.clientdomain.tld while using IMAP-SSL?

Outlook 2007 and Outlook 2010 won't connect to the IMAP server without using SSL!¿!¿
 
Well, it is all a metter of how you sell it to them.

Basically, you can just tell them to set their IMAP server address to mydomain.tld. From their point of view, it is just a setting, like anything else. They know their hosting account is with you, so there should be no problem with them using that domain.

You could, of course, register a special domain (e.g. generic-imap-server.com) and purchase and install a certificate for that if you wanted to be more generic and hide your company name. Again it is just a setting.

Are you absolutely sure about Outlook? We've never, ever bothered with a certificate for email (we've been hosting using Plesk for a good 10 years now), and we have a lot of customers using IMAP and nobody has every contacted us about certificate errors ** so far :) **.

*** Test with a self-signed certificate before you purchase a real one, just to make sure everything works in the way you (and I) expect ***

Faris.
 
It is possible to get courier-imap to provide a different SSL certificate per domain. On Debian 6 it would be something like this assuming you have the original key and crt (figuring out which ones in /usr/local/psa/var/certificates/ is another story)...

cat yourdomain.com.key yourdomain.com.crt > /usr/share/courier-imap/imapd.pem.xx.xx.xx.xx
cat yourdomain.com.key yourdomain.com.crt > /usr/share/courier-imap/pop3d.pem.xx.xx.xx.xx
chmod 400 /usr/share/courier-imap/*pem*
/usr/local/psa/admin/sbin/mailmng --restart-service

where xx.xx.xx.xx is the dedicated IP associated with yourdomain.com. You can check that the right certificate is being presented by using...

openssl s_client -connect yourdomain.com:993 # for IMAP
openssl s_client -connect yourdomain.com:995 # for POP3

It may even be possible to use SSL per domain with postfix using something like this in /etc/postfix/master.cf but I haven't got this to work yet, might need a later version of postfix perhaps (all on one line and Plesk may overwrite it)...

xx.xx.xx.xx- unix - n n - - smtp -o smtp_helo_name=yourdomain.com \
-o smtp_bind_address=xx.xx.xx.xx -o smtp_bind_address6= \
-o smtp_address_preference=ipv4 \
-o smtpd_tls_cert_file=/etc/postfix/yourdomain.com.pem \
-o smtpd_tls_key_file=/etc/postfix/yourdomain.com.pem

Note the -o smtp_helo_name=yourdomain.com, this actually works on outgoing mail and should be provided by Plesk because I have no idea how SPF hardfail can be used without that extra setting for virtual domains on virtual IPs otherwise the default $myhostname from /etc/postfix/main.cf will be presented.

If anyone has got this to work with postfix or has any suggestions then please post!
 
@zconsulting: I gave up on Plesk long ago so no I never got a chance to test this for real but the above snippet includes -o smtp_bind_address=xx.xx.xx.xx so I presume that with the other settings would deliver a unique certificate per IP. HTH.
 
ok, i figured it out (thanks in large part to mconstable, and to this site).

Here is how you bind a different security certificate to each IP.

for POP/IMAP, all you have to do, as mconstable said, is add the certificates in the following format (where xx.xx.xx.xx is the IP address):
cat yourdomain.com.key yourdomain.com.crt > /usr/share/imapd.pem.xx.xx.xx.xx
cat yourdomain.com.key yourdomain.com.crt > /usr/share/pop3d.pem.xx.xx.xx.xx
chmod 400 /usr/share/courier-imap/*pem*
/usr/local/psa/admin/sbin/mailmng --restart-service
Note: for me, using Plesk 11.5 on Centos 6, the above path is simply /usr/share/ (not /usr/share/courier-imap/)

Now, for postfix, here is what i did:
Again, using Plesk 11.5 on Centos 6, the end of the master.conf file (found in /etc/postfix/ directory) was as follows:

1.1.1.1- unix - n n - - smtp -o smtp_bind_address=1.1.1.1 -o smtp_bind_address6= -o smtp_address_preference=ipv4

2.2.2.2- unix - n n - - smtp -o smtp_bind_address=2.2.2.2 -o smtp_bind_address6= -o smtp_address_preference=ipv4

smtp inet n - n - - smtpd
smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes
submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=

3.3.3.3- unix - n n - - smtp -o smtp_bind_address=3.3.3.3 -o smtp_bind_address6= -o smtp_address_preference=ipv4

4.4.4.4- unix - n n - - smtp -o smtp_bind_address=4.4.4.4 -o smtp_bind_address6= -o smtp_address_preference=ipv4

5.5.5.5- unix - n n - - smtp -o smtp_bind_address=5.5.5.5 -o smtp_bind_address6= -o smtp_address_preference=ipv4

This is most likely because i purchased the last 3 IPs after initial setup of the server.

First, you need to create the certificate files; i just used the original .pem format. This means that is you have a .key file and a .cer file, you need to concat them into a .pem file, placing the key first. Then you place them in the /etc/postfix/ directory -- you can also create a new directory for your certificates, for example: /etc/postfix/ssl/
Now, here is what it should look like to get a unique certificate on each IP.

1.1.1.1- unix - n n - - smtp -o smtp_bind_address=1.1.1.1 -o smtp_bind_address6= -o smtp_address_preference=ipv4

2.2.2.2- unix - n n - - smtp -o smtp_bind_address=2.2.2.2 -o smtp_bind_address6= -o smtp_address_preference=ipv4

3.3.3.3- unix - n n - - smtp -o smtp_bind_address=3.3.3.3 -o smtp_bind_address6= -o smtp_address_preference=ipv4

4.4.4.4- unix - n n - - smtp -o smtp_bind_address=4.4.4.4 -o smtp_bind_address6= -o smtp_address_preference=ipv4

5.5.5.5- unix - n n - - smtp -o smtp_bind_address=5.5.5.5 -o smtp_bind_address6= -o smtp_address_preference=ipv4


#smtp inet n - n - - smtpd
#smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes
#submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=

1.1.1.1:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert1.pem -o smtpd_tls_key_file=/etc/postfix/cert1.pem
1.1.1.1:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert1.pem -o smtpd_tls_key_file=/etc/postfix/cert1.pem
1.1.1.1:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert1.pem -o smtpd_tls_key_file=/etc/postfix/cert1.pem

2.2.2.2:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert2.pem -o smtpd_tls_key_file=/etc/postfix/cert2.pem
2.2.2.2:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert2.pem -o smtpd_tls_key_file=/etc/postfix/cert2.pem
2.2.2.2:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert2.pem -o smtpd_tls_key_file=/etc/postfix/cert2.pem

3.3.3.3:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert3.pem -o smtpd_tls_key_file=/etc/postfix/cert3.pem
3.3.3.3:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert3.pem -o smtpd_tls_key_file=/etc/postfix/cert3.pem
3.3.3.3:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert3.pem -o smtpd_tls_key_file=/etc/postfix/cert3.pem

4.4.4.4:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert4.pem -o smtpd_tls_key_file=/etc/postfix/cert4.pem
4.4.4.4:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert4.pem -o smtpd_tls_key_file=/etc/postfix/cert4.pem
4.4.4.4:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert4.pem -o smtpd_tls_key_file=/etc/postfix/cert4.pem

5.5.5.5:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert5.pem -o smtpd_tls_key_file=/etc/postfix/cert5.pem
5.5.5.5:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert5.pem -o smtpd_tls_key_file=/etc/postfix/cert5.pem
5.5.5.5:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert5.pem -o smtpd_tls_key_file=/etc/postfix/cert5.pem
 
Last edited:
zconsulting,

Do you have any suggestions on what the Postfix configuration file would look like in Plesk 12? I successfully bound each IP to a separate SSL certificate in Dovecot (for IMAP/POP3), but cannot seem to adopt your suggestions above for a Plesk 12 Postfix configuration file.

Hoping you have some suggestions.

Thanks
 
Back
Top