Get simpleid going with https (self signed)
diff --git a/TODO.on.site b/TODO.on.site
index bcfd36a..6113ec5 100644
--- a/TODO.on.site
+++ b/TODO.on.site
@@ -1,3 +1,10 @@
+To build:
+* nginx first because it creates selfsigned certificate:
+ docker-compose -f sourcearcade.yml build --build-arg SELFSIGNED_REQ_HOST=hostname nginx
+ - optionally: --build-arg SELFSIGNED_REQ_ALT_NAMES="DNS:name1 ..."
+* docker-compose -f sourcearcade.yml build --build-arg SELFSIGNED_REQ_HOST=hostname
+ - same build-args!
+
Adapt checked in files:
* Set server_name in `nginx/sa.conf`
* Set SIMPLEID_BASE_URL in `simpleid/www/config.php`
diff --git a/nginx/Dockerfile b/nginx/Dockerfile
new file mode 100644
index 0000000..18cbc8e
--- /dev/null
+++ b/nginx/Dockerfile
@@ -0,0 +1,25 @@
+ARG SSL_VARIANT=selfsigned
+ARG NGINX_TAG=1.25-alpine
+
+
+FROM nginx:${NGINX_TAG} as nginx_letsencrypt
+
+ONBUILD RUN echo "Let's encrypt support not implemented yet."; exit 1
+
+
+FROM nginx:${NGINX_TAG} as nginx_selfsigned
+
+ARG SELFSIGNED_REQ_HOST
+ARG SELFSIGNED_REQ_ALT_NAMES
+ONBUILD RUN test "${SELFSIGNED_REQ_HOST}" || { echo "Require SELFSIGNED_REQ_HOST argument."; exit 1; }
+ONBUILD RUN \
+ apk add openssl && \
+ printf "DE\nHassia\nEschborn\nSource Arcade\nWeb\n${SELFSIGNED_REQ_HOST}\n\n" | \
+ openssl req -x509 -nodes -days 14 -newkey rsa:2048 \
+ -addext "subjectAltName = ${SELFSIGNED_REQ_ALT_NAMES}" \
+ -keyout /etc/ssl/private/sa-selfsigned.key \
+ -out /etc/ssl/certs/sa-selfsigned.crt && \
+ apk del openssl
+
+
+FROM nginx_${SSL_VARIANT}
diff --git a/nginx/sa.conf b/nginx/sa.conf
index addc763..de91126 100644
--- a/nginx/sa.conf
+++ b/nginx/sa.conf
@@ -1,5 +1,33 @@
server {
- listen 0.0.0.0:80;
+ listen 80;
+ listen [::]:80;
+
+ return 301 https://$host$request_uri;
+}
+
+server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+ ssl_certificate /etc/ssl/certs/sa-selfsigned.crt;
+ ssl_certificate_key /etc/ssl/private/sa-selfsigned.key;
+ ssl_protocols TLSv1.3;
+ ssl_prefer_server_ciphers on;
+ #ssl_dhparam /etc/nginx/dhparam.pem;
+ ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
+ ssl_ecdh_curve secp384r1;
+ ssl_session_timeout 10m;
+ ssl_session_cache shared:SSL:10m;
+ ssl_session_tickets off;
+ ssl_stapling on;
+ ssl_stapling_verify on;
+ resolver 8.8.8.8 8.8.4.4 valid=300s;
+ resolver_timeout 5s;
+ # Disable strict transport security for now. You can uncomment the following
+ # line if you understand the implications.
+ #add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
+ add_header X-Frame-Options DENY;
+ add_header X-Content-Type-Options nosniff;
+ add_header X-XSS-Protection "1; mode=block";
server_name id.miau.local;
diff --git a/simpleid/www/config.php b/simpleid/www/config.php
index 5d280c7..49aea14 100644
--- a/simpleid/www/config.php
+++ b/simpleid/www/config.php
@@ -29,7 +29,7 @@
* </code>
*
*/
-define('SIMPLEID_BASE_URL', 'http://id.miau.local');
+define('SIMPLEID_BASE_URL', 'https://id.miau.local');
/**
* Allow clean URLs.
diff --git a/sourcearcade.yml b/sourcearcade.yml
index 17b3a20..bff1826 100644
--- a/sourcearcade.yml
+++ b/sourcearcade.yml
@@ -1,9 +1,12 @@
version: "3"
services:
nginx:
- image: nginx:1.25-alpine
+ build:
+ context: .
+ dockerfile: nginx/Dockerfile
ports:
- "80:80"
+ - "443:443"
networks:
- simpleidnet
volumes: