1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00
ProxmoxVE/install/hev-socks5-server-install.sh
Miguel Vila Rodríguez eaceba3ed3
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
2025-02-23 18:44:04 +01:00

61 lines
1.7 KiB
Bash

#!/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 <<EOF >/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"