Open itdaniher opened 9 years ago
Description=Phone Home Reverse SSH Service
ConditionPathExists=|/usr/bin
After=network-online.target
Wants=network-online.target
[Service]
User=root
ExecStart=/bin/bash -c "/usr/bin/ssh -NTC -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa -R $(/usr/local/bin/randPort.sh):localhost:22 it@itdaniher.com"
Type=simple
RestartSec=3
Restart=always
[Install]
WantedBy=multi-user.target
1 root@debian-1638b ~ # cat /usr/local/bin/randPort.sh
mac=$(echo "ibase=16; $(ifconfig eth0 | grep HWaddr | awk -F':' '{print $6 $7}' | tr [:lower:] [:upper:])" | bc) echo $(($mac+10000))
root@debian-22b52:~# cat /etc/systemd/system/phone-home.service