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

feat(apache2-foreground,Dockerfile-linux.template): Add support for TLS/HTTPS in Apache2, based on base64 files in ENV #1559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LordRobinCbz
Copy link

@LordRobinCbz LordRobinCbz commented Jan 9, 2025

Description

This PR introduces a script enhancement to allow setting SSL certificates and keys directly from base64 encoded environment variables. This change is aimed at maintaining stateless environments in Docker/Kubernetes and securing communications.

Changes

  • Set default SSL directory: ${APACHE_SSL_DIR:-/etc/apache2/ssl}
  • Create the SSL directory if it doesn't exist.
  • Decode and save the certificate and key from base64 encoded environment variables (APACHE_CERT_BASE64 and APACHE_KEY_BASE64).
  • Update the Apache configuration to use the decoded certificate and key.
  • Enable the SSL site configuration by creating a symbolic link.
  • Set appropriate permissions for the certificate, key, and configuration files.
  • Enable the SSL module in Apache.

Benefits

  • Allows setting SSL certificates without the need for volume mounts, maintaining stateless environments.
  • Enhances security by enabling TLS for PHP and Apache applications.
  • Eliminates the need for SSL reverse proxies, simplifying the stack.

Tests done

Here one screen, of a working Apache2 server with HTTLS ready for hosting PHP application:

image

This is a major improvement as it secures entire stacks and is particularly beneficial for applications using PHP and Apache.

EDIT: I dont know how to edit the README to add new vars:

APACHE_SSL_DIR => string, not mandatory
APACHE_CERT_BASE64 => string
APACHE_KEY_BASE64 => string

…LS/HTTPS in Apache2, based on base64 files in ENV

Signed-off-by: lordrobincbz <robincrombez.pro@gmail.com>
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.

1 participant