chore: bring over connector scripts from main repo

This commit is contained in:
Andrew Baumbach 2025-07-28 15:59:36 -04:00 committed by Push From Github
parent d97b2997ef
commit d2e9b6152d
3 changed files with 156 additions and 0 deletions

46
ct/twingate-connector.sh Normal file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: twingate-andrewb
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.twingate.com/docs/
APP="twingate-connector"
var_tags="${var_tags:-network;connector;twingate}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-2}"
var_os="${var_os:-ubuntu}"
var_version="${var_version:-22.04}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /lib/systemd/system/twingate-connector.service ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating ${APP}"
apt update
apt install -yq twingate-connector
systemctl restart twingate-connector
msg_ok "Updated Successfully"
exit
}
start
build_container
description
msg_ok "All Finished! If you need to update your access or refresh tokens, they can be found in /etc/twingate/connector.conf"

View File

@ -0,0 +1,40 @@
{
"name": "twingate-connector",
"slug": "twingate-connector",
"categories": [
4
],
"date_created": "2025-07-17",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://www.twingate.com/docs/",
"config_path": "/etc/twingate/connector.conf",
"website": "https://www.twingate.com",
"logo": "https://avatars.githubusercontent.com/u/97470429?s=200&v=4",
"description": "Twingate Connectors are lightweight software components that establish secure, least-privileged access between private network resources and authorized users without exposing the network to the internet. They act as outbound-only bridges between your protected resources and the Twingate infrastructure, ensuring zero-trust access without the need for a VPN.",
"install_methods": [
{
"type": "default",
"script": "ct/twingate-connector.sh",
"resources": {
"cpu": 1,
"ram": 2048,
"hdd": 2,
"os": "Ubuntu",
"version": "22.04"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"text": "If you need to update your access or refresh tokens, they can be found in /etc/twingate/connector.conf",
"type": "info"
}
]
}

View File

@ -0,0 +1,70 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: [Andrew Baumbach]
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: [https://raw.githubusercontent.com/twingate-andrewb/ProxmoxVE] // TODO: change this
# Import Functions und Setup
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
while true; do
read -rp "Please enter your access token: " access_token
if [[ -z "$access_token" ]]; then
msg_error "Access token cannot be empty. Please try again."
else
break
fi
done
while true; do
read -rp "Please enter your refresh token: " refresh_token
if [[ -z "$refresh_token" ]]; then
msg_error "Refresh token cannot be empty. Please try again."
else
break
fi
done
while true; do
read -rp "Please enter your network name: " network
if [[ -z "$network" ]]; then
msg_error "Network cannot be empty. Please try again."
else
break
fi
done
msg_info "Installing Twingate Connector..."
export TWINGATE_ACCESS_TOKEN="${access_token}"
export TWINGATE_REFRESH_TOKEN="${refresh_token}"
export TWINGATE_NETWORK="${network}"
export TWINGATE_LABEL_DEPLOYED_BY="proxmox"
curl -fsSL "https://binaries.twingate.com/connector/setup.sh" | bash >> /dev/null 2>&1
if [[ $? -ne 0 ]]; then
msg_error "Failed to set up Twingate Connector. Please double check your tokens and network name."
exit 1
fi
msg_ok "Twingate Connector installed!"
msg_info "Starting Twingate Connector..."
# give the connector time to start
sleep 5s
msg_ok "Twingate Connector started!"
echo -e "${INFO}${YW} Twingate Connector status: $(systemctl status twingate-connector) ${CL}"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Done cleaning up"