Renamed to opsbox

This commit is contained in:
2026-11-23 08:50:21 -05:00
parent db989bb798
commit 10db16022c
8 changed files with 303 additions and 179 deletions
+11 -15
View File
@@ -6,25 +6,25 @@
<img src="https://git.zakscode.com/repo-avatars/2b4ee6ba1f2e2618bf7694e4a52fb56d1d0ea6abafa2dcbe496ab786b86d5a76" alt="Logo" width="200" height="200"> <img src="https://git.zakscode.com/repo-avatars/2b4ee6ba1f2e2618bf7694e4a52fb56d1d0ea6abafa2dcbe496ab786b86d5a76" alt="Logo" width="200" height="200">
<!-- Title --> <!-- Title -->
### Viator ### OpsBox
<!-- Description --> <!-- Description -->
Modular off-grid systems installer for Debian and Raspberry Pi OS. Modular off-grid systems installer for Debian and Raspberry Pi OS.
<!-- Repo badges --> <!-- Repo badges -->
[![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/viator/tags&query=$[0].name)](https://git.zakscode.com/ztimson/viator/tags) [![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/opsbox/tags&query=$[0].name)](https://git.zakscode.com/ztimson/opsbox/tags)
[![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/viator&query=open_pr_counter)](https://git.zakscode.com/ztimson/viator/pulls) [![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/opsbox&query=open_pr_counter)](https://git.zakscode.com/ztimson/opsbox/pulls)
[![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/viator&query=open_issues_count)](https://git.zakscode.com/ztimson/viator/issues) [![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/opsbox&query=open_issues_count)](https://git.zakscode.com/ztimson/opsbox/issues)
<!-- Links --> <!-- Links -->
--- ---
<div> <div>
<a href="https://git.zakscode.com/ztimson/viator/wiki" target="_blank">Documentation</a> <a href="https://git.zakscode.com/ztimson/opsbox/wiki" target="_blank">Documentation</a>
• <a href="https://git.zakscode.com/ztimson/viator/releases" target="_blank">Release Notes</a> • <a href="https://git.zakscode.com/ztimson/opsbox/releases" target="_blank">Release Notes</a>
• <a href="https://git.zakscode.com/ztimson/viator/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a> • <a href="https://git.zakscode.com/ztimson/opsbox/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
• <a href="https://git.zakscode.com/ztimson/viator/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a> • <a href="https://git.zakscode.com/ztimson/opsbox/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
</div> </div>
--- ---
@@ -32,7 +32,7 @@ Modular off-grid systems installer for Debian and Raspberry Pi OS.
</div> </div>
## Table of Contents ## Table of Contents
- [Viator](#top) - [OpsBox](#top)
- [About](#about) - [About](#about)
- [Features](#features) - [Features](#features)
- [Built With](#built-with) - [Built With](#built-with)
@@ -43,7 +43,7 @@ Modular off-grid systems installer for Debian and Raspberry Pi OS.
## About ## About
Viator is an interactive installer for building self-hosted, off-grid systems using Debian-based operating systems, with a focus on Raspberry Pi. OpsBox is an interactive installer for building self-hosted, off-grid systems using Debian-based operating systems, with a focus on Raspberry Pi.
It provides a collection of optional services and tools that can be independently installed and configured through a single menu-driven interface. Shared dependencies are handled automatically, and installations can be rerun without unnecessarily replacing existing configurations or persistent data. It provides a collection of optional services and tools that can be independently installed and configured through a single menu-driven interface. Shared dependencies are handled automatically, and installations can be rerun without unnecessarily replacing existing configurations or persistent data.
@@ -74,13 +74,9 @@ It provides a collection of optional services and tools that can be independentl
1. Run the installer: 1. Run the installer:
```bash ```bash
curl -fsSL https://git.zakscode.com/ztimson/viator/raw/branch/main/install.sh | sudo bash curl -sL https://git.zakscode.com/ztimson/opsbox/raw/branch/master/install.sh | sudo bash
``` ```
2. Choose an installation directory when prompted (defaults to the current working directory).
3. Viator will update the package index, install Git and clone the repository.
4. Select and configure the components you want to install.
## License ## License
Copyright © 2026 Zakary Timson | All Rights Reserved Copyright © 2026 Zakary Timson | All Rights Reserved
+6 -6
View File
@@ -1,20 +1,20 @@
services: services:
bettercap: bettercap:
image: bettercap/bettercap:latest image: bettercap/bettercap:latest
container_name: viator-bettercap container_name: opsbox-bettercap
restart: unless-stopped restart: unless-stopped
privileged: true privileged: true
network_mode: host network_mode: host
command: command:
- -eval - -eval
- >- - >-
set api.rest.username '${BETTERCAP_USER:-viator}'; set api.rest.username '${BETTERCAP_USER:-opsbox}';
set api.rest.password '${BETTERCAP_PASSWORD:?Set BETTERCAP_PASSWORD in viator.env}'; set api.rest.password '${BETTERCAP_PASSWORD:?Set BETTERCAP_PASSWORD in opsbox.env}';
set api.rest.address '${BETTERCAP_UI_ADDR:-${VIATOR_DOCKER_GATEWAY:-172.17.0.1}}'; set api.rest.address '${BETTERCAP_UI_ADDR:-${OPSBOX_DOCKER_GATEWAY:-172.17.0.1}}';
set api.rest.port ${BETTERCAP_API_PORT:-8081}; set api.rest.port ${BETTERCAP_API_PORT:-8081};
set api.rest.alloworigin '${BETTERCAP_ALLOW_ORIGIN:-https://${VIATOR_SUB_BETTERCAP:-bettercap}.${VIATOR_DOMAIN:-viator.internal}}'; set api.rest.alloworigin '${BETTERCAP_ALLOW_ORIGIN:-https://${OPSBOX_SUB_BETTERCAP:-bettercap}.${OPSBOX_DOMAIN:-opsbox.internal}}';
api.rest on; api.rest on;
set ui.address '${BETTERCAP_UI_ADDR:-${VIATOR_DOCKER_GATEWAY:-172.17.0.1}}'; set ui.address '${BETTERCAP_UI_ADDR:-${OPSBOX_DOCKER_GATEWAY:-172.17.0.1}}';
set ui.port ${BETTERCAP_UI_PORT:-1600}; set ui.port ${BETTERCAP_UI_PORT:-1600};
ui on; ui on;
set gps.device localhost:2947; set gps.device localhost:2947;
+7 -7
View File
@@ -1,7 +1,7 @@
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: opsbox-caddy
restart: unless-stopped restart: unless-stopped
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
@@ -9,23 +9,23 @@ services:
- "80:80" - "80:80"
- "443:443" - "443:443"
environment: environment:
CADDY_INGRESS_NETWORKS: viator_proxy CADDY_INGRESS_NETWORKS: opsbox_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 - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/caddy/data:/data
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/caddy/config:/config - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/caddy/config:/config
networks: networks:
- proxy - proxy
labels: labels:
caddy: ${VIATOR_SUB_BETTERCAP:-bettercap}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_BETTERCAP:-bettercap}.${OPSBOX_DOMAIN:-opsbox.internal}
caddy.reverse_proxy: host.docker.internal:${BETTERCAP_UI_PORT:-1600} caddy.reverse_proxy: host.docker.internal:${BETTERCAP_UI_PORT:-1600}
caddy.tls: internal caddy.tls: internal
caddy_1: ${VIATOR_SUB_BETTERCAP_API:-api.bettercap}.${VIATOR_DOMAIN:-viator.internal} caddy_1: ${OPSBOX_SUB_BETTERCAP_API:-api.bettercap}.${OPSBOX_DOMAIN:-opsbox.internal}
caddy_1.reverse_proxy: host.docker.internal:${BETTERCAP_API_PORT:-8081} caddy_1.reverse_proxy: host.docker.internal:${BETTERCAP_API_PORT:-8081}
caddy_1.tls: internal caddy_1.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: opsbox_proxy
+16 -16
View File
@@ -1,24 +1,24 @@
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: opsbox-ai-harness
restart: unless-stopped restart: unless-stopped
environment: environment:
PUID: ${PUID:-1000} PUID: ${PUID:-1000}
PGID: ${PGID:-1000} PGID: ${PGID:-1000}
PUBLIC_URL: ${VIATOR_HOST_HARNESS:-${VIATOR_SUB_HARNESS:-home}.${VIATOR_DOMAIN:-viator.internal}} PUBLIC_URL: ${OPSBOX_HOST_HARNESS:-${OPSBOX_SUB_HARNESS:-home}.${OPSBOX_DOMAIN:-opsbox.internal}}
OFFICE_URL: ${VIATOR_HOST_OFFICE:-${VIATOR_SUB_OFFICE:-office}.${VIATOR_DOMAIN:-viator.internal}} OFFICE_URL: ${OPSBOX_HOST_OFFICE:-${OPSBOX_SUB_OFFICE:-office}.${OPSBOX_DOMAIN:-opsbox.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 - ${OPSBOX_FILES_ROOT:-/mnt}:/mnt
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/models:/models - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/personal-cloud/models:/models
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/AI:/AI - ${OPSBOX_DATA_ROOT:?Set OPSBOX_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: ${VIATOR_SUB_HARNESS:-home}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_HARNESS:-home}.${OPSBOX_DOMAIN:-opsbox.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
@@ -26,28 +26,28 @@ services:
onlyoffice: onlyoffice:
image: onlyoffice/documentserver:latest image: onlyoffice/documentserver:latest
container_name: viator-onlyoffice container_name: opsbox-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 - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/personal-cloud/office/data:/var/www/onlyoffice/Data
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/logs:/var/log/onlyoffice - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/personal-cloud/office/logs:/var/log/onlyoffice
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/lib:/var/lib/onlyoffice - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/personal-cloud/office/lib:/var/lib/onlyoffice
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/db:/var/lib/postgresql - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/personal-cloud/office/db:/var/lib/postgresql
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/rabbitmq:/var/lib/rabbitmq - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/personal-cloud/office/rabbitmq:/var/lib/rabbitmq
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/personal-cloud/office/redis:/var/lib/redis - ${OPSBOX_DATA_ROOT:?Set OPSBOX_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: ${VIATOR_SUB_OFFICE:-office}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_OFFICE:-office}.${OPSBOX_DOMAIN:-opsbox.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: opsbox_proxy
+4 -4
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: opsbox-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 - ${OPSBOX_DATA_ROOT:?Set OPSBOX_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: ${VIATOR_SUB_SPEEDTEST:-speedtest}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_SPEEDTEST:-speedtest}.${OPSBOX_DOMAIN:-opsbox.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: opsbox_proxy
+10 -10
View File
@@ -1,17 +1,17 @@
services: services:
cartomake: cartomake:
image: git.zakscode.com/ztimson/cartomake:latest image: git.zakscode.com/ztimson/cartomake:latest
container_name: viator-cartomake container_name: opsbox-cartomake
restart: unless-stopped restart: unless-stopped
environment: environment:
TILESERVER_URL: ${VIATOR_HOST_TILES:-${VIATOR_SUB_TILES:-tiles}.${VIATOR_DOMAIN:-viator.internal}} TILESERVER_URL: ${OPSBOX_HOST_TILES:-${OPSBOX_SUB_TILES:-tiles}.${OPSBOX_DOMAIN:-opsbox.internal}}
GEOCODE_URL: ${VIATOR_HOST_GEOCODE:-${VIATOR_SUB_GEOCODE:-geocode}.${VIATOR_DOMAIN:-viator.internal}} GEOCODE_URL: ${OPSBOX_HOST_GEOCODE:-${OPSBOX_SUB_GEOCODE:-geocode}.${OPSBOX_DOMAIN:-opsbox.internal}}
ports: ports:
- "${CARTOMAKE_BIND:-127.0.0.1}:${CARTOMAKE_PORT:-8020}:80" - "${CARTOMAKE_BIND:-127.0.0.1}:${CARTOMAKE_PORT:-8020}:80"
networks: networks:
- proxy - proxy
labels: labels:
caddy: ${VIATOR_SUB_MAPS:-maps}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_MAPS:-maps}.${OPSBOX_DOMAIN:-opsbox.internal}
caddy.reverse_proxy: "{{upstreams 80}}" caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: internal caddy.tls: internal
@@ -24,13 +24,13 @@ services:
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 - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/maps/geocoder:/photon/data
ports: ports:
- "${PHOTON_BIND:-127.0.0.1}:${PHOTON_PORT:-8022}:2322" - "${PHOTON_BIND:-127.0.0.1}:${PHOTON_PORT:-8022}:2322"
networks: networks:
- proxy - proxy
labels: labels:
caddy: ${VIATOR_SUB_GEOCODE:-geocode}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_GEOCODE:-geocode}.${OPSBOX_DOMAIN:-opsbox.internal}
caddy.reverse_proxy: "{{upstreams 2322}}" caddy.reverse_proxy: "{{upstreams 2322}}"
caddy.tls: internal caddy.tls: internal
@@ -41,18 +41,18 @@ services:
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 - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/maps/tiles:/data
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/maps/tileserver:/config:ro - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/maps/tileserver:/config:ro
ports: ports:
- "${TILESERVER_BIND:-127.0.0.1}:${TILESERVER_PORT:-8021}:8080" - "${TILESERVER_BIND:-127.0.0.1}:${TILESERVER_PORT:-8021}:8080"
networks: networks:
- proxy - proxy
labels: labels:
caddy: ${VIATOR_SUB_TILES:-tiles}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_TILES:-tiles}.${OPSBOX_DOMAIN:-opsbox.internal}
caddy.reverse_proxy: "{{upstreams 8080}}" caddy.reverse_proxy: "{{upstreams 8080}}"
caddy.tls: internal caddy.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: opsbox_proxy
+6 -6
View File
@@ -1,16 +1,16 @@
services: services:
openwebrx: openwebrx:
image: ${OPENWEBRX_IMAGE:-slechev/openwebrxplus-softmbe:latest} image: ${OPENWEBRX_IMAGE:-slechev/openwebrxplus-softmbe:latest}
container_name: viator-openwebrx container_name: opsbox-openwebrx
restart: unless-stopped restart: unless-stopped
environment: environment:
TZ: ${TZ:-Etc/UTC} TZ: ${TZ:-Etc/UTC}
OPENWEBRX_ADMIN_USER: ${OPENWEBRX_ADMIN_USER:-admin} OPENWEBRX_ADMIN_USER: ${OPENWEBRX_ADMIN_USER:-admin}
OPENWEBRX_ADMIN_PASSWORD: ${OPENWEBRX_ADMIN_PASSWORD:?Set OPENWEBRX_ADMIN_PASSWORD in viator.env} OPENWEBRX_ADMIN_PASSWORD: ${OPENWEBRX_ADMIN_PASSWORD:?Set OPENWEBRX_ADMIN_PASSWORD in opsbox.env}
volumes: volumes:
- /dev/bus/usb:/dev/bus/usb - /dev/bus/usb:/dev/bus/usb
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/openwebrx/etc:/etc/openwebrx - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/sdr/openwebrx/etc:/etc/openwebrx
- ${VIATOR_DATA_ROOT:?Set VIATOR_DATA_ROOT}/sdr/openwebrx/var:/var/lib/openwebrx - ${OPSBOX_DATA_ROOT:?Set OPSBOX_DATA_ROOT}/sdr/openwebrx/var:/var/lib/openwebrx
device_cgroup_rules: device_cgroup_rules:
- "c 189:* rmw" - "c 189:* rmw"
ports: ports:
@@ -18,11 +18,11 @@ services:
networks: networks:
- proxy - proxy
labels: labels:
caddy: ${VIATOR_SUB_SDR:-sdr}.${VIATOR_DOMAIN:-viator.internal} caddy: ${OPSBOX_SUB_SDR:-sdr}.${OPSBOX_DOMAIN:-opsbox.internal}
caddy.reverse_proxy: "{{upstreams 8073}}" caddy.reverse_proxy: "{{upstreams 8073}}"
caddy.tls: internal caddy.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: opsbox_proxy
+241 -113
View File
@@ -1,22 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
# Viator bootstrap + installer. Keep the Git URL in one place. # OpsBox bootstrap + installer. Keep the Git URL in one place.
VIATOR_GIT_REPO="${VIATOR_GIT_REPO:-https://git.zakscode.com/ztimson/viator.git}" OPSBOX_GIT_REPO="${OPSBOX_GIT_REPO:-https://git.zakscode.com/ztimson/opsbox.git}"
VIATOR_VERSION="1.1.0" OPSBOX_VERSION="1.1.0"
VIATOR_DIR="${VIATOR_DIR:-}" OPSBOX_DIR="${OPSBOX_DIR:-}"
CONFIG_DIR="/etc/viator" CONFIG_DIR="/etc/opsbox"
STATE_FILE="$CONFIG_DIR/selections" STATE_FILE="$CONFIG_DIR/selections"
DL_FILE="$CONFIG_DIR/downloads" DL_FILE="$CONFIG_DIR/downloads"
ENV_FILE="$CONFIG_DIR/viator.env" ENV_FILE="$CONFIG_DIR/opsbox.env"
THEME_DIR="/usr/local/share/viator" THEME_DIR="/usr/local/share/opsbox"
DATA_ROOT="" DATA_ROOT=""
INSTALL_ROOT="" INSTALL_ROOT=""
TMP_DIR="" TMP_DIR=""
LOCK_FILE="/run/lock/viator-install.lock" LOCK_FILE="/run/lock/opsbox-install.lock"
APT_UPGRADE="no" APT_UPGRADE="no"
USE_CADDY="" USE_CADDY=""
VIATOR_DOMAIN="${VIATOR_DOMAIN:-viator.internal}" OPSBOX_DOMAIN="${OPSBOX_DOMAIN:-opsbox.internal}"
ADMIN_USER="${SUDO_USER:-${USER:-root}}" ADMIN_USER="${SUDO_USER:-${USER:-root}}"
DOCKER_REGISTRY="git.zakscode.com" DOCKER_REGISTRY="git.zakscode.com"
DOCKER_USER="" DOCKER_USER=""
@@ -34,7 +34,7 @@ declare -A COMP_LABEL=() SEL_DL=() ZIM_NAME=() ZIM_REASON=() ZIM_TITLE=() ZIM_BY
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'; RESET='\033[0m' RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'; RESET='\033[0m'
log() { printf '%b[viator]%b %s\n' "$GREEN" "$RESET" "$*"; } log() { printf '%b[opsbox]%b %s\n' "$GREEN" "$RESET" "$*"; }
warn() { printf '%b[warning]%b %s\n' "$YELLOW" "$RESET" "$*" >&2; } warn() { printf '%b[warning]%b %s\n' "$YELLOW" "$RESET" "$*" >&2; }
err() { printf '%b[error]%b %s\n' "$RED" "$RESET" "$*" >&2; } err() { printf '%b[error]%b %s\n' "$RED" "$RESET" "$*" >&2; }
die() { err "$*"; exit 1; } die() { err "$*"; exit 1; }
@@ -107,15 +107,15 @@ ZIM_WANTED=(
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
init() { init() {
require_root require_root
VIATOR_DIR="$(realpath -e -- "$VIATOR_DIR")" OPSBOX_DIR="$(realpath -e -- "$OPSBOX_DIR")"
[[ -f "$VIATOR_DIR/install.sh" && -d "$VIATOR_DIR/docker" ]] || die "Invalid Viator repository directory: $VIATOR_DIR" [[ -f "$OPSBOX_DIR/install.sh" && -d "$OPSBOX_DIR/docker" ]] || die "Invalid OpsBox repository directory: $OPSBOX_DIR"
INSTALL_ROOT="$VIATOR_DIR" INSTALL_ROOT="$OPSBOX_DIR"
DATA_ROOT="$VIATOR_DIR/data" DATA_ROOT="$OPSBOX_DIR/data"
mkdir -p "$CONFIG_DIR" "$DATA_ROOT" /var/log/viator mkdir -p "$CONFIG_DIR" "$DATA_ROOT" /var/log/opsbox
chmod 0750 "$CONFIG_DIR" chmod 0750 "$CONFIG_DIR"
TMP_DIR="$(mktemp -d /tmp/viator.XXXXXX)" TMP_DIR="$(mktemp -d /tmp/opsbox.XXXXXX)"
exec 9>"$LOCK_FILE" exec 9>"$LOCK_FILE"
flock -n 9 || die "Another Viator installer is already running." flock -n 9 || die "Another OpsBox installer is already running."
touch "$STATE_FILE" "$DL_FILE" "$ENV_FILE" touch "$STATE_FILE" "$DL_FILE" "$ENV_FILE"
chmod 0600 "$ENV_FILE" chmod 0600 "$ENV_FILE"
# This file is root-owned and generated by this installer. # This file is root-owned and generated by this installer.
@@ -123,9 +123,9 @@ init() {
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$ENV_FILE" source "$ENV_FILE"
set +a set +a
DATA_ROOT="${VIATOR_DATA_ROOT:-$DATA_ROOT}" DATA_ROOT="${OPSBOX_DATA_ROOT:-$DATA_ROOT}"
VIATOR_DATA_ROOT="$DATA_ROOT" OPSBOX_DATA_ROOT="$DATA_ROOT"
ADMIN_USER="${VIATOR_ADMIN_USER:-$ADMIN_USER}" ADMIN_USER="${OPSBOX_ADMIN_USER:-$ADMIN_USER}"
DOCKER_USER="${DOCKER_REGISTRY_USER:-}" DOCKER_USER="${DOCKER_REGISTRY_USER:-}"
} }
@@ -200,9 +200,9 @@ free_bytes() {
# dialog helpers # dialog helpers
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
BACK="Back" BACK="Back"
dlg() { dialog --backtitle "Viator installer v$VIATOR_VERSION" --cr-wrap --no-collapse "$@"; } dlg() { dialog --backtitle "OpsBox installer v$OPSBOX_VERSION" --cr-wrap --no-collapse "$@"; }
msg() { dlg --title "Viator" --msgbox "$1" 0 0 || true; } msg() { dlg --title "OpsBox" --msgbox "$1" 0 0 || true; }
ask_yes() { dlg --title "Viator" --yesno "$1" 0 0; } ask_yes() { dlg --title "OpsBox" --yesno "$1" 0 0; }
tlines() { tput lines 2>/dev/null || echo 24; } tlines() { tput lines 2>/dev/null || echo 24; }
tcols() { tput cols 2>/dev/null || echo 80; } tcols() { tput cols 2>/dev/null || echo 80; }
@@ -262,12 +262,12 @@ run_steps() {
# Bootstrap # Bootstrap
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
bootstrap() { bootstrap() {
[[ "${1:-}" == --installed ]] && { VIATOR_DIR="${2:?Missing install directory}"; return 0; } [[ "${1:-}" == --installed ]] && { OPSBOX_DIR="${2:?Missing install directory}"; return 0; }
[[ $EUID -eq 0 ]] || die "Run as root: curl ... | sudo bash" [[ $EUID -eq 0 ]] || die "Run as root: curl ... | sudo bash"
local default_dir answer target parent local default_dir answer target parent
default_dir="$(pwd -P)" default_dir="$(pwd -P)"
[[ -r /dev/tty ]] || die "An interactive terminal is required to choose the install directory." [[ -r /dev/tty ]] || die "An interactive terminal is required to choose the install directory."
printf '\nViator installation directory [%s]: ' "$default_dir" > /dev/tty printf '\nOpsBox installation directory [%s]: ' "$default_dir" > /dev/tty
IFS= read -r answer < /dev/tty || die "Could not read install directory." IFS= read -r answer < /dev/tty || die "Could not read install directory."
target="${answer:-$default_dir}" target="${answer:-$default_dir}"
target="${target/#\~/$HOME}" target="${target/#\~/$HOME}"
@@ -284,14 +284,14 @@ bootstrap() {
if [[ -d "$target/.git" ]]; then if [[ -d "$target/.git" ]]; then
local origin local origin
origin="$(git -C "$target" remote get-url origin 2>/dev/null || true)" origin="$(git -C "$target" remote get-url origin 2>/dev/null || true)"
[[ "$origin" == "$VIATOR_GIT_REPO" ]] || die "The directory is a Git repository with a different origin: $origin" [[ "$origin" == "$OPSBOX_GIT_REPO" ]] || die "The directory is a Git repository with a different origin: $origin"
log "Updating existing Viator checkout..." log "Updating existing OpsBox checkout..."
git -C "$target" pull --ff-only git -C "$target" pull --ff-only
elif [[ -d "$target" ]] && [[ -n "$(find "$target" -mindepth 1 -maxdepth 1 -print -quit)" ]]; then elif [[ -d "$target" ]] && [[ -n "$(find "$target" -mindepth 1 -maxdepth 1 -print -quit)" ]]; then
die "Install directory is not empty and is not a Viator checkout: $target\nChoose an empty directory or an existing Viator checkout." die "Install directory is not empty and is not a OpsBox checkout: $target\nChoose an empty directory or an existing OpsBox checkout."
else else
log "Cloning Viator into $target..." log "Cloning OpsBox into $target..."
git clone --depth 1 "$VIATOR_GIT_REPO" "$target" git clone --depth 1 "$OPSBOX_GIT_REPO" "$target"
fi fi
[[ -f "$target/install.sh" ]] || die "The repository checkout does not contain install.sh." [[ -f "$target/install.sh" ]] || die "The repository checkout does not contain install.sh."
@@ -337,7 +337,7 @@ step_components() {
tag="${pair%%|*}"; label="${pair#*|}" tag="${pair%%|*}"; label="${pair#*|}"
if grep -qx "$tag" "$STATE_FILE"; then choices+=("$tag" "$label" on); else choices+=("$tag" "$label" off); fi if grep -qx "$tag" "$STATE_FILE"; then choices+=("$tag" "$label" on); else choices+=("$tag" "$label" off); fi
done done
selected="$(dlg --title "Viator - Components" --ok-label "Next" --cancel-label "Exit" --separate-output \ selected="$(dlg --title "OpsBox - Components" --ok-label "Next" --cancel-label "Exit" --separate-output \
--checklist "Select the components to install (Space = toggle).\nDocker Engine is always installed. Existing data and configuration are preserved." \ --checklist "Select the components to install (Space = toggle).\nDocker Engine is always installed. Existing data and configuration are preserved." \
$((lh + 8)) 92 "$lh" "${choices[@]}" 3>&1 1>&2 2>&3)" || return 1 $((lh + 8)) 92 "$lh" "${choices[@]}" 3>&1 1>&2 2>&3)" || return 1
sel=(); SELECTED=() sel=(); SELECTED=()
@@ -532,7 +532,7 @@ Docker is always installed; images are pulled from $DOCKER_REGISTRY.
APT_UPGRADE="${APT_UPGRADE:-no}" APT_UPGRADE="${APT_UPGRADE:-no}"
msg "$err" msg "$err"
done done
VIATOR_DATA_ROOT="$DATA_ROOT" OPSBOX_DATA_ROOT="$DATA_ROOT"
return 0 return 0
} }
@@ -563,12 +563,12 @@ step_network() {
build_net_rows build_net_rows
local n=${#NET_ROWS[@]} local n=${#NET_ROWS[@]}
if ((n == 0)); then USE_CADDY=no; return 10; fi if ((n == 0)); then USE_CADDY=no; return 10; fi
local uc="${USE_CADDY:-yes}" dom="$VIATOR_DOMAIN" local uc="${USE_CADDY:-yes}" dom="$OPSBOX_DOMAIN"
local -a net_sub=() net_port=() args=() vals=() local -a net_sub=() net_port=() args=() vals=()
local i key label dsub dport bindv portv need sv lw=0 col y out err lines cols h fh w local i key label dsub dport bindv portv need sv lw=0 col y out err lines cols h fh w
for ((i = 0; i < n; i++)); do for ((i = 0; i < n; i++)); do
IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}" IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}"
sv="VIATOR_SUB_$key" sv="OPSBOX_SUB_$key"
net_sub[i]="${!sv:-$dsub}" net_sub[i]="${!sv:-$dsub}"
net_port[i]="${!portv:-$dport}" net_port[i]="${!portv:-$dport}"
if ((${#label} > lw)); then lw=${#label}; fi if ((${#label} > lw)); then lw=${#label}; fi
@@ -617,19 +617,19 @@ Columns: service | subdomain | host port" "$h" "$w" "$fh" "${args[@]}" 3>&1 1>&
[[ -z "$err" ]] && break [[ -z "$err" ]] && break
msg "$err" msg "$err"
done done
USE_CADDY="$uc"; VIATOR_DOMAIN="$dom" USE_CADDY="$uc"; OPSBOX_DOMAIN="$dom"
for ((i = 0; i < n; i++)); do for ((i = 0; i < n; i++)); do
IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}" IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}"
printf -v "VIATOR_SUB_$key" '%s' "${net_sub[i]}" printf -v "OPSBOX_SUB_$key" '%s' "${net_sub[i]}"
printf -v "$portv" '%s' "$((10#${net_port[i]}))" printf -v "$portv" '%s' "$((10#${net_port[i]}))"
if [[ "$bindv" != "-" ]]; then if [[ "$bindv" != "-" ]]; then
if [[ "$USE_CADDY" == yes ]]; then if [[ "$USE_CADDY" == yes ]]; then
printf -v "$bindv" '%s' "127.0.0.1" printf -v "$bindv" '%s' "127.0.0.1"
printf -v "VIATOR_HOST_$key" '%s' "" printf -v "OPSBOX_HOST_$key" '%s' ""
else else
printf -v "$bindv" '%s' "0.0.0.0" printf -v "$bindv" '%s' "0.0.0.0"
if [[ "$need" == yes ]]; then printf -v "VIATOR_HOST_$key" '%s' "${net_sub[i]}.$VIATOR_DOMAIN" if [[ "$need" == yes ]]; then printf -v "OPSBOX_HOST_$key" '%s' "${net_sub[i]}.$OPSBOX_DOMAIN"
else printf -v "VIATOR_HOST_$key" '%s' ""; fi else printf -v "OPSBOX_HOST_$key" '%s' ""; fi
fi fi
fi fi
done done
@@ -639,13 +639,13 @@ Columns: service | subdomain | host port" "$h" "$w" "$fh" "${args[@]}" 3>&1 1>&
# ---- Step 5: per-service configuration screens --------------------------------------- # ---- Step 5: per-service configuration screens ---------------------------------------
cfg_bettercap() { cfg_bettercap() {
local err local err
BETTERCAP_USER="${BETTERCAP_USER:-viator}" BETTERCAP_USER="${BETTERCAP_USER:-opsbox}"
local -a specs=("BETTERCAP_USER|Web UI username|t" "BETTERCAP_PASSWORD|Web UI password (12+ chars)|p") local -a specs=("BETTERCAP_USER|Web UI username|t" "BETTERCAP_PASSWORD|Web UI password (12+ chars)|p")
if [[ "$USE_CADDY" == yes ]]; then if [[ "$USE_CADDY" == yes ]]; then
BETTERCAP_UI_ADDR=""; BETTERCAP_ALLOW_ORIGIN="" BETTERCAP_UI_ADDR=""; BETTERCAP_ALLOW_ORIGIN=""
else else
BETTERCAP_UI_ADDR="${BETTERCAP_UI_ADDR:-0.0.0.0}" BETTERCAP_UI_ADDR="${BETTERCAP_UI_ADDR:-0.0.0.0}"
BETTERCAP_ALLOW_ORIGIN="${BETTERCAP_ALLOW_ORIGIN:-https://${VIATOR_SUB_BETTERCAP:-bettercap}.$VIATOR_DOMAIN}" BETTERCAP_ALLOW_ORIGIN="${BETTERCAP_ALLOW_ORIGIN:-https://${OPSBOX_SUB_BETTERCAP:-bettercap}.$OPSBOX_DOMAIN}"
specs+=("BETTERCAP_UI_ADDR|Listen address (0.0.0.0 = all)|t" "BETTERCAP_ALLOW_ORIGIN|Public UI URL (CORS origin)|t") specs+=("BETTERCAP_UI_ADDR|Listen address (0.0.0.0 = all)|t" "BETTERCAP_ALLOW_ORIGIN|Public UI URL (CORS origin)|t")
fi fi
while true; do while true; do
@@ -828,13 +828,13 @@ step_summary() {
sum_add " Registry login: $DOCKER_USER @ $DOCKER_REGISTRY" sum_add " Registry login: $DOCKER_USER @ $DOCKER_REGISTRY"
if ((${#NET_ROWS[@]})); then if ((${#NET_ROWS[@]})); then
sum_add "" sum_add ""
if [[ "$USE_CADDY" == yes ]]; then sum_add "NETWORK: Caddy with internal HTTPS, domain *.$VIATOR_DOMAIN" if [[ "$USE_CADDY" == yes ]]; then sum_add "NETWORK: Caddy with internal HTTPS, domain *.$OPSBOX_DOMAIN"
else sum_add "NETWORK: your own reverse proxy (services published on host ports)"; fi else sum_add "NETWORK: your own reverse proxy (services published on host ports)"; fi
for ((i = 0; i < ${#NET_ROWS[@]}; i++)); do for ((i = 0; i < ${#NET_ROWS[@]}; i++)); do
IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}" IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}"
sv="VIATOR_SUB_$key" sv="OPSBOX_SUB_$key"
if [[ "$USE_CADDY" == yes ]]; then sum_add " $(printf '%-24s' "$label") https://${!sv}.$VIATOR_DOMAIN (127.0.0.1:${!portv})" if [[ "$USE_CADDY" == yes ]]; then sum_add " $(printf '%-24s' "$label") https://${!sv}.$OPSBOX_DOMAIN (127.0.0.1:${!portv})"
else sum_add " $(printf '%-24s' "$label") ${!sv}.$VIATOR_DOMAIN (host port ${!portv})"; fi else sum_add " $(printf '%-24s' "$label") ${!sv}.$OPSBOX_DOMAIN (host port ${!portv})"; fi
done done
fi fi
if ((${#SEL_DL[@]})); then if ((${#SEL_DL[@]})); then
@@ -887,13 +887,13 @@ wizard() {
persist_config() { persist_config() {
local i key label dsub dport bindv portv need local i key label dsub dport bindv portv need
save_env VIATOR_DATA_ROOT VIATOR_ADMIN_USER VIATOR_DOMAIN USE_CADDY save_env OPSBOX_DATA_ROOT OPSBOX_ADMIN_USER OPSBOX_DOMAIN USE_CADDY
DOCKER_REGISTRY_USER="$DOCKER_USER"; VIATOR_ADMIN_USER="$ADMIN_USER" DOCKER_REGISTRY_USER="$DOCKER_USER"; OPSBOX_ADMIN_USER="$ADMIN_USER"
save_env VIATOR_ADMIN_USER DOCKER_REGISTRY_USER save_env OPSBOX_ADMIN_USER DOCKER_REGISTRY_USER
for ((i = 0; i < ${#NET_ROWS[@]}; i++)); do for ((i = 0; i < ${#NET_ROWS[@]}; i++)); do
IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}" IFS='|' read -r key label dsub dport bindv portv need <<<"${NET_ROWS[i]}"
save_env "VIATOR_SUB_$key" "$portv" save_env "OPSBOX_SUB_$key" "$portv"
if [[ "$bindv" != "-" ]]; then save_env "VIATOR_HOST_$key" "$bindv"; fi if [[ "$bindv" != "-" ]]; then save_env "OPSBOX_HOST_$key" "$bindv"; fi
done done
if contains pentest; then if contains pentest; then
save_env BETTERCAP_USER BETTERCAP_PASSWORD BETTERCAP_UI_ADDR BETTERCAP_UI_PORT BETTERCAP_API_PORT BETTERCAP_ALLOW_ORIGIN save_env BETTERCAP_USER BETTERCAP_PASSWORD BETTERCAP_UI_ADDR BETTERCAP_UI_PORT BETTERCAP_API_PORT BETTERCAP_ALLOW_ORIGIN
@@ -917,108 +917,236 @@ persist_config() {
# ====================================================================================== # ======================================================================================
install_tools() { apt_install btop jq tmux; } 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="# >>> OPSBOX BANNER >>>" marker_end="# <<< OPSBOX BANNER <<<"
local tmp="$TMP_DIR/motd" name uid home shell local tmp="$TMP_DIR/motd" name uid home shell
# Clean the old static banner out of /etc/motd if present # Clean the old static banner out of /etc/motd if present
if [ -f "$motd" ]; then if [ -f "$motd" ]; then
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" 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.opsbox-backup.$(date +%s)"
install -m 0644 "$tmp" "$motd" install -m 0644 "$tmp" "$motd"
fi fi
# World-readable location (the config dir is root-only, so users could not source it).
mkdir -p "$THEME_DIR" mkdir -p "$THEME_DIR"
rm -f /etc/motd /etc/update-motd.d/*
# ------------------------------------------------------------------
# Disable sshd's own "Last login:" line (our banner shows it instead)
# ------------------------------------------------------------------
if [ -d /etc/ssh ]; then
mkdir -p /etc/ssh/sshd_config.d
echo 'PrintLastLog no' > /etc/ssh/sshd_config.d/00-opsbox.conf
if sshd -t 2>/dev/null; then
systemctl reload ssh 2>/dev/null || systemctl reload sshd 2>/dev/null || true
else
rm -f /etc/ssh/sshd_config.d/00-opsbox.conf
log "sshd config test failed; left PrintLastLog unchanged."
fi
fi
cat > /usr/local/sbin/opsbox-updates <<'UPD'
#!/bin/sh
out=/var/cache/opsbox/updates
mkdir -p "${out%/*}"
n=0; s=0
if command -v apt-get >/dev/null 2>&1; then
list=$(apt-get -s -o Debug::NoLocking=1 upgrade 2>/dev/null | grep '^Inst ')
n=$(printf '%s\n' "$list" | grep -c .)
s=$(printf '%s\n' "$list" | grep -ci security)
elif command -v dnf >/dev/null 2>&1; then
n=$(dnf -q check-update 2>/dev/null | awk 'NF==3' | wc -l)
s=$(dnf -q updateinfo list security 2>/dev/null | awk 'NF==3' | wc -l)
fi
echo "$n $s" > "$out.tmp" && mv "$out.tmp" "$out" && chmod 0644 "$out"
UPD
chmod 0755 /usr/local/sbin/opsbox-updates
if command -v apt-get >/dev/null 2>&1; then
cat > /etc/apt/apt.conf.d/99opsbox-updates <<'APTHOOK'
APT::Update::Post-Invoke-Success { "/usr/local/sbin/opsbox-updates >/dev/null 2>&1 || true"; };
DPkg::Post-Invoke { "/usr/local/sbin/opsbox-updates >/dev/null 2>&1 || true"; };
APTHOOK
fi
/usr/local/sbin/opsbox-updates || true
cat > "$THEME_DIR/theme.sh" <<'THEME' cat > "$THEME_DIR/theme.sh" <<'THEME'
# Viator login banner + prompt. Sourced from ~/.bashrc and /etc/profile.d/viator.sh. # OpsBox login banner + prompt.
[ -n "${BASH_VERSION:-}" ] || return 0 [ -n "${BASH_VERSION:-}" ] || return 0
case $- in *i*) ;; *) return 0 ;; esac case $- in *i*) ;; *) return 0 ;; esac
__viator_rep() { __opsbox_rep() {
local n=$1 c=$2 s local n=$1 c=$2 s
[ "$n" -gt 0 ] || return 0 [ "$n" -gt 0 ] || return 0
printf -v s '%*s' "$n" '' printf -v s '%*s' "$n" ''
printf '%s' "${s// /$c}" printf '%s' "${s// /$c}"
} }
__viator_ifaces() { __opsbox_row() {
printf '| %-*s |\n' "$((W - 4))" "$(printf '%s' "$1" | cut -c1-$((W - 4)))"
}
__opsbox_ifaces() {
local p n local p n
for p in /sys/class/net/*; do for p in /sys/class/net/*; do
n=${p##*/} n=${p##*/}
case $n in case $n in
lo|docker*|br-*|veth*|virbr*|bond*|dummy*|ifb*|sit*|tunl*|ip6tnl*|gre*|erspan*) continue ;; lo|docker*|br-*|veth*|virbr*|bond*|dummy*|ifb*|sit*|tunl*|ip6tnl*|gre*|erspan*) continue ;;
esac esac
if [ -e "$p/device" ] || [ -d "$p/wireless" ]; then printf '%s\n' "$n" # WireGuard is reported in the VPN row instead.
else case $n in wg*|tun*|tailscale*) printf '%s\n' "$n" ;; esac if grep -qx 'DEVTYPE=wireguard' "$p/uevent" 2>/dev/null; then continue; fi
if [ -e "$p/device" ] || [ -d "$p/wireless" ]; then
printf '%s\n' "$n"
else
case $n in tun*|tailscale*) printf '%s\n' "$n" ;; esac
fi fi
done done
} }
__viator_banner() { __opsbox_vpn() {
local W=64 user now src prev lastf ifc ip status row local p n ip ts age hs now
now=$(date +%s)
for p in /sys/class/net/*; do
n=${p##*/}
grep -qx 'DEVTYPE=wireguard' "$p/uevent" 2>/dev/null || continue
ip=$(ip -4 -o addr show dev "$n" 2>/dev/null | awk '{print $4}' | cut -d/ -f1 | head -n1)
[ -n "$ip" ] && ip="// $ip"
if hs=$(wg show "$n" latest-handshakes 2>/dev/null); then
ts=$(printf '%s\n' "$hs" | awk '$2>m{m=$2} END{print m+0}')
if [ "$ts" -eq 0 ]; then
printf '%-10s %-14s %s\n' "$n" "NO HANDSHAKE" "$ip"
else
age=$((now - ts))
if [ "$age" -le 180 ]; then
printf '%-10s %-14s %s (hs %ss)\n' "$n" "CONNECTED" "$ip" "$age"
else
printf '%-10s %-14s %s (hs %sm)\n' "$n" "STALE" "$ip" "$((age / 60))"
fi
fi
else
printf '%-10s %-14s %s\n' "$n" "UP" "$ip"
fi
done
}
__opsbox_banner() {
local W=68 user host now src prev lastf ifc ip status row
local any=0 os kern upd n s reboot line
user=$(id -un 2>/dev/null || echo "${USER:-unknown}") user=$(id -un 2>/dev/null || echo "${USER:-unknown}")
host=$(hostname -s 2>/dev/null || hostname)
host="${host:0:32}"
now=$(date '+%a %d %b %H:%M') now=$(date '+%a %d %b %H:%M')
if [ -n "${SSH_CONNECTION:-}" ]; then if [ -n "${SSH_CONNECTION:-}" ]; then
src="ssh ${SSH_CONNECTION%% *}" src="ssh ${SSH_CONNECTION%% *}"
else else
src=$(tty 2>/dev/null || true) src=$(tty 2>/dev/null || true)
case $src in ""|"not a tty") src="local" ;; *) src=${src#/dev/} ;; esac case $src in
""|"not a tty") src="local" ;;
*) src=${src#/dev/} ;;
esac
fi fi
# Own bookkeeping: works whether or not wtmp/lastlog exist on this distro.
lastf="${HOME:-/tmp}/.viator_last_login" lastf="${HOME:-/tmp}/.opsbox_last_login"
prev="first session" prev="first session"
[ -r "$lastf" ] && prev=$(head -n1 "$lastf" 2>/dev/null) [ -r "$lastf" ] && prev=$(head -n1 "$lastf" 2>/dev/null)
printf '%s (%s)\n' "$now" "$src" > "$lastf" 2>/dev/null || true printf '%s (%s)\n' "$now" "$src" > "$lastf" 2>/dev/null || true
os=$(. /etc/os-release 2>/dev/null && printf '%s' "${PRETTY_NAME:-$NAME}")
[ -n "$os" ] || os=$(uname -s)
kern=$(uname -r)
upd="UNKNOWN"
if [ -r /var/cache/opsbox/updates ]; then
read -r n s < /var/cache/opsbox/updates
if [ "${n:-0}" -eq 0 ]; then
upd="up to date"
elif [ "${s:-0}" -gt 0 ]; then
upd="$n pending ($s security)"
else
upd="$n pending"
fi
fi
[ -e /run/reboot-required ] && upd="$upd // REBOOT REQUIRED"
printf '.-[ VIATOR ]%s.\n' "$(__viator_rep $((W - 13)) -)" # Header.
printf '| %-*s |\n' $((W - 4)) "$(printf 'ACCESS: %s // LAST: %s' "${user^^}" "$prev" | cut -c1-$((W - 4)))" printf '+==[ %s ]' "$host"
printf '| %-*s |\n' $((W - 4)) "" printf '%s+\n' "$(__opsbox_rep "$((W - ${#host} - 8))" '=')"
local any=0
for ifc in $(__viator_ifaces); do __opsbox_row "$(printf 'ACCESS: %s // LAST: %s' "${user^^}" "$prev")"
__opsbox_row "$(printf 'OS: %s // %s' "$os" "$kern")"
__opsbox_row "$(printf 'UPDATES: %s' "$upd")"
printf '|%s|\n' "$(__opsbox_rep "$((W - 2))" '-')"
# Network interfaces.
for ifc in $(__opsbox_ifaces); do
any=1 any=1
ip=$(ip -4 -o addr show dev "$ifc" scope global 2>/dev/null | awk '{print $4}' | cut -d/ -f1 | head -n1)
if [ -n "$ip" ]; then status="CONNECTED"; else status="DISCONNECTED"; ip=""; fi ip=$(ip -4 -o addr show dev "$ifc" scope global 2>/dev/null |
awk '{print $4}' | cut -d/ -f1 | head -n1)
if [ -n "$ip" ]; then
status="CONNECTED"
ip="// $ip"
else
status="DISCONNECTED"
ip=""
fi
row=$(printf '%-10s %-14s %s' "$ifc" "$status" "$ip") row=$(printf '%-10s %-14s %s' "$ifc" "$status" "$ip")
printf '| %-*s |\n' $((W - 4)) "$(printf '%s' "$row" | cut -c1-$((W - 4)))" __opsbox_row "$row"
done done
[ "$any" = 1 ] || printf '| %-*s |\n' $((W - 4)) "no network adapters found"
printf '`%s[░▒▓█]------'"'"'\n' "$(__viator_rep $((W - 14)) -)" # VPN interfaces (WireGuard), same column layout.
while IFS= read -r line; do
[ -n "$line" ] || continue
any=1
__opsbox_row "$line"
done < <(__opsbox_vpn)
[ "$any" = 1 ] || __opsbox_row "NO NETWORK ADAPTERS FOUND"
# Footer.
printf '+%s+\n' "$(__opsbox_rep "$((W - 2))" '=')"
} }
__viator_prompt() { __opsbox_prompt() {
local c='\[\e[36m\]' u='\[\e[33m\]' d='\[\e[97m\]' r='\[\e[m\]' local c='\[\e[36m\]' u='\[\e[33m\]' d='\[\e[97m\]' r='\[\e[m\]'
if [ "$(id -u)" -eq 0 ]; then c='\[\e[91m\]'; fi if [ "$(id -u)" -eq 0 ]; then c='\[\e[91m\]'; fi
PS1="${c}╭──(${u}\u${c}@${u}\h${c})-[${d}\w${c}]${r}\n${c}╰─${r}\\$ " PS1="${c}╭──(${u}\u${c}@${u}\h${c})-[${d}\w${c}]${r}\n${c}╰─${r}\\$ "
} }
if [ -z "${VIATOR_BANNER_SHOWN:-}" ]; then if [ -z "${OPSBOX_BANNER_SHOWN:-}" ]; then
export VIATOR_BANNER_SHOWN=1 export OPSBOX_BANNER_SHOWN=1
__viator_banner __opsbox_banner
fi fi
__viator_prompt
unset -f __viator_banner __viator_prompt __viator_ifaces __viator_rep __opsbox_prompt
unset -f __opsbox_banner __opsbox_prompt __opsbox_ifaces __opsbox_rep __opsbox_row __opsbox_vpn
THEME THEME
chmod 0755 "$THEME_DIR" chmod 0755 "$THEME_DIR"
chmod 0644 "$THEME_DIR/theme.sh" chmod 0644 "$THEME_DIR/theme.sh"
# Login shells (ssh, console): banner + prompt. # Login shells.
cat > /etc/profile.d/viator.sh <<'PROFILE' cat > /etc/profile.d/opsbox.sh <<'PROFILE'
# Viator theme for login shells (the prompt is also applied from ~/.bashrc). if [ -r /usr/local/share/opsbox/theme.sh ]; then . /usr/local/share/opsbox/theme.sh; fi
if [ -r /usr/local/share/viator/theme.sh ]; then . /usr/local/share/viator/theme.sh; fi
PROFILE PROFILE
chmod 0644 /etc/profile.d/viator.sh chmod 0644 /etc/profile.d/opsbox.sh
# ~/.bashrc normally redefines PS1 AFTER /etc/profile.d, which is why a profile.d-only # Hook bashrc files.
# theme never showed up for existing users or root. Hook the end of every bashrc.
while IFS=: read -r name _ uid _ _ home shell; do while IFS=: read -r name _ uid _ _ home shell; do
if [[ "$name" == root || "$name" == "$ADMIN_USER" ]] || ((uid >= 1000 && uid < 60000)); then if [[ "$name" == root || "$name" == "$ADMIN_USER" ]] || ((uid >= 1000 && uid < 60000)); then
[[ "$shell" == *nologin || "$shell" == */false ]] && continue [[ "$shell" == *nologin || "$shell" == */false ]] && continue
[[ -d "$home" ]] && hook_bashrc "$home/.bashrc" [[ -d "$home" ]] && hook_bashrc "$home/.bashrc"
fi fi
done < <(getent passwd) done < <(getent passwd)
hook_bashrc /root/.bashrc hook_bashrc /root/.bashrc
hook_bashrc /etc/skel/.bashrc hook_bashrc /etc/skel/.bashrc
log "Theme installed. Open a new shell (or run: source ~/.bashrc) to see it." log "Theme installed. Open a new shell (or run: source ~/.bashrc) to see it."
} }
@@ -1027,12 +1155,12 @@ hook_bashrc() {
[[ -d "$(dirname "$rc")" ]] || return 0 [[ -d "$(dirname "$rc")" ]] || return 0
[[ -e "$rc" ]] || new=yes [[ -e "$rc" ]] || new=yes
touch "$rc" touch "$rc"
sed -i '\|# >>> viator theme >>>|,\|# <<< viator theme <<<|d' "$rc" sed -i '\|# >>> opsbox theme >>>|,\|# <<< opsbox theme <<<|d' "$rc"
cat >> "$rc" <<'HOOK' cat >> "$rc" <<'HOOK'
# >>> viator theme >>> # >>> opsbox theme >>>
if [ -r /usr/local/share/viator/theme.sh ]; then . /usr/local/share/viator/theme.sh; fi if [ -r /usr/local/share/opsbox/theme.sh ]; then . /usr/local/share/opsbox/theme.sh; fi
# <<< viator theme <<< # <<< opsbox theme <<<
HOOK HOOK
if [[ "$new" == yes ]]; then chown --reference="$(dirname "$rc")" "$rc" || true; fi if [[ "$new" == yes ]]; then chown --reference="$(dirname "$rc")" "$rc" || true; fi
return 0 return 0
@@ -1145,7 +1273,7 @@ os.chmod(tmp, 0o644); os.replace(tmp, path)
PY PY
systemctl enable --now docker || return 1 systemctl enable --now docker || return 1
systemctl restart docker || return 1 systemctl restart docker || return 1
docker network inspect viator_proxy >/dev/null 2>&1 || docker network create viator_proxy >/dev/null docker network inspect opsbox_proxy >/dev/null 2>&1 || docker network create opsbox_proxy >/dev/null
usermod -aG docker "$ADMIN_USER" usermod -aG docker "$ADMIN_USER"
} }
@@ -1173,9 +1301,9 @@ docker_login() {
install_caddy() { 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 opsbox_proxy >/dev/null 2>&1 || docker network create opsbox_proxy >/dev/null
local compose="$VIATOR_DIR/docker/caddy.yml" local compose="$OPSBOX_DIR/docker/caddy.yml"
VIATOR_DATA_ROOT="$DATA_ROOT" docker compose --env-file "$ENV_FILE" -f "$compose" up -d OPSBOX_DATA_ROOT="$DATA_ROOT" docker compose --env-file "$ENV_FILE" -f "$compose" up -d
} }
install_docker_stack() { install_docker_stack() {
@@ -1188,7 +1316,7 @@ install_docker_stack() {
export_caddy_ca() { export_caddy_ca() {
[[ "$USE_CADDY" == yes ]] || return 0 [[ "$USE_CADDY" == yes ]] || return 0
for _ in {1..20}; do for _ in {1..20}; do
docker cp viator-caddy:/data/caddy/pki/authorities/local/root.crt "$CONFIG_DIR/caddy-root.crt" 2>/dev/null && break docker cp opsbox-caddy:/data/caddy/pki/authorities/local/root.crt "$CONFIG_DIR/caddy-root.crt" 2>/dev/null && break
sleep 2 sleep 2
done done
if [[ -f "$CONFIG_DIR/caddy-root.crt" ]]; then if [[ -f "$CONFIG_DIR/caddy-root.crt" ]]; then
@@ -1201,11 +1329,11 @@ compose_stack() {
local name="$1" file="$2" envfile="" local name="$1" file="$2" envfile=""
shift 2 shift 2
if (($#)) && [[ "$1" != --profile* ]]; then envfile="$1"; shift; fi if (($#)) && [[ "$1" != --profile* ]]; then envfile="$1"; shift; fi
local target="$VIATOR_DIR/$file" local target="$OPSBOX_DIR/$file"
local -a args=(docker compose -f "$target") local -a args=(docker compose -f "$target")
mkdir -p "$DATA_ROOT/$name" mkdir -p "$DATA_ROOT/$name"
[[ -n "$envfile" ]] && args+=(--env-file "$envfile") [[ -n "$envfile" ]] && args+=(--env-file "$envfile")
VIATOR_DATA_ROOT="$DATA_ROOT" "${args[@]}" "$@" up -d OPSBOX_DATA_ROOT="$DATA_ROOT" "${args[@]}" "$@" up -d
} }
# ---- container services --------------------------------------------------------------- # ---- container services ---------------------------------------------------------------
@@ -1217,8 +1345,8 @@ install_opentak() {
mkdir -p "$dir" mkdir -p "$dir"
# Retire the old GoATAK stack if present (its data in $DATA_ROOT/atak is left untouched). # Retire the old GoATAK stack if present (its data in $DATA_ROOT/atak is left untouched).
if [[ -f "$VIATOR_DIR/docker/atak.yml" ]]; then if [[ -f "$OPSBOX_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 OPSBOX_DATA_ROOT="$DATA_ROOT" docker compose --env-file "$ENV_FILE" -f "$OPSBOX_DIR/docker/atak.yml" down --remove-orphans 2>/dev/null || true
fi fi
# Upstream installer: fetch compose + generate .env under ./data/opentak; don't start yet. # Upstream installer: fetch compose + generate .env under ./data/opentak; don't start yet.
@@ -1231,8 +1359,8 @@ install_opentak() {
env_put "$dir/.env" OTS_WEB_BIND "$OTS_WEB_BIND" env_put "$dir/.env" OTS_WEB_BIND "$OTS_WEB_BIND"
env_put "$dir/.env" OTS_WEB_PORT "$OTS_WEB_PORT" env_put "$dir/.env" OTS_WEB_PORT "$OTS_WEB_PORT"
env_put "$dir/.env" VIATOR_DOMAIN "$VIATOR_DOMAIN" env_put "$dir/.env" OPSBOX_DOMAIN "$OPSBOX_DOMAIN"
env_put "$dir/.env" VIATOR_SUB_OPENTAK "${VIATOR_SUB_OPENTAK:-tak}" env_put "$dir/.env" OPSBOX_SUB_OPENTAK "${OPSBOX_SUB_OPENTAK:-tak}"
# Auto-merged by compose; upstream's docker-compose.yml stays untouched/upgradable. # 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 # 8089 (SSL CoT) and 8446 (cert enrollment) are raw TLS, so they're always published
@@ -1248,14 +1376,14 @@ services:
- default - default
- proxy - proxy
labels: labels:
caddy: \${VIATOR_SUB_OPENTAK:-tak}.\${VIATOR_DOMAIN:-viator.internal} caddy: \${OPSBOX_SUB_OPENTAK:-tak}.\${OPSBOX_DOMAIN:-opsbox.internal}
caddy.reverse_proxy: "{{upstreams 8080}}" caddy.reverse_proxy: "{{upstreams 8080}}"
caddy.tls: internal caddy.tls: internal
networks: networks:
proxy: proxy:
external: true external: true
name: viator_proxy name: opsbox_proxy
OVERRIDE OVERRIDE
(cd "$dir" && docker compose config -q) || { err "Compose validation failed in $dir"; return 1; } (cd "$dir" && docker compose config -q) || { err "Compose validation failed in $dir"; return 1; }
@@ -1293,12 +1421,12 @@ install_maps() {
done done
mkdir -p "$DATA_ROOT/maps/tileserver" mkdir -p "$DATA_ROOT/maps/tileserver"
if [[ ! -f "$DATA_ROOT/maps/tileserver/config.json" ]]; then if [[ ! -f "$DATA_ROOT/maps/tileserver/config.json" ]]; then
install -m 0644 "$VIATOR_DIR/data/maps/tileserver/config.json" \ install -m 0644 "$OPSBOX_DIR/data/maps/tileserver/config.json" \
"$DATA_ROOT/maps/tileserver/config.json" "$DATA_ROOT/maps/tileserver/config.json"
fi fi
if [[ "$DATA_ROOT" != "$VIATOR_DIR/data" ]]; then if [[ "$DATA_ROOT" != "$OPSBOX_DIR/data" ]]; then
mkdir -p "$DATA_ROOT/maps/tileserver/styles" mkdir -p "$DATA_ROOT/maps/tileserver/styles"
cp -an "$VIATOR_DIR/data/maps/tileserver/styles/." \ cp -an "$OPSBOX_DIR/data/maps/tileserver/styles/." \
"$DATA_ROOT/maps/tileserver/styles/" "$DATA_ROOT/maps/tileserver/styles/"
fi fi
local -a profiles=() local -a profiles=()
@@ -1312,9 +1440,9 @@ install_personal_cloud() { compose_stack personal-cloud docker/cloud.yml "$ENV_F
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 || return 1 nmap masscan reaver sqlmap tcpdump wireshark || return 1
VIATOR_DOCKER_GATEWAY="$(docker network inspect bridge --format '{{(index .IPAM.Config 0).Gateway}}' 2>/dev/null || true)" OPSBOX_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}" OPSBOX_DOCKER_GATEWAY="${OPSBOX_DOCKER_GATEWAY:-172.17.0.1}"
save_env VIATOR_DOCKER_GATEWAY save_env OPSBOX_DOCKER_GATEWAY
curl -fsSL https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfinstall.erb -o "$TMP_DIR/msfinstall" || return 1 curl -fsSL https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfinstall.erb -o "$TMP_DIR/msfinstall" || return 1
chmod 0700 "$TMP_DIR/msfinstall" chmod 0700 "$TMP_DIR/msfinstall"
"$TMP_DIR/msfinstall" || return 1 "$TMP_DIR/msfinstall" || return 1
@@ -1325,8 +1453,8 @@ install_pentest() {
# and sanity-check that the HAT's SDR is visible on USB. # and sanity-check that the HAT's SDR is visible on USB.
prepare_rtlsdr_host() { prepare_rtlsdr_host() {
apt_install rtl-sdr usbutils || return 1 apt_install rtl-sdr usbutils || return 1
cat > /etc/modprobe.d/viator-rtlsdr.conf <<'BLACKLIST' cat > /etc/modprobe.d/opsbox-rtlsdr.conf <<'BLACKLIST'
# Managed by Viator: keep the kernel DVB driver off RTL-SDR dongles so SDR apps can claim them. # Managed by opsbox: keep the kernel DVB driver off RTL-SDR dongles so SDR apps can claim them.
blacklist dvb_usb_rtl28xxu blacklist dvb_usb_rtl28xxu
blacklist rtl2832 blacklist rtl2832
blacklist rtl2832_sdr blacklist rtl2832_sdr
@@ -1361,7 +1489,7 @@ install_sdr_decoders() {
install_ai() { install_ai() {
apt_install curl ca-certificates || return 1 apt_install curl ca-certificates || return 1
local dir="$AI_DIR" repo="$AI_REPO" user=viator-ai local dir="$AI_DIR" repo="$AI_REPO" user=opsbox-ai
id "$user" >/dev/null 2>&1 || useradd --system --home "$dir" --create-home --shell /usr/sbin/nologin "$user" id "$user" >/dev/null 2>&1 || useradd --system --home "$dir" --create-home --shell /usr/sbin/nologin "$user"
mkdir -p "$dir" mkdir -p "$dir"
chown -R "$user:$user" "$dir" chown -R "$user:$user" "$dir"
@@ -1463,7 +1591,7 @@ main() {
if ((${#FAILED[@]})); then for x in "${FAILED[@]}"; do report+=" * $x"$'\n'; done; else report+=$' (none)\n'; fi if ((${#FAILED[@]})); then for x in "${FAILED[@]}"; do report+=" * $x"$'\n'; done; else report+=$' (none)\n'; fi
report+=$'\nReboot is recommended if hardware overlays or kernel modules changed.' report+=$'\nReboot is recommended if hardware overlays or kernel modules changed.'
msg "$report" msg "$report"
printf '%s\n' "Succeeded: ${SUCCEEDED[*]:-(none)}" "Failed: ${FAILED[*]:-(none)}" | tee "/var/log/viator/install-$(date +%F-%H%M%S).log" printf '%s\n' "Succeeded: ${SUCCEEDED[*]:-(none)}" "Failed: ${FAILED[*]:-(none)}" | tee "/var/log/opsbox/install-$(date +%F-%H%M%S).log"
} }
main "$@" main "$@"