$$SSL Configuration$$

||include||style.htm||
||include||body.htm||

This page is now OBSOLETE in most situations. Instead just set g_ssl_auto "true" and issue the command tellmail ssl_update. SurgeMail will then create certificates for each domain automatically using LetsEncrypt. The server must be accessable on port 80 via the exact dns name you wish to create a certificate for, e.g. "mail.yourdomain.com".

$$Current certificate$$ ||ifdef||cert_untrusted|| ($$UNTRUSTED$$) ||endif|| ||ifdef||ssl_per_domain|| $$for domain$$: | ||else|| $$for server$$ ||ssl_host|| ||endif||

    	$$Domain (Common Name)$$		: ||cert_domain||
    	Alternative URLs		: ||cert_altname||
    	$$Issued by$$			: ||cert_issuer||
    	$$Valid until$$			: ||cert_valid||
    	$$Organization Name$$ 		: ||cert_organisation||
    	$$Organizational Unit Name$$ 	: ||cert_unit||
    	$$Locality Name$$ 			: ||cert_city||
    	$$State or Province Name$$  	: ||cert_state||
    	$$Country Code$$ 			: ||cert_country||
    	Extra info			: ||cert_info||
    	||ssl_warning||
    	||ssl_log||

||ifdef||show_csr||

### CSR Certificate Signing Request

||do_show_sslcsr||

Copy the above text and paste into the certification providers website when asked!. ||endif||

### How to get a signed certificate

- Click on 'Create CSR', if you have never done this before, and give the details of your server.
- Click on 'Show CSR' and copy the code.
- Go to your favourite certificate registry and request a signed certificate or use LetsEncrypt (see notes below), The registry service will want this CSR .
- They will then give you a signed certificate and intermediate certificates, ask for 'Apache' or 'Other' format.
- Upload the two files using the buttons above...

### Warning:

If your certificate doesn't match the current private key, or is miss formatted etc, then you may loose connection to this page when you press 'save changes', instead use the non ssl admin port: http://your.server:7026, examine mail.err for the cause, remove ssl/surge_cert.pem and restart surgemail to recreate a working unsigned certificate!

### Manual Installation of Certificates - And debugging bad certificates....

You can install your certificate manually by replacing the file ssl/surge_cert.pem and place the intermediate certifictes in surge_chain.pem then restart surgemail.
If your certificate was created from a different private key then also replace ssl/surge_priv.pem. If your certificate is faulty in any way ssl will not work, in that case examine mail.err to find the cause, and remove surge_cert.pem and restart surgemail to recreate an unsigned but working certificate.

If you are using g_ssl_perdomain "true" then place certifictes in ssl/mail.domain.name folders

Generally for an ssl certificate you should make sure you have url_host defined for each domain, e.g. for xyz.com url_host should be "mail.xyz.com"

If you are using a wild card ssl certificate and want it to match correctly with any sub domain used, then use the new setting ssl_wildcard "*.xyz.com" so it will match correctly.

### LetsEcrypt

Lets encrypt is a free service to create SSL certificates automatically and update them each month, to use it see the instructions here.