More setup script stuff + opentak

This commit is contained in:
2026-11-22 13:02:36 -05:00
parent b4d341389d
commit 137c96bbc0
8 changed files with 472 additions and 337 deletions
-23
View File
@@ -1,23 +0,0 @@
services:
gotak:
image: kdudkov/goatak_server:latest
platform: linux/amd64
container_name: viator-gotak
restart: unless-stopped
volumes:
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/atak:/app
ports:
- "${ATAK_WEB_BIND:-127.0.0.1}:${ATAK_WEB_PORT:-8089}:8080"
- "${ATAK_DATA_BIND:-0.0.0.0}:5222:8999"
- "${ATAK_DATA_BIND:-0.0.0.0}:1100:8088"
networks:
- proxy
labels:
caddy: atak.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 8080}}"
caddy.tls: internal
networks:
proxy:
external: true
name: viator_proxy
+5 -11
View File
@@ -10,17 +10,11 @@ services:
- >- - >-
set api.rest.username '${BETTERCAP_USER:-viator}'; set api.rest.username '${BETTERCAP_USER:-viator}';
set api.rest.password '${BETTERCAP_PASSWORD:?Set BETTERCAP_PASSWORD in viator.env}'; set api.rest.password '${BETTERCAP_PASSWORD:?Set BETTERCAP_PASSWORD in viator.env}';
set api.rest.address '${VIATOR_DOCKER_GATEWAY:-172.17.0.1}'; set api.rest.address '${BETTERCAP_UI_ADDR:-${VIATOR_DOCKER_GATEWAY:-172.17.0.1}}';
set api.rest.port 8081; set api.rest.port ${BETTERCAP_API_PORT:-8081};
set api.rest.alloworigin 'https://bettercap.${VIATOR_DOMAIN:-viator.internal}'; set api.rest.alloworigin '${BETTERCAP_ALLOW_ORIGIN:-https://${VIATOR_SUB_BETTERCAP:-bettercap}.${VIATOR_DOMAIN:-viator.internal}}';
api.rest on; api.rest on;
set ui.address '${VIATOR_DOCKER_GATEWAY:-172.17.0.1}'; set ui.address '${BETTERCAP_UI_ADDR:-${VIATOR_DOCKER_GATEWAY:-172.17.0.1}}';
set ui.port 1600; set ui.port ${BETTERCAP_UI_PORT:-1600};
ui on; ui on;
set gps.device localhost:2947; set gps.device localhost:2947;
labels:
caddy: bettercap.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: host.docker.internal:1600
caddy_1: api.bettercap.${VIATOR_DOMAIN:-viator.internal}
caddy_1.reverse_proxy: host.docker.internal:8081
+27 -25
View File
@@ -1,29 +1,31 @@
services: services:
caddy: caddy:
image: lucaslorentz/caddy-docker-proxy:2.9-alpine image: lucaslorentz/caddy-docker-proxy:2.9-alpine
container_name: viator-caddy container_name: viator-caddy
restart: unless-stopped restart: unless-stopped
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
environment: environment:
CADDY_INGRESS_NETWORKS: viator_proxy CADDY_INGRESS_NETWORKS: viator_proxy
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/caddy/data:/data - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/caddy/data:/data
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/caddy/config:/config - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/caddy/config:/config
networks: networks:
- proxy - proxy
labels: labels:
caddy: bettercap.${VIATOR_DOMAIN:-viator.internal} caddy: ${VIATOR_SUB_BETTERCAP:-bettercap}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: host.docker.internal:1600 caddy.reverse_proxy: host.docker.internal:${BETTERCAP_UI_PORT:-1600}
caddy.tls: internal
caddy_1: api.bettercap.${VIATOR_DOMAIN:-viator.internal} caddy_1: ${VIATOR_SUB_BETTERCAP_API:-api.bettercap}.${VIATOR_DOMAIN:-viator.internal}
caddy_1.reverse_proxy: host.docker.internal:8081 caddy_1.reverse_proxy: host.docker.internal:${BETTERCAP_API_PORT:-8081}
caddy_1.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: viator_proxy
+49 -49
View File
@@ -1,53 +1,53 @@
services: services:
harness: harness:
image: git.zakscode.com/ztimson/ai-harness:latest image: git.zakscode.com/ztimson/ai-harness:latest
container_name: viator-ai-harness container_name: viator-ai-harness
restart: unless-stopped restart: unless-stopped
environment: environment:
PUID: ${PUID:-1000} PUID: ${PUID:-1000}
PGID: ${PGID:-1000} PGID: ${PGID:-1000}
PUBLIC_URL: home.${VIATOR_DOMAIN:-viator.internal} PUBLIC_URL: ${VIATOR_HOST_HARNESS:-${VIATOR_SUB_HARNESS:-home}.${VIATOR_DOMAIN:-viator.internal}}
OFFICE_URL: office.${VIATOR_DOMAIN:-viator.internal} OFFICE_URL: ${VIATOR_HOST_OFFICE:-${VIATOR_SUB_OFFICE:-office}.${VIATOR_DOMAIN:-viator.internal}}
OFFICE_SECRET: ${OFFICE_JWT_SECRET:?Office secret is required} OFFICE_SECRET: ${OFFICE_JWT_SECRET:?Office secret is required}
volumes: volumes:
- ${VIATOR_FILES_ROOT:-/mnt}:/mnt - ${VIATOR_FILES_ROOT:-/mnt}:/mnt
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/models:/models - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/models:/models
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/AI:/AI - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/AI:/AI
ports: ports:
- "${WEB_BIND:-127.0.0.1}:${HARNESS_PORT:-8082}:80" - "${WEB_BIND:-127.0.0.1}:${HARNESS_PORT:-8082}:80"
networks: networks:
- proxy - proxy
labels: labels:
caddy: home.${VIATOR_DOMAIN:-viator.internal} caddy: ${VIATOR_SUB_HARNESS:-home}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 80}}" caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: internal caddy.tls: internal
caddy.reverse_proxy.lb_policy: client_ip_hash caddy.reverse_proxy.lb_policy: client_ip_hash
caddy.reverse_proxy.stream_close_delay: 24h caddy.reverse_proxy.stream_close_delay: 24h
onlyoffice: onlyoffice:
image: onlyoffice/documentserver:latest image: onlyoffice/documentserver:latest
container_name: viator-onlyoffice container_name: viator-onlyoffice
restart: unless-stopped restart: unless-stopped
environment: environment:
JWT_ENABLED: "true" JWT_ENABLED: "true"
JWT_SECRET: ${OFFICE_JWT_SECRET:?Office secret is required} JWT_SECRET: ${OFFICE_JWT_SECRET:?Office secret is required}
volumes: volumes:
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/data:/var/www/onlyoffice/Data - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/data:/var/www/onlyoffice/Data
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/logs:/var/log/onlyoffice - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/logs:/var/log/onlyoffice
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/lib:/var/lib/onlyoffice - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/lib:/var/lib/onlyoffice
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/db:/var/lib/postgresql - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/db:/var/lib/postgresql
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/rabbitmq:/var/lib/rabbitmq - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/rabbitmq:/var/lib/rabbitmq
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/redis:/var/lib/redis - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/redis:/var/lib/redis
ports: ports:
- "${WEB_BIND:-127.0.0.1}:${OFFICE_PORT:-8083}:80" - "${WEB_BIND:-127.0.0.1}:${OFFICE_PORT:-8083}:80"
networks: networks:
- proxy - proxy
labels: labels:
caddy: office.${VIATOR_DOMAIN:-viator.internal} caddy: ${VIATOR_SUB_OFFICE:-office}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 80}}" caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: internal caddy.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: viator_proxy
+21 -21
View File
@@ -1,24 +1,24 @@
services: services:
librespeed: librespeed:
image: lscr.io/linuxserver/librespeed:latest image: lscr.io/linuxserver/librespeed:latest
container_name: viator-librespeed container_name: viator-librespeed
restart: unless-stopped restart: unless-stopped
environment: environment:
PUID: ${PUID:-1000} PUID: ${PUID:-1000}
PGID: ${PGID:-1000} PGID: ${PGID:-1000}
TZ: ${TZ:-Etc/UTC} TZ: ${TZ:-Etc/UTC}
volumes: volumes:
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/librespeed:/config - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/librespeed:/config
ports: ports:
- "${LIBRESPEED_BIND:-127.0.0.1}:${LIBRESPEED_PORT:-1900}:80" - "${LIBRESPEED_BIND:-127.0.0.1}:${LIBRESPEED_PORT:-1900}:80"
networks: networks:
- proxy - proxy
labels: labels:
caddy: speedtest.${VIATOR_DOMAIN:-viator.internal} caddy: ${VIATOR_SUB_SPEEDTEST:-speedtest}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 80}}" caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: internal caddy.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: viator_proxy
+53 -49
View File
@@ -1,54 +1,58 @@
services: services:
cartomake: cartomake:
image: git.zakscode.com/ztimson/cartomake:latest image: git.zakscode.com/ztimson/cartomake:latest
container_name: viator-cartomake container_name: viator-cartomake
restart: unless-stopped restart: unless-stopped
environment: environment:
TILESERVER_URL: tiles.${VIATOR_DOMAIN:-viator.internal} TILESERVER_URL: ${VIATOR_HOST_TILES:-${VIATOR_SUB_TILES:-tiles}.${VIATOR_DOMAIN:-viator.internal}}
GEOCODE_URL: geocode.${VIATOR_DOMAIN:-viator.internal} GEOCODE_URL: ${VIATOR_HOST_GEOCODE:-${VIATOR_SUB_GEOCODE:-geocode}.${VIATOR_DOMAIN:-viator.internal}}
ports: ports:
- "${CARTOMAKE_BIND:-127.0.0.1}:${CARTOMAKE_PORT:-8080}:80" - "${CARTOMAKE_BIND:-127.0.0.1}:${CARTOMAKE_PORT:-8020}:80"
networks: networks:
- proxy - proxy
labels: labels:
caddy: maps.${VIATOR_DOMAIN:-viator.internal} caddy: ${VIATOR_SUB_MAPS:-maps}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 80}}" caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: internal caddy.tls: internal
photon: photon:
image: rtuszik/photon-docker:latest image: rtuszik/photon-docker:latest
container_name: viator-photon container_name: viator-photon
restart: unless-stopped restart: unless-stopped
profiles: [photon] profiles: [photon]
environment: environment:
UPDATE_STRATEGY: PARALLEL UPDATE_STRATEGY: PARALLEL
UPDATE_INTERVAL: 720h UPDATE_INTERVAL: 720h
volumes: volumes:
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/geocoder:/photon/data - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/geocoder:/photon/data
networks: ports:
- proxy - "${PHOTON_BIND:-127.0.0.1}:${PHOTON_PORT:-8022}:2322"
labels: networks:
caddy: geocode.${VIATOR_DOMAIN:-viator.internal} - proxy
caddy.reverse_proxy: "{{upstreams 2322}}" labels:
caddy.tls: internal caddy: ${VIATOR_SUB_GEOCODE:-geocode}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 2322}}"
caddy.tls: internal
tileserver: tileserver:
image: maptiler/tileserver-gl:v4.11.0 image: maptiler/tileserver-gl:v4.11.0
container_name: viator-tileserver container_name: viator-tileserver
restart: unless-stopped restart: unless-stopped
profiles: [tiles] profiles: [tiles]
command: ["--config", "/config/config.json"] command: ["--config", "/config/config.json"]
volumes: volumes:
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/tiles:/data - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/tiles:/data
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/tileserver:/config:ro - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/tileserver:/config:ro
networks: ports:
- proxy - "${TILESERVER_BIND:-127.0.0.1}:${TILESERVER_PORT:-8021}:8080"
labels: networks:
caddy: tiles.${VIATOR_DOMAIN:-viator.internal} - proxy
caddy.reverse_proxy: "{{upstreams 8080}}" labels:
caddy.tls: internal caddy: ${VIATOR_SUB_TILES:-tiles}.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 8080}}"
caddy.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: viator_proxy
+25 -80
View File
@@ -1,83 +1,28 @@
services: services:
openwebrx: openwebrx:
image: jketterl/openwebrx:stable image: ${OPENWEBRX_IMAGE:-slechev/openwebrxplus-softmbe:latest}
container_name: viator-openwebrx container_name: viator-openwebrx
restart: unless-stopped restart: unless-stopped
profiles: [openwebrx] environment:
devices: TZ: ${TZ:-Etc/UTC}
- /dev/bus/usb:/dev/bus/usb OPENWEBRX_ADMIN_USER: ${OPENWEBRX_ADMIN_USER:-admin}
volumes: OPENWEBRX_ADMIN_PASSWORD: ${OPENWEBRX_ADMIN_PASSWORD:?Set OPENWEBRX_ADMIN_PASSWORD in viator.env}
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/openwebrx:/var/lib/openwebrx volumes:
tmpfs: - /dev/bus/usb:/dev/bus/usb
- /tmp/openwebrx - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/openwebrx/etc:/etc/openwebrx
ports: - ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/openwebrx/var:/var/lib/openwebrx
- "${SDR_BIND:-127.0.0.1}:${OPENWEBRX_PORT:-8073}:8073" device_cgroup_rules:
networks: - "c 189:* rmw"
- proxy ports:
labels: - "${OPENWEBRX_BIND:-127.0.0.1}:${OPENWEBRX_PORT:-8073}:8073"
caddy: sdr.${VIATOR_DOMAIN:-viator.internal} networks:
caddy.reverse_proxy: "{{upstreams 8073}}" - proxy
caddy.tls: internal labels:
caddy: ${VIATOR_SUB_SDR:-sdr}.${VIATOR_DOMAIN:-viator.internal}
ultrafeeder: caddy.reverse_proxy: "{{upstreams 8073}}"
image: ghcr.io/sdr-enthusiasts/docker-adsb-ultrafeeder:latest caddy.tls: internal
container_name: viator-ultrafeeder
hostname: ultrafeeder
restart: unless-stopped
profiles: [adsb]
device_cgroup_rules:
- "c 189:* rwm"
devices:
- /dev/bus/usb:/dev/bus/usb
environment:
TZ: ${TZ:-Etc/UTC}
LOGLEVEL: error
READSB_DEVICE_TYPE: rtlsdr
READSB_GAIN: autogain
READSB_LAT: ${FEEDER_LAT:-}
READSB_LON: ${FEEDER_LONG:-}
READSB_RX_LOCATION_ACCURACY: "2"
READSB_STATS_RANGE: "true"
TAR1090_DEFAULTCENTERLAT: ${FEEDER_LAT:-0}
TAR1090_DEFAULTCENTERLON: ${FEEDER_LONG:-0}
TAR1090_PAGETITLE: ${FEEDER_NAME:-Viator ADS-B}
TAR1090_MESSAGERATEINTITLE: "true"
TAR1090_PLANECOUNTINTITLE: "true"
TAR1090_ENABLE_AC_DB: "true"
TAR1090_FLIGHTAWARELINKS: "true"
TAR1090_SITESHOW: "true"
GRAPHS1090_DARKMODE: "true"
volumes:
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/adsb/globe_history:/var/globe_history
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/adsb/graphs1090:/var/lib/collectd
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/adsb/autogain:/run/autogain
- /proc/diskstats:/proc/diskstats:ro
tmpfs:
- /run:exec,size=256M
- /tmp:size=128M
- /var/log:size=32M
ports:
- "${SDR_BIND:-127.0.0.1}:${TAR1090_PORT:-8078}:80"
- "${ADSB_BEAST_BIND:-127.0.0.1}:30005:30005"
networks:
- proxy
labels:
caddy: adsb.${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: internal
rtl433:
image: hertzg/rtl_433:latest
container_name: viator-rtl433
restart: unless-stopped
profiles: [rtl433]
devices:
- /dev/bus/usb:/dev/bus/usb
environment:
TZ: ${TZ:-Etc/UTC}
command: ["-M", "time:unix:usec:utc", "-M", "protocol", "-F", "json"]
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: viator_proxy
+292 -79
View File
@@ -14,6 +14,7 @@ TMP_DIR=""
LOCK_FILE="/run/lock/viator-install.lock" LOCK_FILE="/run/lock/viator-install.lock"
APT_UPGRADE="no" APT_UPGRADE="no"
USE_CADDY="no" USE_CADDY="no"
VIATOR_DOMAIN="${VIATOR_DOMAIN:-viator.internal}"
ADMIN_USER="${SUDO_USER:-${USER:-root}}" ADMIN_USER="${SUDO_USER:-${USER:-root}}"
FAILED=() FAILED=()
SUCCEEDED=() SUCCEEDED=()
@@ -82,20 +83,73 @@ ask_password() {
} }
save_env() { save_env() {
local key value local key value line sed_line
for key in "$@"; do for key in "$@"; do
value="${!key-}" value="${!key-}"
value="${value//\\/\\\\}" value="${value//\\/\\\\}"
value="${value//\"/\\\"}" value="${value//\"/\\\"}"
line="${key}=\"${value}\""
if grep -q "^${key}=" "$ENV_FILE"; then if grep -q "^${key}=" "$ENV_FILE"; then
sed -i "s|^${key}=.*|${key}=\"${value}\"|" "$ENV_FILE" sed_line="${line//\\/\\\\}"
sed_line="${sed_line//&/\\&}"
sed_line="${sed_line//|/\\|}"
sed -i "s|^${key}=.*|${sed_line}|" "$ENV_FILE"
else else
printf '%s="%s"\n' "$key" "$value" >> "$ENV_FILE" printf '%s\n' "$line" >> "$ENV_FILE"
fi fi
done done
chmod 0600 "$ENV_FILE" chmod 0600 "$ENV_FILE"
} }
# Plain KEY=value writer for third-party project .env files (no quoting).
env_put() {
local file="$1" key="$2" value="$3"
touch "$file"
if grep -q "^${key}=" "$file"; then
local esc="${value//\\/\\\\}"; esc="${esc//&/\\&}"; esc="${esc//|/\\|}"
sed -i "s|^${key}=.*|${key}=${esc}|" "$file"
else
printf '%s=%s\n' "$key" "$value" >> "$file"
fi
}
valid_sub() { [[ "$1" =~ ^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$ ]]; }
valid_port() { [[ "$1" =~ ^[0-9]+$ ]] && (( $1 >= 1 && $1 <= 65535 )); }
# expose KEY "Label" default_subdomain default_port BIND_VAR PORT_VAR [need_host]
#
# Network model (decided once in configure_docker via USE_CADDY):
# Caddy mode -> ask for a subdomain; container ports stay on 127.0.0.1;
# Caddy routes <subdomain>.<VIATOR_DOMAIN> with internal TLS.
# Own-proxy mode -> ask for a host port; bind 0.0.0.0 so the user's reverse proxy
# can reach it. If need_host=yes, also ask for the public
# hostname (used in links between services).
# Writes VIATOR_SUB_<KEY>, VIATOR_HOST_<KEY>, <BIND_VAR>, <PORT_VAR> to viator.env.
expose() {
local key="$1" label="$2" dsub="$3" dport="$4" bindvar="$5" portvar="$6" need_host="${7:-no}"
local subvar="VIATOR_SUB_$key" hostvar="VIATOR_HOST_$key" sub port host
if [[ "$USE_CADDY" == yes ]]; then
sub="$(ask_input "$label" "Subdomain (served as <subdomain>.$VIATOR_DOMAIN):" "${!subvar:-$dsub}")" || return 1
sub="${sub,,}"
valid_sub "$sub" || { msg "Invalid subdomain: '$sub'"; return 1; }
printf -v "$subvar" '%s' "$sub"
printf -v "$hostvar" '%s' ""
printf -v "$bindvar" '%s' "127.0.0.1"
printf -v "$portvar" '%s' "${!portvar:-$dport}"
else
port="$(ask_input "$label" "Host port (your reverse proxy should forward to this):" "${!portvar:-$dport}")" || return 1
valid_port "$port" || { msg "Invalid port: '$port'"; return 1; }
printf -v "$bindvar" '%s' "0.0.0.0"
printf -v "$portvar" '%s' "$port"
host="${!hostvar:-}"
if [[ "$need_host" == yes ]]; then
host="$(ask_input "$label" "Public hostname your reverse proxy serves this on (no scheme, e.g. maps.example.com):" "$host")" || return 1
fi
printf -v "$hostvar" '%s' "$host"
fi
save_env "$subvar" "$hostvar" "$bindvar" "$portvar"
}
apt_install() { apt_install() {
local packages=("$@") local packages=("$@")
((${#packages[@]})) || return 0 ((${#packages[@]})) || return 0
@@ -174,17 +228,19 @@ choose_components() {
"wireguard" "WireGuard VPN" "wireguard" "WireGuard VPN"
"fallback-ap" "Fallback wireless access point" "fallback-ap" "Fallback wireless access point"
"vnc" "VNC remote desktop" "vnc" "VNC remote desktop"
"ai" "Local AI (LiteRT + Gemma)" "ai" "Local AI (LiteRT)"
"hat" "Wireless HAT (GPS, LoRa, RTC, SDR)" "hat" "Wireless HAT (GPS, LoRa, RTC, SDR)"
"docker" "Docker Engine and Caddy options" "docker" "Docker Engine and networking (Caddy / own proxy)"
"pentest" "Pen Test Suite (host tools + Bettercap)" "pentest" "Pen Test Suite (host tools + Bettercap)"
"speedtest" "LibreSpeed" "speedtest" "LibreSpeed"
"atak" "GoATAK Server" "opentak" "OpenTAK Server (ATAK)"
"maps" "Maps (Cartomake, Photon, TileServer GL)" "maps" "Maps (Cartomake, Photon, TileServer GL)"
"personal-cloud" "Personal Cloud (AI Harness + OnlyOffice)" "personal-cloud" "Personal Cloud (AI, file editing, note taking, zim reader)"
"sdr" "SDR services (OpenWebRX+, ADS-B, RTL_433)" "sdr" "SDR services (OpenWebRX+, ADS-B, RTL_433)"
"zims" "ZIM Archives" "zims" "Download ZIM Archives"
) )
# Migrate selections from the retired GoATAK component.
sed -i 's/^atak$/opentak/' "$STATE_FILE"
for ((i=0; i<${#labels[@]}; i+=2)); do for ((i=0; i<${#labels[@]}; i+=2)); do
item="${labels[i]}" item="${labels[i]}"
if grep -qx "$item" "$STATE_FILE"; then choices+=("$item" "${labels[i+1]}" ON) if grep -qx "$item" "$STATE_FILE"; then choices+=("$item" "${labels[i+1]}" ON)
@@ -201,6 +257,11 @@ choose_components() {
contains() { local needle="$1" x; for x in "${SELECTED[@]}"; do [[ "$x" == "$needle" ]] && return 0; done; return 1; } contains() { local needle="$1" x; for x in "${SELECTED[@]}"; do [[ "$x" == "$needle" ]] && return 0; done; return 1; }
needs_docker() {
contains docker || contains pentest || contains speedtest || contains opentak \
|| contains maps || contains personal-cloud || contains sdr
}
configure_global() { configure_global() {
local root user upgrade local root user upgrade
root="$(ask_input "Storage" "Docker/application data root:" "$DATA_ROOT")" || exit 0 root="$(ask_input "Storage" "Docker/application data root:" "$DATA_ROOT")" || exit 0
@@ -223,24 +284,65 @@ install_tools() { apt_install btop jq tmux; }
install_theme() { install_theme() {
local motd="/etc/motd" marker_start="# >>> VIATOR BANNER >>>" marker_end="# <<< VIATOR BANNER <<<" local motd="/etc/motd" marker_start="# >>> VIATOR BANNER >>>" marker_end="# <<< VIATOR BANNER <<<"
local tmp="$TMP_DIR/motd" local tmp="$TMP_DIR/motd"
touch "$motd"
awk -v s="$marker_start" -v e="$marker_end" 'BEGIN{skip=0} $0==s{skip=1;next} $0==e{skip=0;next} !skip{print}' "$motd" > "$tmp"
cat >> "$tmp" <<'BANNER'
# >>> VIATOR BANNER >>>
__ ___ _ _____ ___ ____
\ \ / / | | ||_ _/ _ \| _ \
\ \ / /| | | | | || | | | |_) |
\ V / | |__| | | || |_| | _ <
\_/ \____/ |_| \___/|_| \_\
OFF-GRID SYSTEMS # Clean old static banner from /etc/motd if present
# <<< VIATOR BANNER <<< if [ -f "$motd" ]; then
BANNER awk -v s="$marker_start" -v e="$marker_end" 'BEGIN{skip=0} $0==s{skip=1;next} $0==e{skip=0;next} !skip{print}' "$motd" > "$tmp"
cp -a "$motd" "$motd.viator-backup.$(date +%s)" cp -a "$motd" "$motd.viator-backup.$(date +%s)"
install -m 0644 "$tmp" "$motd" install -m 0644 "$tmp" "$motd"
fi
cat > /etc/profile.d/viator.sh <<'PROMPT' cat > /etc/profile.d/viator.sh <<'PROMPT'
# Viator system-wide interactive Bash prompt. # Viator / OpsBox system-wide interactive Bash banner & prompt.
case $- in *i*) ;; *) return ;; esac case $- in *i*) ;; *) return ;; esac
_opsbox_iface() {
local iface="$1"
if [ -d "/sys/class/net/$iface" ]; then
local state ip
state=$(tr '[:lower:]' '[:upper:]' < "/sys/class/net/$iface/operstate" 2>/dev/null)
ip=$(ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}' | cut -d/ -f1 | head -n1)
if [ "$state" = "UP" ]; then
echo "UP${ip:+ ($ip)}"
else
echo "${state:-DOWN}"
fi
else
echo "N/A"
fi
}
_opsbox_banner() {
local host_node curr_user primary_ip eth0_stat wifi0_stat wifi1_stat last_log
host_node=$(hostname -s 2>/dev/null || echo "LOCALHOST")
curr_user=$(whoami)
primary_ip=$(hostname -I 2>/dev/null | awk '{print $1}')
primary_ip=${primary_ip:-"127.0.0.1"}
eth0_stat=$(_opsbox_iface "eth0")
wifi0_stat=$(_opsbox_iface "wifi0")
wifi1_stat=$(_opsbox_iface "wifi1")
[ "$wifi0_stat" = "N/A" ] && [ -d "/sys/class/net/wlan0" ] && wifi0_stat=$(_opsbox_iface "wlan0")
[ "$wifi1_stat" = "N/A" ] && [ -d "/sys/class/net/wlan1" ] && wifi1_stat=$(_opsbox_iface "wlan1")
last_log=$(last -n 2 -w "$curr_user" 2>/dev/null | awk 'NR==2 {print $4" "$5" "$6" "$7" ("$3")"}')
last_log=${last_log:-"FIRST_SESSION // TTY"}
printf ".-[ 0PSB0X ]--------------------------------------------------.\n"
printf "|:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|\n"
printf "| >> SYSTEM : %-16s // [STATUS: 0NL1N3] |\n" "$host_node"
printf "| >> ACCESS : %-16s // IP: %-21s |\n" "${curr_user^^}" "$primary_ip"
printf "| >> ETH0 : %-44s |\n" "$eth0_stat"
printf "| >> WIFI0 : %-44s |\n" "$wifi0_stat"
printf "| >> WIFI1 : %-44s |\n" "$wifi1_stat"
printf "| >> LAST : %-44s |\n" "$last_log"
printf "\`-------------------------------------------------[░▒▓█]------'\n"
}
_opsbox_banner
unset -f _opsbox_banner _opsbox_iface
LINES="\[\e[36m\]" LINES="\[\e[36m\]"
[ "$EUID" -eq 0 ] && LINES="\[\e[91m\]" [ "$EUID" -eq 0 ] && LINES="\[\e[91m\]"
USERHOST="\[\e[33m\]" USERHOST="\[\e[33m\]"
@@ -248,6 +350,7 @@ DIRECTORY="\[\e[97m\]"
ENDCOLOR="\[\e[m\]" ENDCOLOR="\[\e[m\]"
PS1="${LINES}╭──(${USERHOST}\u${LINES}@${USERHOST}\h${LINES})-[${DIRECTORY}\w${LINES}]${ENDCOLOR}\n${LINES}╰─${ENDCOLOR}\$ " PS1="${LINES}╭──(${USERHOST}\u${LINES}@${USERHOST}\h${LINES})-[${DIRECTORY}\w${LINES}]${ENDCOLOR}\n${LINES}╰─${ENDCOLOR}\$ "
PROMPT PROMPT
chmod 0644 /etc/profile.d/viator.sh
} }
install_wireguard() { install_wireguard() {
@@ -378,7 +481,7 @@ install_caddy() {
mkdir -p "$DATA_ROOT/caddy/data" "$DATA_ROOT/caddy/config" mkdir -p "$DATA_ROOT/caddy/data" "$DATA_ROOT/caddy/config"
docker network inspect viator_proxy >/dev/null 2>&1 || docker network create viator_proxy >/dev/null docker network inspect viator_proxy >/dev/null 2>&1 || docker network create viator_proxy >/dev/null
local compose="$VIATOR_DIR/docker/caddy.yml" local compose="$VIATOR_DIR/docker/caddy.yml"
VIATOR_DATA_ROOT="$DATA_ROOT" docker compose -f "$compose" up -d VIATOR_DATA_ROOT="$DATA_ROOT" docker compose --env-file "$ENV_FILE" -f "$compose" up -d
} }
export_caddy_ca() { export_caddy_ca() {
@@ -393,16 +496,51 @@ export_caddy_ca() {
else warn "Caddy's local root CA is not available yet; export it after the first HTTPS route is active."; fi else warn "Caddy's local root CA is not available yet; export it after the first HTTPS route is active."; fi
} }
# Bettercap runs with host networking, so it needs its own listen-address/port
# settings. Caddy's routes for it live in docker/caddy.yml, which is why this is
# asked before Caddy is (re)started.
configure_bettercap_net() {
local sub api addr ui api_port origin
BETTERCAP_UI_PORT="${BETTERCAP_UI_PORT:-1600}"
BETTERCAP_API_PORT="${BETTERCAP_API_PORT:-8081}"
if [[ "$USE_CADDY" == yes ]]; then
sub="$(ask_input "Bettercap UI" "Subdomain (served as <subdomain>.$VIATOR_DOMAIN):" "${VIATOR_SUB_BETTERCAP:-bettercap}")" || return 1
api="$(ask_input "Bettercap API" "API subdomain (served as <subdomain>.$VIATOR_DOMAIN):" "${VIATOR_SUB_BETTERCAP_API:-api.bettercap}")" || return 1
sub="${sub,,}"; api="${api,,}"
valid_sub "$sub" && valid_sub "$api" || { msg "Invalid subdomain."; return 1; }
VIATOR_SUB_BETTERCAP="$sub"; VIATOR_SUB_BETTERCAP_API="$api"
BETTERCAP_UI_ADDR="" # empty -> Docker gateway (only reachable through Caddy)
BETTERCAP_ALLOW_ORIGIN="" # empty -> https://<sub>.<domain>
else
addr="$(ask_input "Bettercap" "Address for the UI/API to listen on (0.0.0.0 = all interfaces):" "${BETTERCAP_UI_ADDR:-0.0.0.0}")" || return 1
ui="$(ask_input "Bettercap" "UI port:" "$BETTERCAP_UI_PORT")" || return 1
api_port="$(ask_input "Bettercap" "API port:" "$BETTERCAP_API_PORT")" || return 1
valid_port "$ui" && valid_port "$api_port" || { msg "Invalid port."; return 1; }
origin="$(ask_input "Bettercap" "Public URL of the UI (CORS origin for the API, e.g. https://bettercap.example.com):" "${BETTERCAP_ALLOW_ORIGIN:-http://$(hostname):$ui}")" || return 1
BETTERCAP_UI_ADDR="$addr"; BETTERCAP_UI_PORT="$ui"; BETTERCAP_API_PORT="$api_port"
BETTERCAP_ALLOW_ORIGIN="$origin"
fi
save_env VIATOR_SUB_BETTERCAP VIATOR_SUB_BETTERCAP_API BETTERCAP_UI_ADDR BETTERCAP_UI_PORT BETTERCAP_API_PORT BETTERCAP_ALLOW_ORIGIN
}
configure_docker() { configure_docker() {
local engine caddy local engine=no caddy=no domain
engine="$(whiptail --title "Docker" --yesno "Install or configure Docker Engine? (Required for container packages)" 10 76 3>&1 1>&2 2>&3 && echo yes || echo no)" if ask_yes "Install or configure Docker Engine? (Required for container packages)"; then engine=yes; fi
caddy="$(whiptail --title "Docker" --yesno "Install Caddy Docker Proxy for local HTTPS hostnames (.home.arpa)?" 10 76 3>&1 1>&2 2>&3 && echo yes || echo no)" if ask_yes "Networking mode\n\nYES = Install Caddy: services get <subdomain>.<domain> names with internal HTTPS certificates (no existing reverse proxy).\n\nNO = I already have a reverse proxy: services are published on host ports for it to forward to."; then caddy=yes; fi
if [[ "$engine" == yes || "$caddy" == yes ]] || contains speedtest || contains atak || contains maps || contains personal-cloud || contains sdr || contains pentest; then USE_CADDY="$caddy"
if [[ "$USE_CADDY" == yes ]]; then
domain="$(ask_input "Domain" "Base domain for local HTTPS hostnames (services become <subdomain>.<domain>):" "$VIATOR_DOMAIN")" || return 1
domain="${domain,,}"
valid_sub "$domain" || { msg "Invalid domain: '$domain'"; return 1; }
VIATOR_DOMAIN="$domain"
save_env VIATOR_DOMAIN
fi
save_env USE_CADDY
if contains pentest; then configure_bettercap_net || return 1; fi
if [[ "$engine" == yes || "$caddy" == yes ]] || needs_docker; then
install_docker_engine || return 1 install_docker_engine || return 1
fi fi
USE_CADDY="$caddy"
if [[ "$USE_CADDY" == yes ]]; then install_caddy || return 1; fi if [[ "$USE_CADDY" == yes ]]; then install_caddy || return 1; fi
save_env USE_CADDY
} }
compose_stack() { compose_stack() {
@@ -417,41 +555,87 @@ compose_stack() {
} }
install_speedtest() { install_speedtest() {
local bind=127.0.0.1 port="${LIBRESPEED_PORT:-1900}" expose SPEEDTEST "LibreSpeed" speedtest 1900 LIBRESPEED_BIND LIBRESPEED_PORT no || return 1
if [[ "$USE_CADDY" != yes ]]; then
bind=0.0.0.0
port="$(ask_input "LibreSpeed" "Host port for the speed test UI:" "$port")" || return 1
fi
LIBRESPEED_BIND="$bind" LIBRESPEED_PORT="$port"
save_env LIBRESPEED_BIND LIBRESPEED_PORT
compose_stack librespeed docker/librespeed.yml "$ENV_FILE" compose_stack librespeed docker/librespeed.yml "$ENV_FILE"
} }
install_atak() {
local bind=127.0.0.1 port="${ATAK_WEB_PORT:-8089}" install_opentak() {
if [[ "$USE_CADDY" != yes ]]; then apt_install curl openssl
bind=0.0.0.0 local dir="$DATA_ROOT/opentak" svc k
port="$(ask_input "GoATAK" "Host port for the web UI:" "$port")" || return 1 expose OPENTAK "OpenTAK Server (web UI)" tak 8090 OTS_WEB_BIND OTS_WEB_PORT no || return 1
mkdir -p "$dir"
# Retire the old GoATAK stack if present (its data in $DATA_ROOT/atak is left untouched).
if [[ -f "$VIATOR_DIR/docker/atak.yml" ]]; then
VIATOR_DATA_ROOT="$DATA_ROOT" docker compose --env-file "$ENV_FILE" -f "$VIATOR_DIR/docker/atak.yml" down --remove-orphans 2>/dev/null || true
fi fi
ATAK_WEB_BIND="$bind" ATAK_WEB_PORT="$port"
save_env ATAK_WEB_BIND ATAK_WEB_PORT # Upstream installer: fetch compose + generate .env under ./data/opentak; don't start yet.
compose_stack atak docker/atak.yml "$ENV_FILE" fetch "https://raw.githubusercontent.com/9M2PJU/9M2PJU-OpenTAKServer-Docker/main/scripts/install.sh" "$TMP_DIR/ots-install.sh" || return 1
bash "$TMP_DIR/ots-install.sh" --prefix "$dir" --no-start || return 1
svc="$(cd "$dir" && docker compose config --services | grep -iE 'ots|opentak' | grep -viE 'postgres|rabbit|db|mq' | head -n1 || true)"
[[ -n "$svc" ]] || { err "Could not detect the OpenTAKServer service in $dir/docker-compose.yml"; return 1; }
log "Detected OpenTAKServer service: $svc"
# Mirror the settings the override needs into the project's own .env so a manual
# `docker compose up` in $dir behaves the same as the installer.
env_put "$dir/.env" OTS_WEB_BIND "$OTS_WEB_BIND"
env_put "$dir/.env" OTS_WEB_PORT "$OTS_WEB_PORT"
env_put "$dir/.env" VIATOR_DOMAIN "$VIATOR_DOMAIN"
env_put "$dir/.env" VIATOR_SUB_OPENTAK "${VIATOR_SUB_OPENTAK:-tak}"
# Auto-merged by compose; upstream's docker-compose.yml stays untouched/upgradable.
# 8089 (SSL CoT) and 8446 (cert enrollment) are raw TLS, so they're always published
# directly (Caddy cannot proxy them). Only the web UI goes through Caddy / your proxy.
cat > "$dir/docker-compose.override.yml" <<OVERRIDE
services:
${svc}:
ports: !override
- "\${OTS_WEB_BIND:-127.0.0.1}:\${OTS_WEB_PORT:-8090}:8080"
- "8089:8089"
- "8446:8446"
networks:
- default
- proxy
labels:
caddy: \${VIATOR_SUB_OPENTAK:-tak}.\${VIATOR_DOMAIN:-viator.internal}
caddy.reverse_proxy: "{{upstreams 8080}}"
caddy.tls: internal
networks:
proxy:
external: true
name: viator_proxy
OVERRIDE
(cd "$dir" && docker compose config -q) || { err "Compose validation failed in $dir"; return 1; }
(cd "$dir" && docker compose up -d)
} }
install_maps() { install_maps() {
local photon tiles satellite vector contours url local photon tiles satellite vector contours url
apt_install unzip apt_install unzip
photon=no; tiles=no; satellite=no; vector=no; contours=no photon=no; tiles=no; satellite=no; vector=no; contours=no
ask_yes "Install Photon geocoder? (~69 GB)" && photon=yes || true ask_yes "Install Photon geocoder? (~69 GB)" && photon=yes || true
ask_yes "Install TileServer GL?" && tiles=yes || true ask_yes "Install TileServer GL?" && tiles=yes || true
# Networking first, so a bad answer fails before any multi-GB download starts.
expose MAPS "Cartomake (map UI)" maps 8020 CARTOMAKE_BIND CARTOMAKE_PORT no || return 1
if [[ "$photon" == yes ]]; then
expose GEOCODE "Photon geocoder" geocode 8022 PHOTON_BIND PHOTON_PORT yes || return 1
fi
if [[ "$tiles" == yes ]]; then
expose TILES "TileServer GL" tiles 8021 TILESERVER_BIND TILESERVER_PORT yes || return 1
fi
if [[ "$tiles" == yes ]]; then if [[ "$tiles" == yes ]]; then
ask_yes "Download MapTiler Satellite dataset? (~186 GB; paste the download URL when prompted)" && satellite=yes || true ask_yes "Download MapTiler Satellite dataset? (~186 GB; paste the download URL when prompted)" && satellite=yes || true
ask_yes "Download MapTiler Vector dataset? (~70 GB; paste the download URL when prompted)" && vector=yes || true ask_yes "Download MapTiler Vector dataset? (~70 GB; paste the download URL when prompted)" && vector=yes || true
ask_yes "Download Contours dataset? (~18 GB; requires your hosted URL)" && contours=yes || true ask_yes "Download Contours dataset? (~18 GB; requires your hosted URL)" && contours=yes || true
fi fi
MAP_PHOTON="$photon"; MAP_TILESERVER="$tiles"; MAP_SATELLITE="$satellite"; MAP_VECTOR="$vector"; MAP_CONTOURS="$contours" MAP_PHOTON="$photon"; MAP_TILESERVER="$tiles"; MAP_SATELLITE="$satellite"; MAP_VECTOR="$vector"; MAP_CONTOURS="$contours"
TILESERVER_URL=""; GEOCODE_URL="" save_env MAP_PHOTON MAP_TILESERVER MAP_SATELLITE MAP_VECTOR MAP_CONTOURS
[[ "$tiles" == yes ]] && TILESERVER_URL="http://tileserver:8080"
[[ "$photon" == yes ]] && GEOCODE_URL="http://photon:2322"
save_env MAP_PHOTON MAP_TILESERVER MAP_SATELLITE MAP_VECTOR MAP_CONTOURS TILESERVER_URL GEOCODE_URL
local map_required=0 map_available local map_required=0 map_available
[[ "$photon" == yes ]] && map_required=$((map_required + 69*1024*1024*1024)) [[ "$photon" == yes ]] && map_required=$((map_required + 69*1024*1024*1024))
[[ "$satellite" == yes ]] && map_required=$((map_required + 186*1024*1024*1024)) [[ "$satellite" == yes ]] && map_required=$((map_required + 186*1024*1024*1024))
@@ -501,13 +685,6 @@ install_maps() {
cp -an "$VIATOR_DIR/data/maps/tileserver/styles/." \ cp -an "$VIATOR_DIR/data/maps/tileserver/styles/." \
"$DATA_ROOT/maps/tileserver/styles/" "$DATA_ROOT/maps/tileserver/styles/"
fi fi
local bind=127.0.0.1 port="${CARTOMAKE_PORT:-8080}"
if [[ "$USE_CADDY" != yes ]]; then
bind=0.0.0.0
port="$(ask_input "Cartomake" "Host port for the map UI:" "$port")" || return 1
fi
CARTOMAKE_BIND="$bind" CARTOMAKE_PORT="$port"
save_env CARTOMAKE_BIND CARTOMAKE_PORT
local -a profiles=() local -a profiles=()
[[ "$photon" == yes ]] && profiles+=(--profile photon) [[ "$photon" == yes ]] && profiles+=(--profile photon)
[[ "$tiles" == yes ]] && profiles+=(--profile tiles) [[ "$tiles" == yes ]] && profiles+=(--profile tiles)
@@ -515,38 +692,70 @@ install_maps() {
} }
install_personal_cloud() { install_personal_cloud() {
local hostname="$(ask_input "Personal Cloud" "AI Harness hostname (example: ai.home.arpa):" "ai.home.arpa")" || return 1 expose HARNESS "AI Harness" home 8082 WEB_BIND HARNESS_PORT yes || return 1
local office="$(ask_input "Personal Cloud" "OnlyOffice hostname:" "office.home.arpa")" || return 1 expose OFFICE "OnlyOffice" office 8083 WEB_BIND OFFICE_PORT yes || return 1
local bind=127.0.0.1 harness_port="${HARNESS_PORT:-8082}" office_port="${OFFICE_PORT:-8083}"
if [[ "$USE_CADDY" != yes ]]; then
bind=0.0.0.0
harness_port="$(ask_input "Personal Cloud" "AI Harness host port:" "$harness_port")" || return 1
office_port="$(ask_input "Personal Cloud" "OnlyOffice host port:" "$office_port")" || return 1
fi
local secret="${OFFICE_JWT_SECRET:-}" local secret="${OFFICE_JWT_SECRET:-}"
[[ -n "$secret" ]] || secret="$(openssl rand -hex 32)" [[ -n "$secret" ]] || secret="$(openssl rand -hex 32)"
OFFICE_JWT_SECRET="$secret" HARNESS_HOSTNAME="$hostname" OFFICE_HOSTNAME="$office" OFFICE_JWT_SECRET="$secret"
WEB_BIND="$bind" HARNESS_PORT="$harness_port" OFFICE_PORT="$office_port" save_env OFFICE_JWT_SECRET
save_env OFFICE_JWT_SECRET HARNESS_HOSTNAME OFFICE_HOSTNAME WEB_BIND HARNESS_PORT OFFICE_PORT
compose_stack personal-cloud docker/cloud.yml "$ENV_FILE" compose_stack personal-cloud docker/cloud.yml "$ENV_FILE"
} }
install_pentest() { install_pentest() {
apt_install arp-scan aircrack-ng gobuster hashcat hcxtools hydra john netcat-openbsd nikto \ apt_install arp-scan aircrack-ng gobuster hashcat hcxtools hydra john netcat-openbsd nikto \
nmap masscan reaver sqlmap tcpdump wireshark nmap masscan reaver sqlmap tcpdump wireshark
BETTERCAP_USER="$(ask_input "Bettercap" "Web UI username (separate from Linux login):" "viator")" || return 1 BETTERCAP_USER="$(ask_input "Bettercap" "Web UI username (separate from Linux login):" "${BETTERCAP_USER:-viator}")" || return 1
BETTERCAP_PASSWORD="$(ask_password "Bettercap" "Set a strong Bettercap UI password (letters/numbers/dot/dash/underscore):" "")" || return 1 BETTERCAP_PASSWORD="$(ask_password "Bettercap" "Set a strong Bettercap UI password (letters/numbers/dot/dash/underscore):" "")" || return 1
[[ "$BETTERCAP_PASSWORD" =~ ^[A-Za-z0-9._-]{12,}$ ]] || { msg "Use 12+ characters: letters, numbers, dot, dash or underscore."; return 1; } [[ "$BETTERCAP_PASSWORD" =~ ^[A-Za-z0-9._-]{12,}$ ]] || { msg "Use 12+ characters: letters, numbers, dot, dash or underscore."; return 1; }
save_env BETTERCAP_USER BETTERCAP_PASSWORD VIATOR_DOCKER_GATEWAY="$(docker network inspect bridge --format '{{(index .IPAM.Config 0).Gateway}}' 2>/dev/null || true)"
VIATOR_DOCKER_GATEWAY="${VIATOR_DOCKER_GATEWAY:-172.17.0.1}"
save_env BETTERCAP_USER BETTERCAP_PASSWORD VIATOR_DOCKER_GATEWAY
curl -fsSL https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfinstall.erb -o "$TMP_DIR/msfinstall" curl -fsSL https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfinstall.erb -o "$TMP_DIR/msfinstall"
chmod 0700 "$TMP_DIR/msfinstall" chmod 0700 "$TMP_DIR/msfinstall"
"$TMP_DIR/msfinstall" "$TMP_DIR/msfinstall"
compose_stack bettercap docker/bettercap.yml "$ENV_FILE" compose_stack bettercap docker/bettercap.yml "$ENV_FILE"
} }
# Keep the kernel DVB-T driver away from RTL-SDR dongles (it grabs them before SDR apps can),
# and sanity-check that the HAT's SDR is visible on USB.
prepare_rtlsdr_host() {
apt_install rtl-sdr usbutils
cat > /etc/modprobe.d/viator-rtlsdr.conf <<'BLACKLIST'
# Managed by Viator: keep the kernel DVB driver off RTL-SDR dongles so SDR apps can claim them.
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2832_sdr
blacklist rtl2830
blacklist r820t
BLACKLIST
local m usb
for m in rtl2832_sdr dvb_usb_rtl28xxu rtl2832 rtl2830 r820t; do modprobe -r "$m" 2>/dev/null || true; done
usb="$(lsusb 2>/dev/null || true)"
if grep -qiE '0bda:(2832|2838)' <<<"$usb"; then
log "RTL-SDR detected on USB."
else
warn "No RTL-SDR (0bda:2832/2838) found on USB. OpenWebRX+ will start but has no device until the HAT's SDR is visible (check 'lsusb'; a reboot may be needed after the module blacklist)."
fi
}
install_openwebrx() {
prepare_rtlsdr_host
expose SDR "OpenWebRX+ (SDR receiver)" sdr 8073 OPENWEBRX_BIND OPENWEBRX_PORT no || return 1
OPENWEBRX_ADMIN_USER="$(ask_input "OpenWebRX+" "Admin username:" "${OPENWEBRX_ADMIN_USER:-admin}")" || return 1
[[ "$OPENWEBRX_ADMIN_USER" =~ ^[a-z][a-z0-9_-]*$ ]] || { msg "Username must be lowercase letters, numbers, dash or underscore."; return 1; }
OPENWEBRX_ADMIN_PASSWORD="$(ask_password "OpenWebRX+" "Admin password (12+ chars: letters/numbers/dot/dash/underscore):" "${OPENWEBRX_ADMIN_PASSWORD:-}")" || return 1
[[ "$OPENWEBRX_ADMIN_PASSWORD" =~ ^[A-Za-z0-9._-]{12,}$ ]] || { msg "Use 12+ characters: letters, numbers, dot, dash or underscore."; return 1; }
OPENWEBRX_IMAGE="${OPENWEBRX_IMAGE:-slechev/openwebrxplus-softmbe:latest}"
save_env OPENWEBRX_ADMIN_USER OPENWEBRX_ADMIN_PASSWORD OPENWEBRX_IMAGE
mkdir -p "$DATA_ROOT/sdr/openwebrx/etc" "$DATA_ROOT/sdr/openwebrx/var"
# The image's runtime uid isn't documented; keep state dirs writable until it's confirmed.
chmod 0777 "$DATA_ROOT/sdr/openwebrx/etc" "$DATA_ROOT/sdr/openwebrx/var"
compose_stack sdr/openwebrx docker/sdr.yml "$ENV_FILE"
}
install_sdr() { install_sdr() {
local owx= noads=no rtl=no local owx=no noads=no rtl=no
ask_yes "Install OpenWebRX+ (general SDR receiver)?" && owx=yes || true ask_yes "Install OpenWebRX+ (general SDR receiver with extra digital decoders)?" && owx=yes || true
ask_yes "Install ADS-B receiver and tar1090?" && noads=yes || true ask_yes "Install ADS-B receiver and tar1090?" && noads=yes || true
ask_yes "Install RTL_433 sensor decoder?" && rtl=yes || true ask_yes "Install RTL_433 sensor decoder?" && rtl=yes || true
if [[ "$owx" == yes && "$noads" == yes ]] || [[ "$owx" == yes && "$rtl" == yes ]] || [[ "$noads" == yes && "$rtl" == yes ]]; then if [[ "$owx" == yes && "$noads" == yes ]] || [[ "$owx" == yes && "$rtl" == yes ]] || [[ "$noads" == yes && "$rtl" == yes ]]; then
@@ -554,11 +763,15 @@ install_sdr() {
fi fi
SDR_OPENWEBRX="$owx" SDR_ADSB="$noads" SDR_RTL433="$rtl" SDR_OPENWEBRX="$owx" SDR_ADSB="$noads" SDR_RTL433="$rtl"
save_env SDR_OPENWEBRX SDR_ADSB SDR_RTL433 save_env SDR_OPENWEBRX SDR_ADSB SDR_RTL433
local -a profiles=() local rc=0
[[ "$owx" == yes ]] && profiles+=(--profile openwebrx) if [[ "$owx" == yes ]]; then install_openwebrx || rc=1; fi
[[ "$noads" == yes ]] && profiles+=(--profile adsb) if [[ "$noads" == yes || "$rtl" == yes ]]; then
[[ "$rtl" == yes ]] && profiles+=(--profile rtl433) local -a profiles=()
compose_stack sdr docker/sdr.yml "$ENV_FILE" "${profiles[@]}" [[ "$noads" == yes ]] && profiles+=(--profile adsb)
[[ "$rtl" == yes ]] && profiles+=(--profile rtl433)
compose_stack sdr docker/sdr.yml "$ENV_FILE" "${profiles[@]}" || rc=1
fi
return "$rc"
} }
install_ai() { install_ai() {
@@ -777,8 +990,8 @@ main() {
summary summary
ask_yes "Begin installation? Existing data will be preserved; individual failures won't stop other components." || exit 0 ask_yes "Begin installation? Existing data will be preserved; individual failures won't stop other components." || exit 0
# Docker is a shared prerequisite; configure once for all selected container apps. # Docker + networking mode (Caddy vs. own reverse proxy) is decided once for all container apps.
if contains docker || contains pentest || contains speedtest || contains atak || contains maps || contains personal-cloud || contains sdr; then if needs_docker; then
run_component "Docker" configure_docker run_component "Docker" configure_docker
fi fi
@@ -791,7 +1004,7 @@ main() {
contains hat && run_component "Wireless HAT" install_hat || true contains hat && run_component "Wireless HAT" install_hat || true
contains pentest && run_component "Pen Test Suite" install_pentest || true contains pentest && run_component "Pen Test Suite" install_pentest || true
contains speedtest && run_component "LibreSpeed" install_speedtest || true contains speedtest && run_component "LibreSpeed" install_speedtest || true
contains atak && run_component "GoATAK Server" install_atak || true contains opentak && run_component "OpenTAK Server" install_opentak || true
contains maps && run_component "Maps" install_maps || true contains maps && run_component "Maps" install_maps || true
contains personal-cloud && run_component "Personal Cloud" install_personal_cloud || true contains personal-cloud && run_component "Personal Cloud" install_personal_cloud || true
contains sdr && run_component "SDR" install_sdr || true contains sdr && run_component "SDR" install_sdr || true