changeset 2096:c5b2b0bb841e ssltesting tip

inline update_ssl_conf.sh
author Violet7
date Mon, 15 Dec 2025 19:28:17 -0800
parents 69b9d536779c
children
files host/local_https.sh host/update.sh host/update_ssl_conf.sh
diffstat 3 files changed, 12 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/host/local_https.sh	Sun Dec 14 20:02:02 2025 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#!/bin/bash
-set -e
-
-DOMAIN=$1
-
-cd sites/$DOMAIN
-
-openssl req -x509 -newkey rsa:2048 -nodes -keyout "$DOMAIN.key" -out fullchain.cer -days 365 \
-	-subj "/CN=$DOMAIN" \
-	-addext "subjectAltName=DNS:$DOMAIN,IP:127.0.0.1"
--- a/host/update.sh	Sun Dec 14 20:02:02 2025 -0700
+++ b/host/update.sh	Mon Dec 15 19:28:17 2025 -0800
@@ -2,6 +2,9 @@
 
 set -e
 
+SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)"
+cd $SCRIPT_DIR
+
 ./stop.sh
 
 echo Updating hg
@@ -15,8 +18,8 @@
 hg identify >logs/changeset.txt
 
 if [ ! -f local/tiny_account.key ]; then
-  echo "Register letsencrypt (tiny-acme)"
-  openssl genrsa 4096 > local/tiny_account.key
+	echo "Register letsencrypt (tiny-acme)"
+	openssl genrsa 4096 >local/tiny_account.key
 fi
 
 cp startup/nginx/mime.types local/mime.types
@@ -24,5 +27,12 @@
 luan startup/nginx/nginx.conf.luan $(pwd) $(whoami) $(id -gn) >local/nginx.conf
 luan startup/nginx/nginx.default.conf.luan $(pwd) >local/nginx.default.conf
 
+# this is done because the nginx conf uses absolute paths
+# and this breaks sites when the luan/host directory is moved
+for conf in sites/*/nginx.ssl.conf; do
+	domain=$(basename $(dirname "$conf"))
+	luan startup/nginx/nginx.ssl.conf.luan $here $domain >$conf
+done
+
 echo Starting...
 ./start.sh
--- a/host/update_ssl_conf.sh	Sun Dec 14 20:02:02 2025 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/bash
-set -e
-
-here=$(pwd)
-
-for conf in sites/*/nginx.ssl.conf; do
-	domain=$(basename $(dirname "$conf"))
-	luan startup/nginx/nginx.ssl.conf.luan $here $domain >$conf
-done