Configuring Socks5 proxy server software dante under Debian

The Socks5 proxy has a high degree of utility and security in network access. This article describes in detail how to configure the Socks5 proxy server using the dante software on a Debian system.

dante

I. Installing the dante server

First update the system package index and upgrade the installed software:

apt update
apt upgrade

Next, install the dante-server package:

apt install dante-server

Configuring the dante service

1. Backup and create a new configuration file

To avoid service unavailability due to configuration errors, backup the original configuration file first:

cp /etc/danted.conf /etc/danted.conf_orig
rm /etc/danted.conf

Use the nano editor to create a new configuration file:

nano /etc/danted.conf

2. Configuration file contents

Enter the following in the file that opens, taking care to replace eth0 with the actual NIC name of the server:

logoutput: syslog
user.privileged: root
user.unprivileged: nobody

Network interfaces and ports that # listens on
internal: 0.0.0.0 port=1080

# proxy network interface or address
external: eth0

# proxy authentication method
socksmethod: username

# Client connection rules
clientmethod: none

client pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
}

socks pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
}

3. Adding authenticated users

Create a dedicated user for the proxy service and set a password:

useradd -r -s /bin/false proxy_user
passwd proxy_user

4. Restricting access to specific IPs (optional)

If you need to allow only certain IPs to connect to the proxy, you can modify the client pass rule in the configuration file to replace thexxx.111.xxx.222Replace with the IP address of the allowed connection:

client pass {
    from: xxx.111.xxx.222/0 to: 0.0.0.0/0
}

III. Configuring Firewall Rules

1. Using iptables

Allow incoming and outgoing traffic on port 1080 of the TCP protocol:

iptables -I INPUT -p tcp --dport 1080 -j ACCEPT
iptables -I OUTPUT -p tcp --sport 1080 -j ACCEPT

# Save rule
service iptables save

2. Use of ufw

ufw allow 1080

IV. Restarting and verifying services

1. Restart the dante service

systemctl restart danted.service

2. Viewing the status of services

systemctl status danted.service

Normally it will show that the service is actively running:

● danted.service - SOCKS (v4 and v5) proxy daemon (danted)
     Loaded: loaded (/lib/systemd/system/danted.service; enabled; preset: enabled)
     Active: active (running)

V. Client connection test

1. Testing with curl

curl -v -x socks5://proxy_user:password@xxx.123.xxx.123:1080 http://google.com

If the connection is successful, something similar to the following is displayed:

* Trying xxx.123.xxx.123:1080...
* Connected to xxx.123.xxx.123 (xxx.123.xxx.123) port 1080 (#0)
* SOCKS5 connect to IPv4 64.233.165.106:80 (locally resolved)
* SOCKS5 request granted.

2. Browser configuration

Take Firefox as an example, go to "Options"->"Network Settings", select "Manually Configure Proxy", fill in the server IP in "SOCKS Host", and select "SOCKS5" protocol in "Port 1080". In "SOCKS Host", fill in the server IP, port 1080, select "SOCKS5" protocol, and check "Use the same proxy for all protocols".

With the above steps, you can successfully configure the dante Socks5 proxy server on your Debian system. In practice, you can further adjust the access rules and security settings according to your needs.

Leave a Comment

en_USEnglish