Rapturezone

  • Resources
  • Blog
  • About Us
  • Privacy Policy

Multiple Domains Multiple Certificates Let’s Encrypt Certificates on WordPress Multisite AWS Lightsail using bncert-tool

June 14 by www

Scenario

We have multiple blogs, multiple domains and need multiple SSL/TLS certificates.

We want 1 certificate per domain. We do NOT want one certificate re-used across the network. By default when using sudo /opt/bitnami/bncert-tool it will just cram ALL the certificate names into the SAN field. This is far from acceptable as it is a serious information leak.

Solution

Run sudo /opt/bitnami/bncert-tool multiple times.
Run it once for each certificate you want.

Problem

Each time you run /opt/bitnami/bncert-tool it reconfigures the system to use the latest certificate you created only.

It configures the server name in
/opt/bitnami/apps/wordpress/htdocs/wp-config.php with
define( ‘DOMAIN_CURRENT_SITE’, ‘rapturezone.com’ );


New Certificate is created at: /opt/bitnami/letsencrypt/certificates/rapturezone.com.crt
Symbolic link created to:
/opt/bitnami/apache2/conf/rapturezone.com.crt

New Private Key is created at:
/opt/bitnami/letsencrypt/certificates/rapturezone.com.key
Symbolic link created to:
/opt/bitnami/apache2/conf/rapturezone.com.key

Cron is emptied.
Only a job to renew the last created certificate

However it leaves the previous certificates and config still intact.
/opt/bitnami/letsencrypt/certificates
/opt/bitnami/letsencrypt/ remains intact.

Solution

Create a Virtual Host Per Certificate

sudo nano /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf
<VirtualHost *:80>
    ServerName rapturezone.com
    ServerAlias *.rapturezone.com
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
    ServerName rapturezone.com
    ServerAlias *.rapturezone.com
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
    SSLEngine on
    SSLCertificateFile "/opt/bitnami/apache2/conf/rapturezone.com.crt"
    SSLCertificateKeyFile "/opt/bitnami/apache2/conf/rapturezone.com.key"
    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

Include the Virtual Hosts file in bitnami-apps-vhosts.conf

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf
Include "/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf"

Manualy Add Cron Jobs to Renew Each Certificate

crontab -e
0 0 * * * sudo /opt/bitnami/letsencrypt/lego --path /opt/bitnami/letsencrypt --email="letsencrypt@rapturezone.com" 
--http --http-timeout 30 --http.webroot /opt/bitnami/apps/letsencrypt --domains=rapturezone.com renew 
&& sudo /opt/bitnami/apache2/bin/httpd -f /opt/bitnami/apache2/conf/httpd.conf -k graceful # bncert-autorenew

Potential Problems

Next time you use sudo /opt/bitnami/bncert-tool to create a new certificate for a new domain.
Contab will be wiped and olny the last certificate job wil remain.
You will need to manualy add back in all previous certificates

Related

  • Create a Let’s Encrypt certificate using certbot on AWS Lightsail WordPress MultiSite Instance

Filed Under: How To Tagged With: SSL, TLS, WordPress

Recent Posts

  • Alternative Android Apps
  • Web Scraping with Python and Beautiful Soup Example IMDB Top 250
  • Web Scraping with Python and Beautiful Soup
  • Pi Pico Mouse Jiggler
  • JellyFin Docker Container

Recent Comments

    Archives

    • September 2021
    • August 2021
    • July 2021
    • January 2021
    • September 2020
    • August 2020
    • June 2020
    • May 2020
    • December 2019
    • November 2019
    • November 2017
    • July 2017
    • January 2017
    • January 2016
    • December 2015
    • September 2015
    • April 2015
    • March 2015
    • November 2014

    Categories

    • Definitions
    • How To
    • Resources
    • Uncategorized

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Google+

    Copyright © 2025 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in