Harden onion boot flow and deepen site surfaces

Add persistent onion key backup and restore, improve startup resilience, and flesh out the major site verticals with richer navigation, search coverage, and operator documentation.

Made-with: Cursor
This commit is contained in:
drjones
2026-04-07 21:35:52 -07:00
parent 52432dccfa
commit 78a071ba02
162 changed files with 21692 additions and 39 deletions

View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -euo pipefail
[[ "${EUID}" -eq 0 ]] || {
echo "Run as root (sudo)."
exit 1
}
REPO="$(cd "$(dirname "$0")/.." && pwd)"
TOR_DIRS_FILE="${REPO}/scripts/generated/tor-dirs.txt"
BACKUP_ROOT="${CYBERLUX_ONION_BACKUP_ROOT:-/var/backups/cyberlux-onion-keys}"
CURRENT_DIR="${BACKUP_ROOT}/current"
if [[ ! -f "${TOR_DIRS_FILE}" ]]; then
echo "Missing ${TOR_DIRS_FILE}. Run the generator first."
exit 1
fi
if [[ ! -d "${CURRENT_DIR}" ]]; then
echo "[*] No onion key backup found at ${CURRENT_DIR}; nothing to restore."
exit 0
fi
mkdir -p /var/lib/tor
restored=0
timestamp="$(date +%s)"
while IFS= read -r dir || [[ -n "${dir}" ]]; do
[[ -z "${dir}" ]] && continue
src="${CURRENT_DIR}/${dir}"
dst="/var/lib/tor/${dir}"
[[ -d "${src}" ]] || continue
if [[ -d "${dst}" ]] && [[ -s "${dst}/hostname" ]]; then
continue
fi
if [[ -e "${dst}" ]]; then
mv "${dst}" "${dst}.stale.${timestamp}"
fi
cp -a "${src}" "${dst}"
((restored++)) || true
done < "${TOR_DIRS_FILE}"
if (( restored == 0 )); then
echo "[*] Onion key restore check complete; nothing was missing."
else
echo "[*] Restored ${restored} onion service directories from backup."
fi