diff --git a/ct/warpgate.sh b/ct/warpgate.sh new file mode 100644 index 000000000..99a8240f5 --- /dev/null +++ b/ct/warpgate.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/warp-tech/warpgate + +APP="Warpgate" +var_tags="${var_tags:-bastion;ssh;security}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +export var_admin_pass="${var_admin_pass:-}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /opt/warpgate/warpgate ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "warpgate" "warp-tech/warpgate"; then + msg_info "Stopping Warpgate" + systemctl stop warpgate + msg_ok "Stopped Warpgate" + + fetch_and_deploy_gh_release "warpgate" "warp-tech/warpgate" "singlefile" "latest" "/opt/warpgate" "warpgate-v*-$(arch_resolve "x86_64" "arm64")-linux" + + msg_info "Starting Warpgate" + systemctl start warpgate + msg_ok "Started Warpgate" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Access it using the following URL:${CL}" +echo -e "${GATEWAY}${BGN}https://${IP}:8888/@warpgate${CL}" +echo -e "${INFO}${YW}Admin login: admin, password in /opt/warpgate_data/.env (inside the container)${CL}" diff --git a/install/warpgate-install.sh b/install/warpgate-install.sh new file mode 100644 index 000000000..7e0052d7d --- /dev/null +++ b/install/warpgate-install.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/warp-tech/warpgate + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +fetch_and_deploy_gh_release "warpgate" "warp-tech/warpgate" "singlefile" "latest" "/opt/warpgate" "warpgate-v*-$(arch_resolve "x86_64" "arm64")-linux" + +msg_info "Configuring Warpgate" +ADMIN_PASS="${var_admin_pass:-$(random_password)}" +mkdir -p /opt/warpgate_data +cat </opt/warpgate_data/.env +WARPGATE_ADMIN_USER=admin +WARPGATE_ADMIN_PASSWORD=${ADMIN_PASS} +EOF +chmod 600 /opt/warpgate_data/.env +WARPGATE_ADMIN_PASSWORD="$ADMIN_PASS" $STD /opt/warpgate/warpgate --config /opt/warpgate_data/warpgate.yaml unattended-setup \ + --data-path /opt/warpgate_data \ + --http-port 8888 \ + --ssh-port 2222 \ + --mysql-port 33306 \ + --postgres-port 55432 \ + --kubernetes-port 8443 \ + --record-sessions +# A host kernel booted without IPv6 cannot bind [::] +[[ -d /proc/sys/net/ipv6 ]] || sed -i "s/'\[::\]:/'0.0.0.0:/" /opt/warpgate_data/warpgate.yaml +msg_ok "Configured Warpgate" + +msg_info "Creating Service" +cat </etc/systemd/system/warpgate.service +[Unit] +Description=Warpgate +After=network.target +StartLimitIntervalSec=0 + +[Service] +Type=notify +ExecStart=/opt/warpgate/warpgate --config /opt/warpgate_data/warpgate.yaml run +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now warpgate +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc