Created
August 24, 2016 10:49
-
-
Save leucos/91453941f8b8db5a47fc004b2bfdf627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ran vi @hook post | |
DOCKER_RULES_DIR=/tmp/ferm | |
for table in ${DOCKER_RULES_DIR}/*; do | |
iptables-restore -n ${table} | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ran via cron | |
DOCKER_RULES_DIR=/tmp/ferm | |
TABLES="nat filter" | |
CHAINS="DOCKER CATTLE_PREROUTING CATTLE_POSTROUTING DOCKER-ISOLATION CATTLE_FORWARD" | |
mkdir ${DOCKER_RULES_DIR} > /dev/null 2>&1 | |
for table in ${TABLES}; do | |
echo "*${table}" > ${DOCKER_RULES_DIR}/${table} | |
for chain in ${CHAINS}; do | |
echo ":${chain} - [0:0]" >> ${DOCKER_RULES_DIR}/${table} | |
iptables -S ${chain} -t ${table} >> ${DOCKER_RULES_DIR}/${table} | |
done | |
echo "COMMIT" >> ${DOCKER_RULES_DIR}/${table} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment