diff --git a/README.md b/README.md index 6e7ad8e..2177737 100644 --- a/README.md +++ b/README.md @@ -124,3 +124,28 @@ maintenance evacuation routing, HA affinity parsing, host-profile migration signatures and backups, and VirtIO filename validation. Tests use temporary files and mocked Proxmox output; they do not download installers or change a Proxmox host. +## Deployment broker URL + +TA-ProxMenu exchanges deployment codes with the configured TAPM broker. The +URL is selected in this order: + +1. Existing `TAPM_BROKER_URL` environment variable +2. `TAPM_BROKER_URL` in `/etc/ta-proxmenu/config.env` + +For a persistent per-system setting: + +```sh +install -d -m 0755 /etc/ta-proxmenu +install -m 0644 config.env.example /etc/ta-proxmenu/config.env +``` + +The tracked example contains only: + +```dotenv +TAPM_BROKER_URL=https://tapm.example.com +``` + +Replace it with the deployed HTTPS origin, without an API path. There is no +hard-coded operational broker URL; authorization fails with a configuration +message when the variable is missing or invalid. Repository updates do not +overwrite the system configuration file. diff --git a/config.env.example b/config.env.example new file mode 100644 index 0000000..1e8f1d9 --- /dev/null +++ b/config.env.example @@ -0,0 +1,2 @@ +# Copy to /etc/ta-proxmenu/config.env and replace with the deployed broker. +TAPM_BROKER_URL=https://tapm.example.com diff --git a/defaults.inc b/defaults.inc index dbe9109..8ef37e1 100755 --- a/defaults.inc +++ b/defaults.inc @@ -19,7 +19,20 @@ VIRTIO_STABLE_URL="https://fedorapeople.org/groups/virt/virtio-win/direct-downlo PULSE_RELEASE='v6.1.1' PULSE_PORT='7655' -TAPM_BROKER_URL='https://tapm.scity.us' +TAPM_CONFIG_FILE='/etc/ta-proxmenu/config.env' +if [[ -z "${TAPM_BROKER_URL:-}" && -r "$TAPM_CONFIG_FILE" ]]; then + TAPM_BROKER_URL="$( + sed -n 's/^[[:space:]]*TAPM_BROKER_URL[[:space:]]*=[[:space:]]*//p' \ + "$TAPM_CONFIG_FILE" | + tail -n 1 + )" + TAPM_BROKER_URL="${TAPM_BROKER_URL#\"}" + TAPM_BROKER_URL="${TAPM_BROKER_URL%\"}" + TAPM_BROKER_URL="${TAPM_BROKER_URL#\'}" + TAPM_BROKER_URL="${TAPM_BROKER_URL%\'}" +fi +TAPM_BROKER_URL="${TAPM_BROKER_URL:-}" +TAPM_BROKER_URL="${TAPM_BROKER_URL%/}" S1_BROKER_PACKAGE='sentinelone-linux' S1_PACKAGE='tapm-sentinelone.deb' diff --git a/proxmenu-scripts.sh b/proxmenu-scripts.sh index a64f6f5..cd8694a 100755 --- a/proxmenu-scripts.sh +++ b/proxmenu-scripts.sh @@ -161,6 +161,11 @@ TAPM_AUTHORIZE() { local -a access TAPM_CLEAR_AUTHORIZATION + if ! TAPM_VALID_HTTPS_URL "${TAPM_BROKER_URL:-}"; then + echo -e "${idsCL[LightRed]}TAPM_BROKER_URL is not configured with a valid HTTPS origin.${idsCL[Default]}" + echo -e "${idsCL[LightYellow]}Set it in /etc/ta-proxmenu/config.env before authorizing this installation.${idsCL[Default]}" + return 1 + fi if ! command -v python3 >/dev/null 2>&1; then echo -e "${idsCL[LightRed]}Python 3 is required to authorize ${authorization_label}.${idsCL[Default]}" return 1