# Dante server

### 安装命令

```bash
# 安装依赖
yum install tcp_wrappers-devel


# 编译安装 dante
mkdir /usr/local/dante
cd /usr/local/dante

wget https://www.inet.no/dante/files/dante-1.4.3.tar.gz

tar xf dante-1.4.3.tar.gz
cd dante-1.4.3

./configure --prefix=/usr/local/dante
make -j2 && make install


# 编辑配置文件
cat > /usr/local/dante/sockd.conf << EOF
logoutput: /usr/local/dante/dante_sockd.log
errorlog: /usr/local/dante/dante_sockd.errlog
internal: 0.0.0.0 port=9000
external: eth0
# 认证方式为系统用户
socksmethod: username
# 指定登陆的系统用户为dante
user.libwrap: dante

user.privileged: root
user.unprivileged: nobody

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
}
EOF


# 添加系统用户dante
useradd -r -s /bin/false dante
passwd dante


# 启动
/usr/local/dante/sbin/sockd -D -f /usr/local/dante/sockd.conf
```

### 使用systemd管理

```bash
cat > /etc/systemd/system/dante.service << EOF
[Unit]
Description = dante server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
ExecStart = /usr/local/dante/sbin/sockd -f /usr/local/dante/sockd.conf

[Install]
WantedBy = multi-user.target
EOF

systemctl start dante
systemctl enable dante
```
