Fake Ports mit socat

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Socat installieren

  • apt install socat

Skript erstellen

  • vim /usr/local/sbin/fake-ports.sh
#!/bin/bash
PORTS=(25 389 465 636 139 88  993 445)
for PORT in "${PORTS[@]}"; do
    /usr/bin/socat -v TCP-LISTEN:$PORT,reuseaddr,fork - &
done
wait

Unit erstellen

  • vim /etc/systemd/system/fake-ports.service
[Unit]
Description=Fake Port Listener with socat
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/fake-ports.sh
Restart=on-failure
User=root
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

Unit enablen

  • systemctl daemon-reload
  • systemctl enable --now fake-ports.service
  • systemctl status fake-ports.service