Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How To Setup SOCKS5 Proxy Server for (not only) Telegram using Dante on Ubuntu 16.04 / 18.04
### NOT A SCRIPT, JUST A REFERENCE!
# install dante-server
sudo apt update
sudo apt install dante-server
# or download latest dante-server deb for Ubuntu, works for 16.04 and 18.04:
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/dante/dante-server_1.4.2+dfsg-2build1_amd64.deb
# or older version:
wget http://ppa.launchpad.net/dajhorn/dante/ubuntu/pool/main/d/dante/dante-server_1.4.1-1_amd64.deb
# 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: 0.0.0.0 port = 110
internal: 0.0.0.0 port = 143
internal: 0.0.0.0 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 https://www.yandex.ru/
# construct telegram links:
# https://t.me/socks?server=yourserverip&port=443&user=proxyuser&pass=password
# tg://socks?server=yourserverip&port=443&user=proxyuser&pass=password
# used and useful links:
# http://www.inet.no/dante/doc/latest/config/server.html
# http://www.inet.no/dante/doc/latest/config/redundancy.html
# https://www.binarytides.com/setup-dante-socks5-server-on-ubuntu/
# https://krasovsky.me/it/2017/07/socks5-dante/
# https://bitbucket.org/snippets/gudvinr/qd5pA
@xpresservers

This comment has been minimized.

Copy link

@xpresservers xpresservers commented Jan 16, 2019

Firefox not asking for credentials. How to fix this problem?

@waqarr

This comment has been minimized.

Copy link

@waqarr waqarr commented Mar 13, 2019

use proxifier software to use proxy in all browsers

@EhsanOrveh

This comment has been minimized.

Copy link

@EhsanOrveh EhsanOrveh commented Apr 27, 2019

everey time i made change to dante.conf file, and restart danted service it return this error to me : " sockd.serviceJob for sockd.service failed because the control process exited with error code. See "systemctl status sockd.service" and "journalctl -xe" for details.
" can you Help me please?

@howdiw

This comment has been minimized.

Copy link

@howdiw howdiw commented Aug 15, 2019

Hello there and thanks for sharing this article,
everything is good, but my network is not eth0 ( is ens160 ), I replaced it.

also when I type this command:
sudo systemctl restart danted
I face with this error:
Job for danted.service failed because the control process exited with error code. See "systemctl status danted.service" and "journalctl -xe" for details.

It seems that there are some problems on dante.service, for more detail, I read a help in StackOverFlow, when I type these commands:
sudo systemctl daemon-reload
sudo systemctl enable danted.service
I face with this error:
danted.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable danted

I also searched this problem on google, there were some solves, but no one worked!
Could you please help me?

@TheMehranKhan

This comment has been minimized.

Copy link

@TheMehranKhan TheMehranKhan commented Aug 15, 2019

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?

@NetAfarin

This comment has been minimized.

Copy link

@NetAfarin NetAfarin commented Aug 23, 2019

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

@yoursbest

This comment has been minimized.

Copy link

@yoursbest yoursbest commented Aug 11, 2020

Good gist! I followed the guide and had Dante 1.4.2 running on my Ubuntu 16.04 smoothly!

@ali-tafakkori

This comment has been minimized.

Copy link

@ali-tafakkori ali-tafakkori commented Aug 17, 2020

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 in android

@fakhamatia

This comment has been minimized.

Copy link

@fakhamatia fakhamatia commented Sep 4, 2020

When I set socksmethod: none proxy not working
Or when set socksmethod: none username only with auth works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.