Lets encrypt certifcate generation for centos postfix server
- Install lets encrypt
- yum -y install letsencrypt
Generate Lets encrypt certificate
- letsencrypt certonly --standalone -d {domain name}
Main configuration file where we provide location to certificate
- vi /etc/postfix/main.cf
Parameters that is added to postfix file
- smtpd_tls_CAfile = /etc/letsencrypt/live/{domain name}/fullchain.pem
- smtpd_tls_key_file = /etc/letsencrypt/live/{domain name}/privkey.pem
- smtpd_tls_cert_file = /etc/letsencrypt/live/{domain name}/cert.pem
- smtpd_use_tls = yes
Package required for configuring auto renew of lets encrypt certificate
- wget https://dl.eff.org/certbot-auto && chmod a+x certbot-auto
- mv certbot-auto /etc/letsencrypt/
Scheduling autorenew of Certificate
We need to renew it every 90 days
- crontab -e
0 0 1 */2 * cd /etc/letsencrypt/ && ./certbot-auto renew
0 0 1 */2 * cd /etc/letsencrypt/ && ./certbot-auto renew >/var/log/letsencrypt/letsencrypt.log 2>&1
Testing new certificate generation without overriding old one
- cd /etc/letsencrypt/ && ./certbot-auto renew --dry-run
Log of Lets encrypt
- cat /var/log/letsencrypt/letsencrypt.log
Comments
Post a Comment