From a6f656eacfcd07c0a8d3e55cac01cb720dcfb8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Wed, 5 Feb 2025 15:39:23 +0100 Subject: [PATCH] New Script: Zerotier Controller (#1928) * add zerotier script * Update ct/zerotier-one.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update ct/zerotier-one.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update ct/zerotier-one.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/zerotier-one-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/zerotier-one-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * remove sleep * improvements to install procedure * fixes --------- Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/zerotier-one.sh | 57 +++++++++++++++++++++++++++++++++ install/zerotier-one-install.sh | 46 ++++++++++++++++++++++++++ json/zerotier-one.json | 34 ++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 ct/zerotier-one.sh create mode 100644 install/zerotier-one-install.sh create mode 100644 json/zerotier-one.json diff --git a/ct/zerotier-one.sh b/ct/zerotier-one.sh new file mode 100644 index 000000000..c5ac8e8fb --- /dev/null +++ b/ct/zerotier-one.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: tremor021 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + + +# App Default Values +APP="Zerotier-One" +var_tags="networking" +var_cpu="1" +var_ram="512" +var_disk="4" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /usr/sbin/zerotier-one ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Stopping Service" + systemctl stop zerotier-one + msg_ok "Stopping Service" + msg_info "Updating ${APP}" + apt-get update &>/dev/null + apt-get -y upgrade + msg_ok "Updated ${APP}" + + msg_info "Starting Service" + systemctl start zerotier-one + msg_ok "Started Service" + 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 IP:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:3443${CL}" diff --git a/install/zerotier-one-install.sh b/install/zerotier-one-install.sh new file mode 100644 index 000000000..c67979ea6 --- /dev/null +++ b/install/zerotier-one-install.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +#Copyright (c) 2021-2025 community-scripts ORG +# Author: tremor021 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + mc \ + sudo +msg_ok "Installed Dependencies" + +msg_info "Setting up Zerotier-One" +curl -s 'https://raw.githubusercontent.com/zerotier/ZeroTierOne/main/doc/contact%40zerotier.com.gpg' | gpg --import && \ +if z="$(curl -s 'https://install.zerotier.com/' | gpg)"; then +echo "$z" | sudo bash +fi +msg_ok "Setup Zerotier-One" + +msg_info "Setting up UI" +curl -O https://s3-us-west-1.amazonaws.com/key-networks/deb/ztncui/1/x86_64/ztncui_0.8.14_amd64.deb +dpkg -i ztncui_0.8.14_amd64.deb +sh -c "echo ZT_TOKEN=$(cat /var/lib/zerotier-one/authtoken.secret) > /opt/key-networks/ztncui/.env" +echo HTTPS_PORT=3443 >> /opt/key-networks/ztncui/.env +echo NODE_ENV=production >> /opt/key-networks/ztncui/.env +chmod 400 /opt/key-networks/ztncui/.env +chown ztncui:ztncui /opt/key-networks/ztncui/.env +systemctl restart ztncui +msg_ok "Done setting up UI." + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/json/zerotier-one.json b/json/zerotier-one.json new file mode 100644 index 000000000..b5ba491aa --- /dev/null +++ b/json/zerotier-one.json @@ -0,0 +1,34 @@ +{ + "name": "Zerotier-One", + "slug": "zerotier-one", + "categories": [ + 4 + ], + "date_created": "2024-05-02", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3443, + "documentation": "https://https://docs.zerotier.com/", + "website": "https://www.zerotier.com/", + "logo": "https://www.zerotier.com/wp-content/uploads/2025/01/Logo-White.svg", + "description": "ZeroTier is a secure network overlay that allows you to manage all of your network resources as if they were on the same LAN. The software-defined solution can be deployed in minutes from anywhere. No matter how many devices you need to connect, or where they are in the world, ZeroTier makes global networking simple.", + "install_methods": [ + { + "type": "default", + "script": "ct/debian.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "admin", + "password": "password" + }, + "notes": [] +} \ No newline at end of file