Skip to content

Fix multi-domain certificate path handling and update nginx to 1.30#145

Open
kings9527 wants to merge 1 commit into
wmnnd:masterfrom
kings9527:master
Open

Fix multi-domain certificate path handling and update nginx to 1.30#145
kings9527 wants to merge 1 commit into
wmnnd:masterfrom
kings9527:master

Conversation

@kings9527
Copy link
Copy Markdown

Problem

When multiple domains are configured in the domains array, the script uses unquoted $domains in path operations (e.g., rm -Rf /etc/letsencrypt/live/$domains), which causes bash to expand the array into multiple arguments. This leads to:

  1. Incorrect certificate directory resolution — the path becomes /etc/letsencrypt/live/example.org www.example.org instead of /etc/letsencrypt/live/example.org
  2. Accidental file deletion — commands like rm -Rf /etc/letsencrypt/archive/$domains attempt to delete paths that don't exist or may match unintended targets
  3. False-positive existing data detection — checking $data_path (always exists after first run) instead of the actual certificate directory

Changes

init-letsencrypt.sh

  • Use ${domains[0]} as the certificate directory name (Certbot uses the first domain for the live directory)
  • Check $data_path/conf/live/$cert_dir for existing certificate detection
  • Quote all path references to prevent word splitting on multi-domain arrays
  • Display all configured domains in user prompts for clarity

docker-compose.yml

  • Update nginx from 1.15-alpine (2018, EOL, vulnerable) to 1.30-alpine (2026 stable, includes HTTP/2 keep-alive improvements)

Related

Testing

  • Script syntax validated with bash -n
  • Multi-domain array expansion verified with test arrays
  • Nginx 1.30-alpine image resolves successfully

…version

- Use first domain (domains[0]) as certificate directory name instead of
  unquoted array expansion, which caused incorrect path resolution when
  multiple domains were configured
- Check specific certbot live directory instead of generic data_path for
  existing certificate detection
- Update nginx image from 1.15-alpine (2018, EOL) to 1.30-alpine (2026 stable)
  for security patches and HTTP/2 keep-alive improvements

Fixes wmnnd#139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple domains don't really work well!

1 participant