This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
. ./config.sh | ||
|
||
start_suite "Optional encryption via trusted subnets" | ||
|
||
# Determine subnet for hosts given either an IP or name. We need to resolve | ||
# these entries on the remote hosts to make sure we get the private | ||
# IP addresses in the Circle/GCE context | ||
HOST1_IP=$($SSH $HOST1 "getent hosts $HOST1" | grep $HOST1 | cut -d ' ' -f 1) | ||
HOST2_IP=$($SSH $HOST2 "getent hosts $HOST2" | grep $HOST2 | cut -d ' ' -f 1) | ||
HOST1_CIDR=$($SSH $HOST1 "ip addr show" | grep -oP $HOST1_IP/[0-9]+) | ||
HOST2_CIDR=$($SSH $HOST2 "ip addr show" | grep -oP $HOST2_IP/[0-9]+) | ||
|
||
# Check asymmetric trust - connections should be encrypted | ||
weave_on $HOST1 launch --password wfvAwt7sj --trusted-subnets $HOST2_CIDR | ||
weave_on $HOST2 launch --password wfvAwt7sj $HOST1 | ||
assert_raises "weave_on $HOST1 status connections | grep encrypted" | ||
assert_raises "weave_on $HOST2 status connections | grep encrypted" | ||
|
||
weave_on $HOST1 stop | ||
weave_on $HOST2 stop | ||
|
||
# Check symmetric trust - overlay in plaintext | ||
weave_on $HOST1 launch --password wfvAwt7sj --trusted-subnets $HOST2_CIDR | ||
weave_on $HOST2 launch --password wfvAwt7sj --trusted-subnets $HOST1_CIDR $HOST1 | ||
assert_raises "weave_on $HOST1 status connections | grep unencrypted" | ||
assert_raises "weave_on $HOST2 status connections | grep unencrypted" | ||
|
||
end_suite |