Created
December 8, 2021 08:56
-
-
Save sarvarrose/e58872ed53592633bed9acb432ad6f15 to your computer and use it in GitHub Desktop.
Setup Socks5 Proxy on Ubuntu using Dante
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo_status(){ | |
TEXT=$1 | |
echo "\n $(tput setaf 1)>>>> $(tput setab 7) $TEXT $(tput sgr 0)" | |
} | |
SOKSPROXY_PASS=$(openssl rand -base64 12) | |
echo_status "Updating System and installing dante-server" | |
apt-get -y update && apt-get -y install dante-server | |
danted -v | |
echo_status "Setting up dante-server" | |
chmod +x /etc/init.d/danted | |
update-rc.d danted defaults | |
cp /etc/danted.conf /etc/danted.conf.bak | |
rm /etc/danted.conf | |
echo "logoutput: /var/log/danted.log | |
internal: eth0 port = 1080 | |
external: eth0 | |
clientmethod: none | |
socksmethod: username | |
user.privileged: root | |
user.notprivileged: nobody | |
client pass { | |
from: 0.0.0.0/0 to: 0.0.0.0/0 | |
log: error connect disconnect | |
} | |
client block { | |
from: 0.0.0.0/0 to: 0.0.0.0/0 | |
log: connect error | |
} | |
socks pass { | |
from: 0.0.0.0/0 to: 0.0.0.0/0 | |
command: bind connect udpassociate | |
log: error connect disconnect | |
socksmethod: username | |
} | |
socks block { | |
from: 0.0.0.0/0 to: 0.0.0.0/0 | |
log: connect error | |
} | |
" > /etc/danted.conf | |
echo_status "Adding soksproxy user" | |
useradd soksproxy --shell /usr/sbin/nologin | |
echo $SOKSPROXY_PASS"\n"$SOKSPROXY_PASS | passwd soksproxy | |
echo_status "Configuring UFW firewall" | |
ufw default deny incoming | |
ufw default allow outgoing | |
ufw allow 22 | |
ufw allow 1080 | |
ufw status | |
ufw --force enable | |
ufw reload | |
echo_status "Starting danted" | |
systemctl start danted | |
systemctl enable danted | |
echo_status "Installation Completed" | |
PUBLIC_IPV4=$(dig +short myip.opendns.com @resolver1.opendns.com) | |
#PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) | |
echo "\033[1mConfiguration Details:\033[0m" | |
echo "\033[1mIP: \033[0m${PUBLIC_IPV4}" | |
echo "\033[1mUsername: \033[0msoksproxy" | |
echo "\033[1mPassword: \033[0m${SOKSPROXY_PASS}" | |
echo "\033[1mPort: \033[0m1080" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment