update
This commit is contained in:
@@ -143,9 +143,12 @@ The tracked example contains only:
|
|||||||
|
|
||||||
```dotenv
|
```dotenv
|
||||||
TAPM_BROKER_URL=https://tapm.example.com
|
TAPM_BROKER_URL=https://tapm.example.com
|
||||||
|
GITEA_DOMAIN=git.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace it with the deployed HTTPS origin, without an API path. There is no
|
Replace it with the deployed HTTPS origin, without an API path. There is no
|
||||||
hard-coded operational broker URL; authorization fails with a configuration
|
hard-coded operational broker URL; authorization fails with a configuration
|
||||||
message when the variable is missing or invalid. Repository updates do not
|
message when the variable is missing or invalid. `GITEA_DOMAIN` is a hostname,
|
||||||
|
without `https://` or a path, and controls Gitea connectivity plus restoration
|
||||||
|
of the `voltron/iDS-Defaults.git` repository. Repository updates do not
|
||||||
overwrite the system configuration file.
|
overwrite the system configuration file.
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
# Copy to /etc/ta-proxmenu/config.env and replace with the deployed broker.
|
# Copy to /etc/ta-proxmenu/config.env and replace with the deployed broker.
|
||||||
TAPM_BROKER_URL=https://tapm.example.com
|
TAPM_BROKER_URL=https://tapm.example.com
|
||||||
|
GITEA_DOMAIN=git.example.com
|
||||||
|
|||||||
+21
-11
@@ -20,19 +20,29 @@ PULSE_RELEASE='v6.1.1'
|
|||||||
PULSE_PORT='7655'
|
PULSE_PORT='7655'
|
||||||
|
|
||||||
TAPM_CONFIG_FILE='/etc/ta-proxmenu/config.env'
|
TAPM_CONFIG_FILE='/etc/ta-proxmenu/config.env'
|
||||||
if [[ -z "${TAPM_BROKER_URL:-}" && -r "$TAPM_CONFIG_FILE" ]]; then
|
for config_key in TAPM_BROKER_URL GITEA_DOMAIN; do
|
||||||
TAPM_BROKER_URL="$(
|
if [[ -z "${!config_key:-}" && -r "$TAPM_CONFIG_FILE" ]]; then
|
||||||
sed -n 's/^[[:space:]]*TAPM_BROKER_URL[[:space:]]*=[[:space:]]*//p' \
|
config_value="$(
|
||||||
"$TAPM_CONFIG_FILE" |
|
sed -n "s/^[[:space:]]*${config_key}[[:space:]]*=[[:space:]]*//p" \
|
||||||
tail -n 1
|
"$TAPM_CONFIG_FILE" |
|
||||||
)"
|
tail -n 1
|
||||||
TAPM_BROKER_URL="${TAPM_BROKER_URL#\"}"
|
)"
|
||||||
TAPM_BROKER_URL="${TAPM_BROKER_URL%\"}"
|
config_value="${config_value#\"}"
|
||||||
TAPM_BROKER_URL="${TAPM_BROKER_URL#\'}"
|
config_value="${config_value%\"}"
|
||||||
TAPM_BROKER_URL="${TAPM_BROKER_URL%\'}"
|
config_value="${config_value#\'}"
|
||||||
fi
|
config_value="${config_value%\'}"
|
||||||
|
printf -v "$config_key" '%s' "$config_value"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset config_key config_value
|
||||||
TAPM_BROKER_URL="${TAPM_BROKER_URL:-}"
|
TAPM_BROKER_URL="${TAPM_BROKER_URL:-}"
|
||||||
TAPM_BROKER_URL="${TAPM_BROKER_URL%/}"
|
TAPM_BROKER_URL="${TAPM_BROKER_URL%/}"
|
||||||
|
GITEA_DOMAIN="${GITEA_DOMAIN:-}"
|
||||||
|
if [[ "$GITEA_DOMAIN" =~ ^[A-Za-z0-9.-]+(:[0-9]+)?$ ]]; then
|
||||||
|
GITEA_URL="https://${GITEA_DOMAIN}"
|
||||||
|
else
|
||||||
|
GITEA_URL=''
|
||||||
|
fi
|
||||||
S1_BROKER_PACKAGE='sentinelone-linux'
|
S1_BROKER_PACKAGE='sentinelone-linux'
|
||||||
S1_PACKAGE='tapm-sentinelone.deb'
|
S1_PACKAGE='tapm-sentinelone.deb'
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,26 @@ DEFAULTS_REPOSITORY='/opt/idssys/defaults'
|
|||||||
DEFAULTS_CACHE_DIR='/var/cache/ta-proxmenu'
|
DEFAULTS_CACHE_DIR='/var/cache/ta-proxmenu'
|
||||||
DEFAULTS_CHECK_FILE="${DEFAULTS_CACHE_DIR}/defaults-last-check"
|
DEFAULTS_CHECK_FILE="${DEFAULTS_CACHE_DIR}/defaults-last-check"
|
||||||
DEFAULTS_CHECK_SECONDS=14400
|
DEFAULTS_CHECK_SECONDS=14400
|
||||||
|
TAPM_CONFIG_FILE='/etc/ta-proxmenu/config.env'
|
||||||
|
|
||||||
|
if [[ -z "${GITEA_DOMAIN:-}" && -r "$TAPM_CONFIG_FILE" ]]; then
|
||||||
|
GITEA_DOMAIN="$(
|
||||||
|
sed -n 's/^[[:space:]]*GITEA_DOMAIN[[:space:]]*=[[:space:]]*//p' \
|
||||||
|
"$TAPM_CONFIG_FILE" |
|
||||||
|
tail -n 1
|
||||||
|
)"
|
||||||
|
GITEA_DOMAIN="${GITEA_DOMAIN#\"}"
|
||||||
|
GITEA_DOMAIN="${GITEA_DOMAIN%\"}"
|
||||||
|
GITEA_DOMAIN="${GITEA_DOMAIN#\'}"
|
||||||
|
GITEA_DOMAIN="${GITEA_DOMAIN%\'}"
|
||||||
|
fi
|
||||||
|
if [[ "${GITEA_DOMAIN:-}" =~ ^[A-Za-z0-9.-]+(:[0-9]+)?$ ]]; then
|
||||||
|
GITEA_URL="https://${GITEA_DOMAIN}"
|
||||||
|
DEFAULTS_REPOSITORY_URL="${GITEA_URL}/voltron/iDS-Defaults.git"
|
||||||
|
else
|
||||||
|
GITEA_URL=''
|
||||||
|
DEFAULTS_REPOSITORY_URL=''
|
||||||
|
fi
|
||||||
|
|
||||||
source /opt/idssys/ta-proxmenu/inc/git-update.inc
|
source /opt/idssys/ta-proxmenu/inc/git-update.inc
|
||||||
|
|
||||||
@@ -36,9 +56,13 @@ AUTO_UPDATE_DEFAULTS() {
|
|||||||
|
|
||||||
if [[ ! -d "${DEFAULTS_REPOSITORY}/.git" ]]; then
|
if [[ ! -d "${DEFAULTS_REPOSITORY}/.git" ]]; then
|
||||||
echo "iDSSYS Defaults is missing; restoring it from origin..."
|
echo "iDSSYS Defaults is missing; restoring it from origin..."
|
||||||
|
if [[ -z "$DEFAULTS_REPOSITORY_URL" ]]; then
|
||||||
|
echo "WARNING: GITEA_DOMAIN is not configured; unable to restore iDSSYS Defaults." >&2
|
||||||
|
return
|
||||||
|
fi
|
||||||
mkdir -p /opt/idssys
|
mkdir -p /opt/idssys
|
||||||
if ! timeout 60 git clone \
|
if ! timeout 60 git clone \
|
||||||
https://git.scity.us/voltron/iDS-Defaults.git "$DEFAULTS_REPOSITORY"; then
|
"$DEFAULTS_REPOSITORY_URL" "$DEFAULTS_REPOSITORY"; then
|
||||||
echo "WARNING: Unable to restore iDSSYS Defaults." >&2
|
echo "WARNING: Unable to restore iDSSYS Defaults." >&2
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -234,9 +258,13 @@ INSTALL_UPDATES() {
|
|||||||
local update_failed=0
|
local update_failed=0
|
||||||
|
|
||||||
echo -e "${idsCL[LightCyan]}Checking for updates...${idsCL[Default]}"
|
echo -e "${idsCL[LightCyan]}Checking for updates...${idsCL[Default]}"
|
||||||
|
if [[ -z "$GITEA_URL" ]]; then
|
||||||
|
echo -e "${idsCL[Red]}GITEA_DOMAIN is not configured in ${TAPM_CONFIG_FILE}.${idsCL[Default]}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
if ! curl --fail --silent --show-error --head \
|
if ! curl --fail --silent --show-error --head \
|
||||||
--connect-timeout 3 --max-time 10 https://git.scity.us >/dev/null; then
|
--connect-timeout 3 --max-time 10 "$GITEA_URL" >/dev/null; then
|
||||||
echo -e "${idsCL[Red]}Could not connect to git.scity.us${idsCL[Default]}"
|
echo -e "${idsCL[Red]}Could not connect to ${GITEA_DOMAIN}${idsCL[Default]}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user