diff --git a/ct/tor-snowflake.sh b/ct/tor-snowflake.sh new file mode 100644 index 000000000..2125380b5 --- /dev/null +++ b/ct/tor-snowflake.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: KernelSailor +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://snowflake.torproject.org/ + +APP="tor-snowflake" +var_tags="${var_tags:-privacy;proxy;tor}" +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_unprivileged="${var_unprivileged:-1}" +var_nesting="${var_nesting:-0}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + msg_info "Updating Container OS" + $STD apt update + $STD apt upgrade -y + msg_ok "Updated Container OS" + + RELEASE=$(curl -fsSL https://gitlab.torproject.org/api/v4/projects/tpo%2Fanti-censorship%2Fpluggable-transports%2Fsnowflake/releases | jq -r '.[0].tag_name' | sed 's/^v//') + if [[ ! -f "~/.tor-snowflake" ]] || [[ "${RELEASE}" != "$(cat "~/.tor-snowflake")" ]]; then + msg_info "Stopping Service" + systemctl stop snowflake-proxy + msg_ok "Stopped Service" + + setup_go + + msg_info "Updating Snowflake" + $STD curl -fsSL "https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/archive/v${RELEASE}/snowflake-v${RELEASE}.tar.gz" -o /opt/snowflake.tar.gz + $STD tar -xzf /opt/snowflake.tar.gz -C /opt + $STD rm -rf /opt/snowflake.tar.gz + $STD rm -rf /opt/tor-snowflake + $STD mv /opt/snowflake-v${RELEASE} /opt/tor-snowflake + $STD chown -R snowflake:snowflake /opt/tor-snowflake + $STD sudo -H -u snowflake bash -c "cd /opt/tor-snowflake/proxy && go build -o snowflake-proxy ." + echo "${RELEASE}" >~/.tor-snowflake + msg_ok "Updated Snowflake to v${RELEASE}" + + msg_info "Starting Service" + systemctl start snowflake-proxy + msg_ok "Started Service" + msg_ok "Updated successfully!" + else + msg_ok "No update required. Snowflake is already at v${RELEASE}." + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/frontend/public/json/tor-snowflake.json b/frontend/public/json/tor-snowflake.json new file mode 100644 index 000000000..00ed299f9 --- /dev/null +++ b/frontend/public/json/tor-snowflake.json @@ -0,0 +1,35 @@ +{ + "name": "Tor Snowflake", + "slug": "tor-snowflake", + "categories": [ + 4 + ], + "date_created": "2025-12-19", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": null, + "documentation": "https://community.torproject.org/relay/setup/snowflake/standalone/", + "website": "https://snowflake.torproject.org/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/tor.webp", + "config_path": null, + "description": "Snowflake is a pluggable transport that proxies traffic through temporary proxies using WebRTC. Snowflake allows users in censored locations to access the open internet by connecting through volunteer-run proxies. Running a Snowflake proxy helps users circumvent internet censorship by forwarding their traffic through your server.", + "install_methods": [ + { + "type": "default", + "script": "ct/tor-snowflake.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 4, + "os": "debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} diff --git a/install/tor-snowflake-install.sh b/install/tor-snowflake-install.sh new file mode 100644 index 000000000..24c4a564a --- /dev/null +++ b/install/tor-snowflake-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: KernelSailor +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://snowflake.torproject.org/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +setup_go + +msg_info "Creating snowflake user" +useradd -m -r -s /usr/sbin/nologin -d /home/snowflake snowflake +msg_ok "Created snowflake user" + +msg_info "Building Snowflake" +RELEASE=$(curl -fsSL https://gitlab.torproject.org/api/v4/projects/tpo%2Fanti-censorship%2Fpluggable-transports%2Fsnowflake/releases | jq -r '.[0].tag_name' | sed 's/^v//') +$STD curl -fsSL "https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/archive/v${RELEASE}/snowflake-v${RELEASE}.tar.gz" -o /opt/snowflake.tar.gz +$STD tar -xzf /opt/snowflake.tar.gz -C /opt +$STD rm -rf /opt/snowflake.tar.gz +$STD mv /opt/snowflake-v${RELEASE} /opt/tor-snowflake +$STD chown -R snowflake:snowflake /opt/tor-snowflake +$STD sudo -H -u snowflake bash -c "cd /opt/tor-snowflake/proxy && go build -o snowflake-proxy ." +echo "${RELEASE}" >~/.tor-snowflake +msg_ok "Built Snowflake Proxy v${RELEASE}" + +msg_info "Creating Service" +cat </etc/systemd/system/snowflake-proxy.service +[Unit] +Description=Snowflake Proxy Service +Documentation=https://snowflake.torproject.org/ +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=snowflake +Group=snowflake +WorkingDirectory=/opt/tor-snowflake/proxy +ExecStart=/opt/tor-snowflake/proxy/snowflake-proxy -verbose -unsafe-logging +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now snowflake-proxy +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc