1
0
mirror of https://github.com/juliengk/csf-post-docker.git synced 2023-10-10 11:37:41 +00:00

Merge e5468622f13c0e5ed33f5765d78d51148f61fb9b into 44c8cc706af50332d44c1a90690a88508f271cf1

This commit is contained in:
paieer 2022-08-21 22:46:18 +02:00 committed by GitHub
commit f21ee9028c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,10 +103,12 @@ if [ `echo ${containers} | wc -c` -gt "1" ]; then
iptables -t nat -A POSTROUTING -s ${ipaddr}/32 -d ${ipaddr}/32 -p ${dst_proto} -m ${dst_proto} --dport ${dst_port} -j MASQUERADE
iptables_opt_src=""
if [ ${src_ip} != "0.0.0.0" ]; then
if [ "$src_ip" != "0.0.0.0" ]; then
iptables_opt_src="-d ${src_ip}/32 "
fi
iptables -t nat -A DOCKER ${iptables_opt_src}! -i ${DOCKER_NET_INT} -p ${dst_proto} -m ${dst_proto} --dport ${src_port} -j DNAT --to-destination ${ipaddr}:${dst_port}
if [ -n "$src_ip" ]; then
iptables -t nat -A DOCKER ${iptables_opt_src}! -i ${DOCKER_NET_INT} -p ${dst_proto} -m ${dst_proto} --dport ${src_port} -j DNAT --to-destination ${ipaddr}:${dst_port}
fi
done
fi
done