diff --git a/spn/tools/Dockerfile b/spn/tools/Dockerfile index dbe39af1..ef6ec68b 100644 --- a/spn/tools/Dockerfile +++ b/spn/tools/Dockerfile @@ -3,18 +3,18 @@ FROM alpine as builder # Ensure ca-certficates are up to date # RUN update-ca-certificates -# Download and verify portmaster-start binary. +# Download and verify spn-hub binary. RUN mkdir /init -RUN wget https://updates.safing.io/linux_amd64/start/portmaster-start_v0-9-6 -O /init/portmaster-start +RUN wget https://updates.safing.io/latest/linux_amd64/hub/spn-hub -O /init/spn-hub COPY start-checksum.txt /init/start-checksum RUN cd /init && sha256sum -c /init/start-checksum -RUN chmod 555 /init/portmaster-start +RUN chmod 555 /init/spn-hub # Use minimal image as base. FROM alpine # Copy the static executable. -COPY --from=builder /init/portmaster-start /init/portmaster-start +COPY --from=builder /init/spn-hub /init/spn-hub # Copy the init script COPY container-init.sh /init.sh diff --git a/spn/tools/container-init.sh b/spn/tools/container-init.sh index e5120872..eff651e9 100755 --- a/spn/tools/container-init.sh +++ b/spn/tools/container-init.sh @@ -1,8 +1,8 @@ #!/bin/sh DATA="/data" -START="/data/portmaster-start" -INIT_START="/init/portmaster-start" +START="/data/spn-hub" +INIT_START="/init/spn-hub" # Set safe shell options. set -euf -o pipefail @@ -18,13 +18,10 @@ if [ ! -f $START ]; then cp $INIT_START $START fi -# Download updates. -echo "running: $START update --data /data --intel-only" -$START update --data /data --intel-only # Remove PID file, which could have been left after a crash. rm -f $DATA/hub-lock.pid # Always start the SPN Hub with the updated main start binary. -echo "running: $START hub --data /data -- $@" -$START hub --data /data -- $@ +echo "running: $START" +$START -- $@ diff --git a/spn/tools/install.sh b/spn/tools/install.sh index e7cf8fd7..585f830a 100755 --- a/spn/tools/install.sh +++ b/spn/tools/install.sh @@ -14,7 +14,7 @@ set -e ARCH= INSTALLDIR= -PMSTART= +SPNBINARY= ENABLENOW= INSTALLSYSTEMD= SYSTEMDINSTALLPATH= @@ -22,7 +22,7 @@ SYSTEMDINSTALLPATH= apply_defaults() { ARCH=${ARCH:-amd64} INSTALLDIR=${INSTALLDIR:-/opt/safing/spn} - PMSTART=${PMSTART:-https://updates.safing.io/latest/linux_${ARCH}/start/portmaster-start} + SPNBINARY=${SPNBINARY:-https://updates.safing.io/latest/linux_${ARCH}/hub/spn-hub} SYSTEMDINSTALLPATH=${SYSTEMDINSTALLPATH:-/etc/systemd/system/spn.service} if command_exists systemctl; then @@ -98,14 +98,14 @@ ensure_install_dir() { mkdir -p ${INSTALLDIR} } -download_pmstart() { - log "Downloading portmaster-start ..." - local dest="${INSTALLDIR}/portmaster-start" +download_spnbinary() { + log "Downloading SPN binary ..." + local dest="${INSTALLDIR}/hub" if [ -f "${dest}" ]; then - warn "Overwriting existing portmaster-start at ${dest}" + warn "Overwriting existing hub at ${dest}" fi - download_file ${PMSTART} ${dest} + download_file ${SPNBINARY} ${dest} log "Changing permissions" chmod a+x ${dest} @@ -113,7 +113,7 @@ download_pmstart() { download_updates() { log "Downloading updates ..." - ${INSTALLDIR}/portmaster-start --data=${INSTALLDIR} update + ${INSTALLDIR}/hub update } setup_systemd() { @@ -122,7 +122,7 @@ setup_systemd() { warn "Skipping setup of systemd service unit" echo "To launch the hub, execute the following as root:" echo "" - echo "${INSTALLDIR}/portmaster-start --data ${INSTALLDIR} hub" + echo "${INSTALLDIR}/hub" echo "" return fi @@ -146,7 +146,7 @@ LimitNOFILE=infinity Environment=LOGLEVEL=warning Environment=SPN_ARGS= EnvironmentFile=-/etc/default/spn -ExecStart=${INSTALLDIR}/portmaster-start --data ${INSTALLDIR} hub -- --log \$LOGLEVEL \$SPN_ARGS +ExecStart=${INSTALLDIR}/hub --log \$LOGLEVEL \$SPN_ARGS [Install] WantedBy=multi-user.target @@ -210,7 +210,7 @@ confirm_config() { log "Installation configuration:" echo "" echo " Architecture: ${BOLD}${ARCH}${RESET}" - echo " Download-URL: ${BOLD}${PMSTART}${RESET}" + echo " Download-URL: ${BOLD}${SPNBINARY}${RESET}" echo " Target Dir: ${BOLD}${INSTALLDIR}${RESET}" echo "Install systemd: ${BOLD}${INSTALLSYSTEMD}${RESET}" echo " Unit path: ${BOLD}${SYSTEMDINSTALLPATH}${RESET}" @@ -247,7 +247,7 @@ ${BOLD}Options:${RESET} ${GREEN}-t, --target PATH${RESET} Configure the installation directory. ${GREEN}-h, --help${RESET} Display this help text ${GREEN}-a, --arch${RESET} Configure the binary architecture. - ${GREEN}-u, --url URL${RESET} Set download URL for portmaster start. + ${GREEN}-u, --url URL${RESET} Set download URL for spn-hub. ${GREEN}-S, --no-systemd${RESET} Do not install systemd service unit. ${GREEN}-s, --service-path PATH${RESET} Location for the systemd unit file. EOT @@ -278,7 +278,7 @@ main() { shift ;; --url | -u) - PMSTART=$2 + SPNBINARY=$2 shift ;; --no-systemd | -S) @@ -315,7 +315,7 @@ EOT # Setup hub ensure_install_dir - download_pmstart + download_spnbinary download_updates write_config_file "${INSTALLDIR}/config.json" diff --git a/spn/tools/start-checksum.txt b/spn/tools/start-checksum.txt index 3094e580..73f716f5 100644 --- a/spn/tools/start-checksum.txt +++ b/spn/tools/start-checksum.txt @@ -1 +1 @@ -3f45f0814c6db28c3899b39ae0ab01f8f20a8cc98697dbe8039162ccd9590bf8 ./portmaster-start +da0ca5ca57f3f5e80a7cb61a8e0ad9b1423051fc12e518b0539c7c69b7a68ee8 ./spn-hub