🗃️ Committing everything that changed 🗃️

rootfs/tmp/etc/nginx/nginx.conf
rootfs/tmp/etc/nginx/vhosts.d/
rootfs/tmp/etc/unbound/unbound.conf
rootfs/usr/local/etc/docker/init.d/03-tor-server.sh
rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
rootfs/usr/share/httpd/default/hidden_service.html
This commit is contained in:
casjay
2025-05-01 10:32:45 -04:00
parent 938943e7cf
commit b445cbc0d5
6 changed files with 147 additions and 3 deletions

View File

@@ -189,6 +189,7 @@ __execute_prerun() {
# Define environment
local hostname=${HOSTNAME}
# Define actions/commands
touch "/tmp/init_tor_services"
sleep 30
# allow custom functions
if builtin type -t __execute_prerun_local | grep -q 'function'; then __execute_prerun_local; fi
@@ -232,6 +233,7 @@ __update_conf_files() {
# custom commands
chmod 600 $RUN_DIR
chown -Rf ${SERVICE_USER:-$RUNAS_USER}:${SERVICE_GROUP:-$RUNAS_USER} $RUN_DIR
mkdir -p "/run/tor/sites" && chmod 777 "/run/tor/sites"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# replace variables
@@ -379,9 +381,11 @@ __post_execute() {
url="$(<"$host")"
echo "$name: $url"
echo '<a href="http://'$url'">'$name'</a><br />' >>"$WWW_ROOT_DIR/hostnames.html"
touch "/run/tor/sites/$name"
done
echo "End current hidden services"
fi
[ -f "/tmp/init_tor_services" ] && rm -Rf "/tmp/init_tor_services"
(while :; do sleep 10 && __pgrep $EXEC_CMD_BIN >/dev/null || eval $EXEC_CMD_BIN $EXEC_CMD_ARGS >/dev/null; done &)
# show exit message
__banner "$postMessageEnd: Status $retVal"

View File

@@ -246,7 +246,20 @@ __update_conf_files() {
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# define actions
while [ -f "/tmp/init_tor_services" ]; do sleep 5; done
for onion_site in "/run/tor/sites"/*; do
mkdir -p "/data/htdocs/onions/$onion_site"
if [ "$(ls -A "/data/htdocs/onions/$onion_site" | wc -l)" -eq 0 ]; then
cp -Rf "/usr/share/httpd/default/hidden_service.html" "/data/htdocs/onions/$onion_site/index.html"
fi
if [ ! -f "/etc/nginx/vhosts.d/$onion_site.onion.conf" ]; then
cp -Rf "/etc/nginx/vhosts.d/template" "/etc/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_PORT|'$SERVICE_PORT'|g' "/etc/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_SITE|'$onion_site.onion'|g' "/etc/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/etc/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html"
fi
done
# allow custom functions
if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi
# exit function