Files
251123-biz-ul-dx/netflow/iptables.sh
Wang Sen Di 67522a2434 -
2025-11-25 14:27:12 +08:00

26 lines
608 B
Bash

#!/usr/bin/env bash
# shellcheck source=/dev/null
if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi
_owner_id=50000
_chain="output_netflow_owner_${_owner_id}"
for cmd in iptables ip6tables; do
$cmd -t mangle -N "$_chain" 2>/dev/null || true
if ! $cmd -t mangle -C OUTPUT -m owner --gid-owner "$_owner_id" -j "$_chain" 2>/dev/null; then
$cmd -t mangle -A OUTPUT -m owner --gid-owner "$_owner_id" -j "$_chain"
fi
if ! $cmd -t mangle -C "$_chain" -j RETURN 2>/dev/null; then
$cmd -t mangle -A "$_chain" -j RETURN
fi
done
__help() {
cat >/dev/null <<-'EOF'
EOF
}