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

Merge modifications by Frantzcy

This commit is contained in:
Julien Kassar 2015-08-17 10:37:10 -04:00
commit 3848c1e77e
2 changed files with 19 additions and 0 deletions

View File

@ -1 +1,5 @@
# ConfigServer Security & Firewall (CSF) - Docker # ConfigServer Security & Firewall (CSF) - Docker
Install:
cp csfpost.sh /usr/local/csf/bin/csfpost.sh

View File

@ -1,8 +1,23 @@
#!/bin/bash #!/bin/bash
chain_exists()
{
[ $# -lt 1 -o $# -gt 2 ] && {
echo "Usage: chain_exists <chain_name> [table]" >&2
return 1
}
local chain_name="$1" ; shift
[ $# -eq 1 ] && local table="--table $1"
iptables $table -n --list "$chain_name" >/dev/null 2>&1
}
DOCKER_INT="docker0" DOCKER_INT="docker0"
DOCKER_NETWORK="172.17.0.0/16" DOCKER_NETWORK="172.17.0.0/16"
iptables-save | grep -v -- '-j DOCKER' | iptables-restore
chain_exists DOCKER && iptables -X DOCKER
chain_exists DOCKER nat && iptables -t nat -X DOCKER
iptables -N DOCKER iptables -N DOCKER
iptables -t nat -N DOCKER iptables -t nat -N DOCKER