feat: Add exclusion list // act by cline(gpt-4o)
This commit is contained in:
parent
3cf711596a
commit
ce88d1d012
12
lxc-iptag
12
lxc-iptag
@ -96,6 +96,12 @@ fw_net_interface_changed() {
|
||||
update_lxc_iptags() {
|
||||
vmid_list=$(pct list 2>/dev/null | grep -v VMID | awk '{print $1}')
|
||||
for vmid in ${vmid_list}; do
|
||||
# Check if the container ID is in the exclusion list
|
||||
if [[ " ${EXCLUSION_LIST[*]} " == *" ${vmid} "* ]]; then
|
||||
echo "Skipping ${vmid} as it is in the exclusion list"
|
||||
continue
|
||||
fi
|
||||
|
||||
last_tagged_ips=()
|
||||
current_valid_ips=()
|
||||
next_tags=()
|
||||
@ -113,6 +119,12 @@ update_lxc_iptags() {
|
||||
# Get current IPs
|
||||
current_ips_full=$(lxc-info -n "${vmid}" -i | awk '{print $2}')
|
||||
for ip in ${current_ips_full}; do
|
||||
# Check if the IP is in the exclusion list
|
||||
if [[ " ${EXCLUSION_LIST[*]} " == *" ${ip} "* ]]; then
|
||||
echo "Skipping IP ${ip} for container ${vmid} as it is in the exclusion list"
|
||||
continue
|
||||
fi
|
||||
|
||||
if is_valid_ipv4 "${ip}" && ip_in_cidrs "${ip}" "${CIDR_LIST[*]}"; then
|
||||
current_valid_ips+=("${ip}")
|
||||
next_tags+=("${ip}")
|
||||
|
||||
@ -7,3 +7,11 @@ LOOP_INTERVAL=60
|
||||
FW_NET_INTERFACE_CHECK_INTERVAL=60
|
||||
LXC_STATUS_CHECK_INTERVAL=-1
|
||||
FORCE_UPDATE_INTERVAL=1800
|
||||
|
||||
# Exclusion list for IPs or container IDs
|
||||
EXCLUSION_LIST=(
|
||||
# Add IPs or container IDs here
|
||||
# Example:
|
||||
# 192.168.1.100
|
||||
# container_id_1
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user