diff --git a/ct/hev-socks5-server.sh b/ct/hev-socks5-server.sh new file mode 100644 index 00000000..f439d428 --- /dev/null +++ b/ct/hev-socks5-server.sh @@ -0,0 +1,64 @@ +#!/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: miviro +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/heiher/hev-socks5-server + +APP="hev-socks5-server" +TAGS="proxy,socks5" +var_cpu="1" +var_ram="512" +var_disk="2" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /opt/${APP} ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/heiher/${APP}/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop $APP + msg_ok "Stopped $APP" + + msg_info "Updating $APP to v${RELEASE}" + curl -L -o "${APP}" "https://github.com/heiher/${APP}/releases/download/${RELEASE}/hev-socks5-server-linux-x86_64" + mv ${APP} /opt/${APP} + chmod +x /opt/${APP} + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start $APP + msg_ok "Started $APP" + + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + 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 with a SOCKS5 client using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}${IP}:1080${CL}" +echo -e "${INFO}${YW} and the credentials stored at /root/hev.creds${CL}" \ No newline at end of file diff --git a/install/hev-socks5-server-install.sh b/install/hev-socks5-server-install.sh new file mode 100644 index 00000000..d5b6310b --- /dev/null +++ b/install/hev-socks5-server-install.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: miviro +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/heiher/hev-socks5-server + +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 \ + sudo \ + mc +msg_ok "Installed Dependencies" + +msg_info "Setup ${APPLICATION}" +RELEASE=$(curl -s https://api.github.com/repos/heiher/${APPLICATION}/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +curl -L -o "${APPLICATION}" "https://github.com/heiher/${APPLICATION}/releases/download/${RELEASE}/hev-socks5-server-linux-x86_64" +mv ${APPLICATION} /opt/${APPLICATION} +chmod +x /opt/${APPLICATION} +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +curl -L -o "main.yml" "https://raw.githubusercontent.com/heiher/${APPLICATION}/refs/heads/master/conf/main.yml" +sed -i 's/^#auth:/auth:/; s/^# file: conf\/auth.txt/ file: \/root\/hev.creds/' main.yml +mkdir -p /etc/${APPLICATION} +USERNAME="admin" +PASSWORD=$(openssl rand -base64 16) +MARK="0" +echo "$USERNAME $PASSWORD $MARK" > /root/hev.creds +mv main.yml /etc/${APPLICATION}/main.yml +msg_ok "Setup ${APPLICATION}" + +msg_info "Creating Service" +cat </etc/systemd/system/${APPLICATION}.service +[Unit] +Description=${APPLICATION} Service +After=network.target + +[Service] +ExecStart=/opt/${APPLICATION} /etc/${APPLICATION}/main.yml +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now ${APPLICATION}.service +msg_ok "Created Service" + +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/hev-socks5-server.json b/json/hev-socks5-server.json new file mode 100644 index 00000000..e5e5fde8 --- /dev/null +++ b/json/hev-socks5-server.json @@ -0,0 +1,43 @@ +{ + "name": "hev-socks5-server", + "slug": "hev-socks5-server", + "categories": [ + 4 + ], + "date_created": "2024-02-17", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 1080, + "documentation": null, + "website": "https://github.com/heiher/hev-socks5-server", + "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/405px-Tux.svg.png", + "description": "HevSocks5Server is a simple, lightweight socks5 server.", + "install_methods": [ + { + "type": "default", + "script": "ct/hev-socks5-server.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 2, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Default credentials: `cat /root/hev.creds`", + "type": "info" + }, + { + "text": "Config stored at `/etc/hev-socks5-server/main.yml`", + "type": "info" + } + ] +} \ No newline at end of file