Harden installation and runtime diagnostics

This commit is contained in:
v3d 2026-06-29 21:43:47 +02:00
parent 34b4c4b036
commit ed0b168ab6
14 changed files with 748 additions and 213 deletions

View file

@ -4,7 +4,6 @@ source /usr/local/lib/pivilion/common.sh
[ "$(id -u)" -eq 0 ] || exec sudo "$0" "$@"
pivilion_load_config
pivilion_set_mode onion
rm -f "$PIVILION_WEBROOT/gen/.htaccess"
echo "Pivilion will start in onion mode after the next reboot."
if [ -s "$PIVILION_DIR/torname" ]; then
printf 'Your onion domain is %s\n' "$(tr -d '\r\n' < "$PIVILION_DIR/torname")"

View file

@ -3,11 +3,22 @@ set -euo pipefail
source /usr/local/lib/pivilion/common.sh
pivilion_load_config
case "${1:-status}" in
status) [ "$#" -le 1 ] || { echo "Usage: pivilion [status|diagnose [--json]]" >&2; exit 2; } ;;
diagnose) shift; exec /usr/local/lib/pivilion/diagnose.sh "$@" ;;
*) echo "Usage: pivilion [status|diagnose [--json]]" >&2; exit 2 ;;
esac
pivilion_print_motd
failure=$(pivilion_state_value failure none)
cat <<EOF
Web root: $PIVILION_WEBROOT
Apache: $(pivilion_service_state apache2)
Tor: $(if systemctl cat tor@default.service >/dev/null 2>&1; then pivilion_service_state tor@default.service; else pivilion_service_state tor.service; fi)
Last activation failure: $failure
Commands:
pivilion show this status
@ -18,5 +29,6 @@ Commands:
static convert the current gallery to static files
hotglue install or restore Hotglue
htaccess reset or remove captive redirect rules
pivilion-diagnose check captive DNS, HTTP redirects, and services
pivilion diagnose [--json] check networking, redirects, and services
pivilion-diagnose compatibility alias for diagnostics
EOF

View file

@ -1,4 +1,3 @@
#!/bin/bash
set -euo pipefail
[ "$(id -u)" -eq 0 ] || exec sudo "$0" "$@"
exec /usr/local/lib/pivilion/mode.sh diagnose
exec /usr/local/lib/pivilion/diagnose.sh "$@"