nuno gist felülvizsgálása 1 month ago. Revízióhoz ugrás
1 file changed, 20 insertions
gistfile1.txt(fájl létrehozva)
| @@ -0,0 +1,20 @@ | |||
| 1 | + | function fw::has_rule() { | |
| 2 | + | # Generic rule existence check | |
| 3 | + | # fw::has_rule <target> <client_ip> <dest> [port] [proto] | |
| 4 | + | local action="${1:-DROP}" client_ip="${2:-}" target="${3:-}" \ | |
| 5 | + | port="${4:-}" proto="${5:-}" | |
| 6 | + | if [[ -n "$port" ]]; then | |
| 7 | + | fw::_forward_exists -s "$client_ip" -d "$target" \ | |
| 8 | + | -p "$proto" --dport "$port" -j "$action" | |
| 9 | + | else | |
| 10 | + | fw::_forward_exists -s "$client_ip" -d "$target" -j "$action" | |
| 11 | + | fi | |
| 12 | + | } | |
| 13 | + | ||
| 14 | + | function fw::has_block_rule() { | |
| 15 | + | fw::has_rule "DROP" "$@" | |
| 16 | + | } | |
| 17 | + | ||
| 18 | + | function fw::has_allow_rule() { | |
| 19 | + | fw::has_rule "ACCEPT" "$@" | |
| 20 | + | } | |
Újabb
Régebbi