Skip to content

Instantly share code, notes, and snippets.

Last active August 22, 2023 06:45
Show Gist options
  • Save gpchelkin/c7d24a21639d1f120fb082d1801a5fe4 to your computer and use it in GitHub Desktop.
Save gpchelkin/c7d24a21639d1f120fb082d1801a5fe4 to your computer and use it in GitHub Desktop.
How to Setup SOCKS5 Proxy Server for (not only) Telegram using Dante on Ubuntu 16.04 / 18.04 / 20.04
# install dante-server
sudo apt update
sudo apt install dante-server
# or download latest dante-server deb for Ubuntu, works for 16.04 / 18.04 / 20.04:
# or older version:
# and install it:
sudo dpkg -i dante-server_*.deb
# it may fail to start, it's okay, packaged config is garbage
# open dante config for editing:
sudo nano /etc/danted.conf
# remove everything (holding Ctrl+K will do it) and copy-paste basic config:
logoutput: syslog
user.privileged: root
user.unprivileged: nobody
# desired proxy ports may differ, used here: POP3 110, IMAP 143, HTTPS 443
internal: port = 110
internal: port = 143
internal: port = 443
# interface name may differ, use `ip a` command and copy non-lo interface:
external: eth0
# set socksmethod to 'none' instead of 'username' if you want to disable auth.
socksmethod: username
clientmethod: none
user.libwrap: nobody
client pass {
from: 0/0 to: 0/0
log: connect disconnect error
socks pass {
from: 0/0 to: 0/0
log: connect disconnect error
# end of config
# add system user 'proxyuser' with password to use with sock5 auth:
sudo useradd --shell /usr/sbin/nologin proxyuser
# or:
# sudo adduser --system --no-create-home --disabled-login --group proxyuser
sudo passwd proxyuser
# and input desired password twice
# if you use ubuntu firewall, allow ports:
sudo ufw allow 110
sudo ufw allow 143
sudo ufw allow 443
# restart dante and enable starting on boot:
sudo systemctl restart danted
sudo systemctl enable danted
# you may see dante status:
sudo systemctl status danted
# you may see dante logs (connect disconnect error):
sudo journalctl -xe -u danted
# add -f argument to attach and watch
# test proxy on your local machine:
curl -v -x socks5://proxyuser:password@yourserverip:443
# construct telegram links:
# tg://socks?server=yourserverip&port=443&user=proxyuser&pass=password
# used and useful links:
Copy link

RMS21 commented Dec 3, 2020

I use this configuration but I get the error
negotiate timeout after 31 seconds
can anyone help?

Copy link

harryqt commented Dec 6, 2020

Worked perfectly on Ubuntu 20.04. Thanks.

Copy link

Awsome. Thanks

Copy link

Thanks for the Tutorials :) I'm having a little bug with connecting to my proxy.
Everything works and the CURL tests give me the right response but telegram can't connect to this proxy.
Anyone having any idea why this is happening?

I have same problem with Telegram

Copy link

hi, how do I use a different network interface for ipv6 and for ipv4?

Copy link

Hi, im using alibabacloud for this.
I have used socks5 for this, and when i connect, it connect to my private primary ip instead of public ip, how do it fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment