examples
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
hooks
|
||||
chains
|
||||
|
||||
|
||||
3
chains/.gitignore
vendored
3
chains/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
!.gitkeep
|
||||
14
chains/ai-sandbox.sh
Executable file
14
chains/ai-sandbox.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
FW_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "$FW_DIR/lib.sh"
|
||||
|
||||
|
||||
ensure_chain ai-sandbox-input
|
||||
ensure_chain ai-sandbox-forward
|
||||
|
||||
add_rule ai-sandbox-input -s 10.77.0.150 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
add_rule ai-sandbox-input -s 10.77.0.150 -j REJECT --reject-with icmp-port-unreachable
|
||||
|
||||
add_rule ai-sandbox-forward -s 10.77.0.150 -d 10.0.0.0/8 -j REJECT --reject-with icmp-port-unreachable
|
||||
add_rule ai-sandbox-forward -s 10.77.0.150 -d 172.16.0.0/12 -j REJECT --reject-with icmp-port-unreachable
|
||||
add_rule ai-sandbox-forward -s 10.77.0.150 -d 192.168.0.0/16 -j REJECT --reject-with icmp-port-unreachable
|
||||
add_rule ai-sandbox-forward -s 10.77.0.150 -j ACCEPT
|
||||
3
hooks/.gitignore
vendored
3
hooks/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
!.gitkeep
|
||||
8
hooks/ai-sandbox-StartPre.sh
Executable file
8
hooks/ai-sandbox-StartPre.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
iptables -C INPUT -s 10.77.0.150 -j ai-sandbox-input 2>/dev/null \
|
||||
|| iptables -I INPUT 1 -s 10.77.0.150 -j ai-sandbox-input
|
||||
|
||||
iptables -C FORWARD -s 10.77.0.150 -j ai-sandbox-forward 2>/dev/null \
|
||||
|| iptables -I FORWARD 1 -s 10.77.0.150 -j ai-sandbox-forward
|
||||
5
hooks/ai-sandbox-StopPost.sh
Executable file
5
hooks/ai-sandbox-StopPost.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
iptables -D INPUT -s 10.77.0.150 -j ai-sandbox-input 2>/dev/null || true
|
||||
iptables -D FORWARD -s 10.77.0.150 -j ai-sandbox-forward 2>/dev/null || true
|
||||
Reference in New Issue
Block a user