mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-23 10:40:43 +01:00
start: Do not add IP to firewall table if it is in the same subnet
This commit is contained in:
@@ -108,7 +108,10 @@ for _jail in ${JAILS}; do
|
|||||||
if ifconfig | grep -qwF "${_ip}"; then
|
if ifconfig | grep -qwF "${_ip}"; then
|
||||||
warn "Warning: IP address (${_ip}) already in use, continuing..."
|
warn "Warning: IP address (${_ip}) already in use, continuing..."
|
||||||
fi
|
fi
|
||||||
pfctl -q -t "${bastille_network_pf_table}" -T add "${_ip}"
|
## add ip to firewall table if it is not reachable through local interface (assumes NAT/rdr is needed)
|
||||||
|
if route -n get ${_ip} | grep "gateway" >/dev/null; then
|
||||||
|
pfctl -q -t "${bastille_network_pf_table}" -T add "${_ip}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
error_continue "Error: ${_if} interface does not exist."
|
error_continue "Error: ${_if} interface does not exist."
|
||||||
fi
|
fi
|
||||||
@@ -128,7 +131,10 @@ for _jail in ${JAILS}; do
|
|||||||
if ifconfig | grep -qwF "${_ip}"; then
|
if ifconfig | grep -qwF "${_ip}"; then
|
||||||
warn "Warning: IP address (${_ip}) already in use, continuing..."
|
warn "Warning: IP address (${_ip}) already in use, continuing..."
|
||||||
fi
|
fi
|
||||||
pfctl -q -t "${bastille_network_pf_table}" -T add "${_ip}"
|
## add ip to firewall table if it is not reachable through local interface (assumes NAT/rdr is needed)
|
||||||
|
if route -n get ${_ip} | grep "gateway" >/dev/null; then
|
||||||
|
pfctl -q -t "${bastille_network_pf_table}" -T add "${_ip}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
error_continue "Error: ${_if} interface does not exist."
|
error_continue "Error: ${_if} interface does not exist."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user