Skip to content

Commit eaceba3

Browse files
authored
New Script: Hev socks5 server (#2454)
* initial test * fix port message and replace back github urls * best practices * final fixes * add username ct * last test, uyndo this commit * final * remove editor formatting chagnes from build.func * trailing line * remove comments * get tarball, generate credentials * test1 * arreglito * arreglo clean up * final * reduce sys reqs * typo * url change * remove backup and clean up
1 parent d7dceed commit eaceba3

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed

ct/hev-socks5-server.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: miviro
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/heiher/hev-socks5-server
7+
8+
APP="hev-socks5-server"
9+
TAGS="proxy,socks5"
10+
var_cpu="1"
11+
var_ram="512"
12+
var_disk="2"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -f /opt/${APP} ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -s https://api.github.com/repos/heiher/${APP}/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
34+
msg_info "Stopping $APP"
35+
systemctl stop $APP
36+
msg_ok "Stopped $APP"
37+
38+
msg_info "Updating $APP to v${RELEASE}"
39+
curl -L -o "${APP}" "https://github.com/heiher/${APP}/releases/download/${RELEASE}/hev-socks5-server-linux-x86_64"
40+
mv ${APP} /opt/${APP}
41+
chmod +x /opt/${APP}
42+
msg_ok "Updated $APP to v${RELEASE}"
43+
44+
msg_info "Starting $APP"
45+
systemctl start $APP
46+
msg_ok "Started $APP"
47+
48+
echo "${RELEASE}" >/opt/${APP}_version.txt
49+
msg_ok "Update Successful"
50+
else
51+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
52+
fi
53+
exit
54+
}
55+
56+
start
57+
build_container
58+
description
59+
60+
msg_ok "Completed Successfully!\n"
61+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
62+
echo -e "${INFO}${YW} Access it with a SOCKS5 client using the following URL:${CL}"
63+
echo -e "${TAB}${GATEWAY}${BGN}${IP}:1080${CL}"
64+
echo -e "${INFO}${YW} and the credentials stored at /root/hev.creds${CL}"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: miviro
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/heiher/hev-socks5-server
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc
21+
msg_ok "Installed Dependencies"
22+
23+
msg_info "Setup ${APPLICATION}"
24+
RELEASE=$(curl -s https://api.github.com/repos/heiher/${APPLICATION}/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
25+
curl -L -o "${APPLICATION}" "https://github.com/heiher/${APPLICATION}/releases/download/${RELEASE}/hev-socks5-server-linux-x86_64"
26+
mv ${APPLICATION} /opt/${APPLICATION}
27+
chmod +x /opt/${APPLICATION}
28+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
29+
curl -L -o "main.yml" "https://raw.githubusercontent.com/heiher/${APPLICATION}/refs/heads/master/conf/main.yml"
30+
sed -i 's/^#auth:/auth:/; s/^# file: conf\/auth.txt/ file: \/root\/hev.creds/' main.yml
31+
mkdir -p /etc/${APPLICATION}
32+
USERNAME="admin"
33+
PASSWORD=$(openssl rand -base64 16)
34+
MARK="0"
35+
echo "$USERNAME $PASSWORD $MARK" > /root/hev.creds
36+
mv main.yml /etc/${APPLICATION}/main.yml
37+
msg_ok "Setup ${APPLICATION}"
38+
39+
msg_info "Creating Service"
40+
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
41+
[Unit]
42+
Description=${APPLICATION} Service
43+
After=network.target
44+
45+
[Service]
46+
ExecStart=/opt/${APPLICATION} /etc/${APPLICATION}/main.yml
47+
Restart=always
48+
49+
[Install]
50+
WantedBy=multi-user.target
51+
EOF
52+
systemctl enable -q --now ${APPLICATION}.service
53+
msg_ok "Created Service"
54+
55+
motd_ssh
56+
customize
57+
58+
msg_info "Cleaning up"
59+
$STD apt-get -y autoremove
60+
$STD apt-get -y autoclean
61+
msg_ok "Cleaned"

json/hev-socks5-server.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "hev-socks5-server",
3+
"slug": "hev-socks5-server",
4+
"categories": [
5+
4
6+
],
7+
"date_created": "2024-02-17",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 1080,
12+
"documentation": null,
13+
"website": "https://github.com/heiher/hev-socks5-server",
14+
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/405px-Tux.svg.png",
15+
"description": "HevSocks5Server is a simple, lightweight socks5 server.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/hev-socks5-server.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 512,
23+
"hdd": 2,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Default credentials: `cat /root/hev.creds`",
36+
"type": "info"
37+
},
38+
{
39+
"text": "Config stored at `/etc/hev-socks5-server/main.yml`",
40+
"type": "info"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)