4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
7 scp
/a
/bin
/fai
/wrt-setup
/a
/bin
/cedit
/cedit
$h:/usr
/bin
9 if ! opkg list-installed|grep bash; then
16 if ! ssh wrt
test -e /etc
/openvpn
/client.key
; then
17 /a
/bin
/vpn-setup
/vpn-mk-client-cert
do wrt
18 sleep 10 # wait for connection before we try to ssh
22 ssh do bash
<<'EOFOUTER'
24 old_rules="$(iptables -t nat -S PREROUTING)"
25 iptables -t nat -F PREROUTING
27 rm -rf /root/port-forwards
28 for port in 63324 63326; do
29 for proto in udp tcp; do
30 echo iptables -t nat -A PREROUTING -i eth0 -p $proto -m $proto --dport $port -j DNAT --to-destination 10.8.0.6:$port >> /root/port-forwards
33 chmod +x /root/port-forwards
35 sudo dd of=/etc/systemd/system/myport-forward.service <<EOF
37 Description=Turns on port forwarding rules
41 ExecStart=/root/port-forwards
44 WantedBy=multi-user.target
46 systemctl daemon-reload # needed if the file was already there
47 systemctl enable myport-forward.service
50 diff <(echo "$old_rules") <(iptables -t nat -S PREROUTING) ||: