Replace iptables block with resolver override
This commit is contained in:
1 parent
9b606fb823
commit
965bed7c4f
1 file changed
+6
-23
@@ -3,8 +3,6 @@
|
||||
. ./config.sh
|
||||
|
||||
UNIVERSE=10.2.0.0/16
|
||||
IPTABLES_BACKUP=/tmp/700_status_and_report_test.iptables
|
||||
CHECKPOINT_URL=https://checkpoint-api.weave.works/v1/check/weave-net
|
||||
|
||||
start_suite "weave status/report"
|
||||
|
||||
@@ -35,20 +33,13 @@ assert_raises "weave_on $HOST1 status | grep 'version check update disabled'"
|
||||
|
||||
|
||||
|
||||
# Block outgoing traffic to Weave's checkpoint API, to prevent retrieval of latest version:
|
||||
run_on $HOST1 "sudo iptables-save > $IPTABLES_BACKUP"
|
||||
[ -z "$DEBUG" ] || greyly echo "Backed iptables rules up:"
|
||||
[ -z "$DEBUG" ] || run_on $HOST1 cat $IPTABLES_BACKUP
|
||||
[ -z "$DEBUG" ] || greyly echo "Updating iptables rules."
|
||||
run_on $HOST1 sudo iptables -A OUTPUT -p tcp -d checkpoint-api.weave.works --dport 443 -j REJECT --reject-with tcp-reset
|
||||
[ -z "$DEBUG" ] || greyly echo "Updated iptables rules:"
|
||||
[ -z "$DEBUG" ] || run_on $HOST1 sudo iptables -L
|
||||
[ -z "$DEBUG" ] || greyly echo "Test access to checkpoint:"
|
||||
[ -z "$DEBUG" ] || run_on $HOST1 "curl -X GET $CHECKPOINT_URL || true"
|
||||
|
||||
weave_on $HOST1 reset
|
||||
|
||||
CHECKPOINT_DISABLE="" weave_on $HOST1 launch
|
||||
# Guarantee the version check fails by feeding an unresponsive IP address into the resolver
|
||||
$SSH $HOST1 tee /tmp/hosts.checkpoint-api > /dev/null <<EOF
|
||||
127.0.0.1 localhost
|
||||
127.1.1.1 checkpoint-api.weave.works
|
||||
EOF
|
||||
CHECKPOINT_DISABLE="" WEAVE_DOCKER_ARGS="-v /tmp/hosts.checkpoint-api:/etc/hosts" weave_on $HOST1 launch
|
||||
|
||||
assert "weave_on $HOST1 report -f '{{.VersionCheck.Enabled}}'" "true"
|
||||
assert "weave_on $HOST1 report -f '{{.VersionCheck.Success}}'" "false"
|
||||
@@ -56,14 +47,6 @@ assert "weave_on $HOST1 report -f '{{.VersionCheck.NewVersion}}'" ""
|
||||
assert_raises "weave_on $HOST1 status | grep 'failed to check latest version - see logs; next check at'"
|
||||
|
||||
|
||||
[ -z "$DEBUG" ] || greyly echo "Reverting iptables rules."
|
||||
run_on $HOST1 "sudo iptables-restore < $IPTABLES_BACKUP"
|
||||
[ -z "$DEBUG" ] || greyly echo "Reverted iptables rules:"
|
||||
[ -z "$DEBUG" ] || run_on $HOST1 sudo iptables -L
|
||||
[ -z "$DEBUG" ] || greyly echo "Test access to checkpoint:"
|
||||
[ -z "$DEBUG" ] || run_on $HOST1 curl -X GET $CHECKPOINT_URL
|
||||
|
||||
|
||||
|
||||
weave_on $HOST1 reset
|
||||
|
||||
|
||||
Reference in new issue
Block a user