en:user_advanced:gs3_https
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:user_advanced:gs3_https [2025/02/12 23:59] – [Linux: Getting SSL certificates using certbot] kjdon | en:user_advanced:gs3_https [2025/02/13 01:02] (current) – [Using Apache to reverse proxy Tomcat] kjdon | ||
---|---|---|---|
Line 6: | Line 6: | ||
===== Using Apache to reverse proxy Tomcat ===== | ===== Using Apache to reverse proxy Tomcat ===== | ||
+ | |||
+ | Install and setup Apache with certbot SSL certificates. Then in the le-ssl.conf file (eg / | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | < | ||
+ | ProxyPassReverseCookiePath / | ||
+ | </ | ||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | In build.properties, | ||
+ | | ||
+ | revproxy.protocol=https | ||
+ | revproxy.domain=< | ||
+ | ## | ||
+ | ## | ||
+ | |||
===== Linux: Getting SSL certificates using certbot ===== | ===== Linux: Getting SSL certificates using certbot ===== | ||
- | A | ||
To have your webserver running under https, you need an SSL certificate. Many hosting platforms have tools to let you use HTTPS. See [[https:// | To have your webserver running under https, you need an SSL certificate. Many hosting platforms have tools to let you use HTTPS. See [[https:// | ||
Line 19: | Line 38: | ||
Take note of the "What you need" section. Then, choose your webserver (' | Take note of the "What you need" section. Then, choose your webserver (' | ||
+ | Port 80 must be open to obtain and renew a certificate. | ||
Once you have certbot installed, if you are using Apache, you can run | Once you have certbot installed, if you are using Apache, you can run | ||
Line 31: | Line 51: | ||
The SSL certificates are installed into / | The SSL certificates are installed into / | ||
- | Once you use certbot to obtain certificates, | + | ==== certbot renewal timer ==== |
+ | |||
+ | Once you use certbot to obtain certificates, | ||
+ | |||
+ | If you are using Apache, you won't need to do anything else, as it links directly to the live certificates. If you are using Tomcat directly with HTTPS, then you will need to manually install the certificate into Tomcat or follow the instructions for making that happen automatically. See [[en: | ||
+ | |||
+ | === Manual renewal === | ||
Note, if your port 80 is not open by default, and you opened it just for generating the initial certificates, | Note, if your port 80 is not open by default, and you opened it just for generating the initial certificates, | ||
* '' | * '' | ||
+ | You can also run '' | ||
+ | |||
+ | If your renewal has failed, you will get an email telling you this. | ||
+ | |||
+ | === Checking the logs === | ||
+ | To check the logs: '' | ||
+ | |||
+ | You can look at the latest one: '' | ||
+ | |||
+ | The log will tell you eg that your renewal had failed bacuse it couldn' | ||
+ | |||
+ | === Viewing the timers === | ||
+ | |||
+ | '' | ||
+ | |||
+ | The timer itself is in / | ||
+ | By default this runs twice a day '' | ||
+ | This looks at all certificates and determines if they need renewal - by default, anything that is expiring within 30 days. | ||
+ | |||
+ | Viewing the timer: | ||
+ | '' | ||
+ | |||
+ | Editing it: | ||
+ | '' | ||
+ | This just creates an override file. | ||
+ | |||
+ | Eg if you want to change the timing, OnCalendar is cumulative. | ||
+ | So need to set it to empty first, then add the new one | ||
+ | < | ||
+ | OnCalendar=*-*-* 15: | ||
+ | |||
+ | '' | ||
+ | |||
+ | ===== Setting up Tomcat with SSL Certificates ===== | ||
+ | |||
+ | Greenstone provides some ant targets to help you set up Tomcat with HTTPS. | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | |||
+ | ==== Automatic certificate renewal for Tomcat (Greenstone 3.12) ==== | ||
+ | |||
+ | While certbot sets up timers for automatic renewal of certificates, | ||
+ | to be restarted to use the new certificate. | ||
+ | |||
+ | You can set commands to be run before/ | ||
+ | |||
+ | There is a script in Greenstone3 - '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | You can see the options for a renewal at ''/ | ||
+ | |||
+ | Note, automatic running of this script requires some setup for sudo to be run with no password. See below. | ||
+ | |||
+ | |||
+ | === Getting things to run as sudo with no password === | ||
+ | There are two commands that need to be run as root - openssl converting the fullchain and key files into tomcats format (as letsencrypt files are owned by root), and the deleting of the root owned resultant file (we copy it into tomcat giving it local user ownership) | ||
+ | |||
+ | Script '' | ||
+ | We need to enable no password for this script and also for the '' | ||
+ | |||
+ | Edit the sudoers file (actually lets just edit a custom file in sudoers.d, so we are not mucking with the main file): | ||
+ | |||
+ | '' | ||
+ | |||
+ | < | ||
+ | # allow running of Greenstone3' | ||
+ | %sudo ALL=(root) NOPASSWD: < | ||
+ | %sudo ALL=(root) NOPASSWD: /usr/bin/rm / | ||
+ | </ | ||
+ | |||
+ | Substitute < | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
en/user_advanced/gs3_https.1739404790.txt.gz · Last modified: 2025/02/12 23:59 by kjdon