gistfile1.txt
· 1.5 KiB · Text
Исходник
timeout 5 /usr/local/bin/wgctl fw list > /dev/null
echo "exit: $?"
exit: 0
All good there.
Added the code to run_cmd, still the same issue stopping at fw list.
But that's because it also returns 1, look:
wgctl fw list --peer phone-nuno
────────────────────────────────────────────────
Firewall Rules (FORWARD)
────────────────────────────────────────────────
root@wireguard:/etc/wireguard/wgctl# echo $?
1
If we do it on a peer with rules, it returns 0:
wgctl fw list --peer guest-zephyr
────────────────────────────────────────────────
Firewall Rules (FORWARD)
────────────────────────────────────────────────
0 0 ACCEPT 6 -- * * 10.1.101.1 10.0.0.103 tcp dpt:53
1111 74244 ACCEPT 17 -- * * 10.1.101.1 10.0.0.103 udp dpt:53
345K 25M ACCEPT 0 -- * * 10.1.101.1 10.0.0.244
0 0 NFLOG 0 -- * * 10.1.101.1 10.0.0.0/24 nflog-prefix "wgctl-drop:" nflog-group 1
0 0 DROP 0 -- * * 10.1.101.1 10.0.0.0/24
root@wireguard:/etc/wireguard/wgctl# echo $?
0
| 1 | timeout 5 /usr/local/bin/wgctl fw list > /dev/null |
| 2 | |
| 3 | echo "exit: $?" |
| 4 | |
| 5 | exit: 0 |
| 6 | |
| 7 | |
| 8 | |
| 9 | All good there. |
| 10 | |
| 11 | |
| 12 | |
| 13 | Added the code to run_cmd, still the same issue stopping at fw list. |
| 14 | |
| 15 | But that's because it also returns 1, look: |
| 16 | |
| 17 | wgctl fw list --peer phone-nuno |
| 18 | |
| 19 | ──────────────────────────────────────────────── |
| 20 | |
| 21 | Firewall Rules (FORWARD) |
| 22 | |
| 23 | ──────────────────────────────────────────────── |
| 24 | |
| 25 | root@wireguard:/etc/wireguard/wgctl# echo $? |
| 26 | |
| 27 | 1 |
| 28 | |
| 29 | |
| 30 | |
| 31 | If we do it on a peer with rules, it returns 0: |
| 32 | |
| 33 | wgctl fw list --peer guest-zephyr |
| 34 | |
| 35 | ──────────────────────────────────────────────── |
| 36 | |
| 37 | Firewall Rules (FORWARD) |
| 38 | |
| 39 | ──────────────────────────────────────────────── |
| 40 | |
| 41 | 0 0 ACCEPT 6 -- * * 10.1.101.1 10.0.0.103 tcp dpt:53 |
| 42 | |
| 43 | 1111 74244 ACCEPT 17 -- * * 10.1.101.1 10.0.0.103 udp dpt:53 |
| 44 | |
| 45 | 345K 25M ACCEPT 0 -- * * 10.1.101.1 10.0.0.244 |
| 46 | |
| 47 | 0 0 NFLOG 0 -- * * 10.1.101.1 10.0.0.0/24 nflog-prefix "wgctl-drop:" nflog-group 1 |
| 48 | |
| 49 | 0 0 DROP 0 -- * * 10.1.101.1 10.0.0.0/24 |
| 50 | |
| 51 | root@wireguard:/etc/wireguard/wgctl# echo $? |
| 52 | |
| 53 | 0 |