Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix covers nginx wrong certbot init #8847

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions compose.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ services:
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/covers_nginx.conf:/etc/nginx/sites-enabled/covers_nginx.conf:ro
# Needed for HTTPS, since this is a public server
- ./docker/public_nginx.conf:/etc/nginx/sites-available/public_nginx.conf:ro
# letsencrypt
- letsencrypt-data:/etc/letsencrypt
- ../olsystem/etc/cron.d/certbot:/etc/cron.d/certbot
Expand Down Expand Up @@ -182,8 +180,6 @@ services:
# nginx configurations
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/web_nginx.conf:/etc/nginx/sites-enabled/openlibrary.conf:ro
# Needed for HTTPS, since this is a public server
- ./docker/public_nginx.conf:/etc/nginx/sites-available/public_nginx.conf:ro
# archive web log uploads
- ../olsystem:/olsystem
# web log rotation
Expand Down
18 changes: 17 additions & 1 deletion docker/covers_nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
include /etc/nginx/sites-available/public_nginx.conf;
# Keep in sync with web_nginx.conf
server {
listen 80 default;
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
server_name localhost;

ssl_certificate /etc/letsencrypt/live/covers.openlibrary.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/covers.openlibrary.org/privkey.pem;

# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
ssl_dhparam /olsystem/etc/nginx/dhparam-2048.pem;

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
}

server {
listen 80;
Expand Down
12 changes: 4 additions & 8 deletions docker/ol-nginx-start.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#!/bin/bash

# Create certs for domains missing them
RUN_CERTBOT=0
CERTBOT_OPTIONS=""
for domain in $NGINX_DOMAIN; do
CERTBOT_OPTIONS+=" -d $domain"
if [ ! -d "/etc/letsencrypt/live/$domain" ]; then
RUN_CERTBOT=1
fi
done

if [ "$RUN_CERTBOT" -eq 1 ]; then
certbot certonly --webroot --webroot-path /openlibrary/static $CERTBOT_OPTIONS
fi
certbot certonly \
--noninteractive --agree-tos \
-m openlibrary@archive.org \
--webroot --webroot-path /openlibrary/static $CERTBOT_OPTIONS

# Run crontab if there are files
if [ -n "$CRONTAB_FILES" ] ; then
Expand Down
21 changes: 0 additions & 21 deletions docker/public_nginx.conf

This file was deleted.

18 changes: 17 additions & 1 deletion docker/web_nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,23 @@ upstream webnodes {
server web_haproxy:7072;
}

include /etc/nginx/sites-available/public_nginx.conf;
# Keep in sync with covers_nginx.conf
server {
listen 80 default;
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
server_name localhost;

ssl_certificate /etc/letsencrypt/live/openlibrary.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/openlibrary.org/privkey.pem;

# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
ssl_dhparam /olsystem/etc/nginx/dhparam-2048.pem;

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
}

server {
listen 80;
Expand Down
Loading