Last active
April 26, 2016 01:32
-
-
Save sudowork/0147dd9382fd0465471a to your computer and use it in GitHub Desktop.
Revisions
-
sudowork revised this gist
Feb 2, 2016 . 1 changed file with 33 additions and 34 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,49 +1,48 @@ #!/usr/bin/env bash # You must have sudo ability on your machine machine=${1:-"default"} if [[ ! $(docker-machine ls | grep ${machine}) ]]; then echo "${machine} is not a docker-machine" exit 1 fi # check ipfw firewall rules # TODO support pf (new as of Yosemite) type "ipfw" > /dev/null 2>&1 if [ $? -ne 0 ]; then fwrule=`sudo ipfw -a list | grep "deny ip from any to any"` fwrule_id=`echo $fwrule | awk '{ print $1 }'` if [ "$fwrule" != "" ]; then echo "Found blocking firewall rule: $(tput setaf 1)${fwrule}$(tput sgr0)" printf "Deleting rule ${fwrule_id} ... " sudo ipfw delete ${fwrule_id} if [ $? == 0 ]; then echo "$(tput setaf 2)[OK]$(tput sgr0)" else echo "$(tput setaf 1)[FAIL]$(tput sgr0)" exit 1 fi else echo "No rules found. You are good to go" fi fi # overwrite bad routes dm_ip=`docker-machine ip ${machine} | awk -F. '{print $1"."$2"."$3".0/24"}'` docker_interface=$(VBoxManage showvminfo ${machine} | grep -o -E 'vboxnet\d\d?') if [ -z "${docker_interface}" ]; then echo "No docker VM found!" exit 1 else echo "Found docker interface at $(tput setaf 1)${docker_interface}$(tput sgr0). Changing routes ..." sudo route delete ${dm_ip} && sudo route add -net ${dm_ip} -interface ${docker_interface} if [ $? == 0 ]; then echo "$(tput setaf 2)[OK]$(tput sgr0)" else echo "$(tput setaf 1)[FAIL]$(tput sgr0)" exit 1 fi fi -
ori-rad-admin revised this gist
Apr 2, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ if [ $? == 1 ]; then echo "${machine} is not a docker-machine" exit 1 fi dm_ip=`docker-machine ip ${machine} | awk -F. '{print $1"."$2"."$3}'` fwrule=`sudo ipfw -a list | grep "deny ip from any to any"` fwrule_id=`echo $fwrule | awk '{ print $1 }'` if [ "$fwrule" != "" ]; then -
ori-rad-admin revised this gist
Mar 12, 2015 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,6 @@ if [ $? == 1 ]; then exit 1 fi dm_ip=`docker-machine ip ctti | awk -F. '{print $1"."$2"."$3}'` fwrule=`sudo ipfw -a list | grep "deny ip from any to any"` fwrule_id=`echo $fwrule | awk '{ print $1 }'` if [ "$fwrule" != "" ]; then @@ -48,4 +47,3 @@ else exit 1 fi fi -
ori-rad-admin revised this gist
Mar 6, 2015 . 1 changed file with 22 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,42 +1,51 @@ #!/usr/bin/env bash # You must have sudo ability on your machine machine=$1 if [ -z $machine ]; then echo "usage $0 {machine_name}" exit fi docker-machine ls | grep ${machine} if [ $? == 1 ]; then echo "${machine} is not a docker-machine" exit 1 fi dm_ip=`docker-machine ip ctti | awk -F. '{print $1"."$2"."$3}'` docker-machine stop ${machine} fwrule=`sudo ipfw -a list | grep "deny ip from any to any"` fwrule_id=`echo $fwrule | awk '{ print $1 }'` if [ "$fwrule" != "" ]; then echo "Found blocking firewall rule: $(tput setaf 1)${fwrule}$(tput sgr0)" printf "Deleting rule ${fwrule_id} ... " sudo ipfw delete ${fwrule_id} if [ $? == 0 ]; then echo "$(tput setaf 2)[OK]$(tput sgr0)" else echo "$(tput setaf 1)[FAIL]$(tput sgr0)" exit 1 fi else echo "No rules found. You are good to go" fi docker_interface=$(VBoxManage showvminfo ${machine} | grep -o -E 'vboxnet\d\d?') if [ -z "${docker_interface}" ]; then echo "No docker VM found!" exit 1 else echo "Found docker interface at $(tput setaf 1)${docker_interface}$(tput sgr0). Changing routes ..." current_route=$(sudo netstat -rn | grep ${dm_ip}) if [ -z "${current_route}" ]; then # no route, let's add it! sudo route -nv add -net ${dm_ip} -interface ${docker_interface} else sudo route -nv change -net ${dm_ip} -interface ${docker_interface} fi if [ $? == 0 ]; then echo "$(tput setaf 2)[OK]$(tput sgr0)" else echo "$(tput setaf 1)[FAIL]$(tput sgr0)" exit 1 fi fi docker-machine start ${machine} -
Christian Blades created this gist
Jan 21, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ #!/usr/bin/env bash [ $(id -u) = 0 ] || { echo "You must be root (or use 'sudo')" ; exit 1; } fwrule=`ipfw -a list | grep "deny ip from any to any"` fwrule_id=`echo $fwrule | awk '{ print $1 }'` if [ "$fwrule" != "" ]; then echo "Found blocking firewall rule: $(tput setaf 1)${fwrule}$(tput sgr0)" printf "Deleting rule ${fwrule_id} ... " ipfw delete ${fwrule_id} if [ $? == 0 ]; then echo "$(tput setaf 2)[OK]$(tput sgr0)" else echo "$(tput setaf 1)[FAIL]$(tput sgr0)" exit 1 fi else echo "No rules found. You are good to go" fi docker_interface=$(sudo -u $(logname) VBoxManage showvminfo boot2docker-vm | grep -o -E 'vboxnet\d\d?') if [ -z "${docker_interface}" ]; then echo "No docker VM found!" exit 1 else echo "Found docker interface at $(tput setaf 1)${docker_interface}$(tput sgr0). Changing routes ..." current_route=$(netstat -rn | grep 192.168.59) if [ -z "${current_route}" ]; then # no route, let's add it! route -nv add -net 192.168.59 -interface ${docker_interface} else route -nv change -net 192.168.59 -interface ${docker_interface} fi if [ $? == 0 ]; then echo "$(tput setaf 2)[OK]$(tput sgr0)" else echo "$(tput setaf 1)[FAIL]$(tput sgr0)" exit 1 fi fi