Utoljára aktív 2 months ago

Revízió 226b763046e996c67b27ac88cf9c9867ebdc4e64

gistfile1.txt Eredeti
1 "function firewall::restore_blocks" /etc/wireguard/wgctl/modules/firewall.module.sh
2function firewall::restore_blocks() {
3 local blocks_dir
4 blocks_dir="$(ctx::blocks)"
5
6 # Restore guest rules if marker exists
7 local marker="${blocks_dir}/_guest_rules.active"
8 if [[ -f "$marker" ]]; then
9 firewall::apply_guest_rules
10 log::wg "Restored guest firewall rules"
11 fi
12
13 # Restore per-client block rules
14 for block_file in "${blocks_dir}"/*.block; do
15 [[ -f "$block_file" ]] || continue
16
17 local name
18 name=$(basename "$block_file" .block)
19
20 while IFS=" " read -r client_ip target port proto; do
21 if [[ -z "$target" ]]; then
22 firewall::block_all "$client_ip" "$name"