Skip to content

Instantly share code, notes, and snippets.

@atatarn
Created April 16, 2018 11:48
Show Gist options
  • Save atatarn/17b30c5b220d4b03c6f8f946d7af8ebb to your computer and use it in GitHub Desktop.
Save atatarn/17b30c5b220d4b03c6f8f946d7af8ebb to your computer and use it in GitHub Desktop.
# cat /etc/sockd.conf
logoutput: syslog /var/log/danted.log
internal: eth0 port = 8765
external: eth0
socksmethod: username
user.privileged: root
user.unprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
command: connect
log: error connect
socksmethod: username
}
# cat /etc/systemd/system/danted.service
[Unit]
Description=SOCKS (v4 and v5) proxy daemon (danted)
Documentation=man:danted(8) man:danted.conf(5)
After=network.target
[Service]
Type=forking
PIDFile=/run/danted/danted.pid
ExecStart=/usr/local/sbin/sockd -D -p /run/danted/danted.pid
ExecStartPre=/bin/sh -c ' \
uid=`sed -n -e "s/[[:space:]]//g" -e "s/#.*//" -e "/^user\\.privileged/{s/[^:]*://p;q;}" /etc/sockd.conf`; \
if [ -n "$uid" ]; then \
touch /run/danted/danted.pid; \
chown $uid /run/danted/danted.pid; \
fi \
'
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment