Fake Ports mit socat: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
Zeile 12: Zeile 12:
 
done
 
done
  
wait
+
#wait
 
</pre>
 
</pre>
  

Aktuelle Version vom 18. Juli 2025, 18:43 Uhr

Socat installieren

  • apt install socat

Skript erstellen

  • vim /usr/local/sbin/fake-ports.sh
#!/bin/bash
IP="172.24.24.100"
PORTS=(25 389 465 636 139 88  993 445)

for PORT in "${PORTS[@]}"; do
    /usr/bin/socat -v TCP-LISTEN:$PORT,bind=$IP,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