-
Notifications
You must be signed in to change notification settings - Fork 989
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into reserve-proto-multi…
…port
- Loading branch information
Showing
38 changed files
with
1,929 additions
and
185 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,44 @@ | ||
#!/bin/sh | ||
|
||
set -e -x | ||
|
||
rm -rf ./build | ||
mkdir ./build | ||
|
||
( | ||
cd build | ||
|
||
cp ../../../../build/linux-amd64/nebula . | ||
cp ../../../../build/linux-amd64/nebula-cert . | ||
|
||
HOST="lighthouse1" AM_LIGHTHOUSE=true ../genconfig.sh >lighthouse1.yml <<EOF | ||
relay: | ||
am_relay: true | ||
EOF | ||
|
||
export LIGHTHOUSES="192.168.100.1 172.17.0.2:4242" | ||
export REMOTE_ALLOW_LIST='{"172.17.0.4/32": false, "172.17.0.5/32": false}' | ||
|
||
HOST="host2" ../genconfig.sh >host2.yml <<EOF | ||
relay: | ||
relays: | ||
- 192.168.100.1 | ||
EOF | ||
|
||
export REMOTE_ALLOW_LIST='{"172.17.0.3/32": false}' | ||
|
||
HOST="host3" ../genconfig.sh >host3.yml | ||
|
||
HOST="host4" ../genconfig.sh >host4.yml <<EOF | ||
relay: | ||
use_relays: false | ||
EOF | ||
|
||
../../../../nebula-cert ca -name "Smoke Test" | ||
../../../../nebula-cert sign -name "lighthouse1" -groups "lighthouse,lighthouse1" -ip "192.168.100.1/24" | ||
../../../../nebula-cert sign -name "host2" -groups "host,host2" -ip "192.168.100.2/24" | ||
../../../../nebula-cert sign -name "host3" -groups "host,host3" -ip "192.168.100.3/24" | ||
../../../../nebula-cert sign -name "host4" -groups "host,host4" -ip "192.168.100.4/24" | ||
) | ||
|
||
sudo docker build -t nebula:smoke-relay . |
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,85 @@ | ||
#!/bin/bash | ||
|
||
set -e -x | ||
|
||
set -o pipefail | ||
|
||
mkdir -p logs | ||
|
||
cleanup() { | ||
echo | ||
echo " *** cleanup" | ||
echo | ||
|
||
set +e | ||
if [ "$(jobs -r)" ] | ||
then | ||
sudo docker kill lighthouse1 host2 host3 host4 | ||
fi | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
sudo docker run --name lighthouse1 --rm nebula:smoke-relay -config lighthouse1.yml -test | ||
sudo docker run --name host2 --rm nebula:smoke-relay -config host2.yml -test | ||
sudo docker run --name host3 --rm nebula:smoke-relay -config host3.yml -test | ||
sudo docker run --name host4 --rm nebula:smoke-relay -config host4.yml -test | ||
|
||
sudo docker run --name lighthouse1 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke-relay -config lighthouse1.yml 2>&1 | tee logs/lighthouse1 | sed -u 's/^/ [lighthouse1] /' & | ||
sleep 1 | ||
sudo docker run --name host2 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke-relay -config host2.yml 2>&1 | tee logs/host2 | sed -u 's/^/ [host2] /' & | ||
sleep 1 | ||
sudo docker run --name host3 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke-relay -config host3.yml 2>&1 | tee logs/host3 | sed -u 's/^/ [host3] /' & | ||
sleep 1 | ||
sudo docker run --name host4 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke-relay -config host4.yml 2>&1 | tee logs/host4 | sed -u 's/^/ [host4] /' & | ||
sleep 1 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from lighthouse1" | ||
echo | ||
set -x | ||
sudo docker exec lighthouse1 ping -c1 192.168.100.2 | ||
sudo docker exec lighthouse1 ping -c1 192.168.100.3 | ||
sudo docker exec lighthouse1 ping -c1 192.168.100.4 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from host2" | ||
echo | ||
set -x | ||
sudo docker exec host2 ping -c1 192.168.100.1 | ||
# Should fail because no relay configured in this direction | ||
! sudo docker exec host2 ping -c1 192.168.100.3 -w5 || exit 1 | ||
! sudo docker exec host2 ping -c1 192.168.100.4 -w5 || exit 1 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from host3" | ||
echo | ||
set -x | ||
sudo docker exec host3 ping -c1 192.168.100.1 | ||
sudo docker exec host3 ping -c1 192.168.100.2 | ||
sudo docker exec host3 ping -c1 192.168.100.4 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from host4" | ||
echo | ||
set -x | ||
sudo docker exec host4 ping -c1 192.168.100.1 | ||
# Should fail because relays not allowed | ||
! sudo docker exec host4 ping -c1 192.168.100.2 -w5 || exit 1 | ||
sudo docker exec host4 ping -c1 192.168.100.3 | ||
|
||
sudo docker exec host4 sh -c 'kill 1' | ||
sudo docker exec host3 sh -c 'kill 1' | ||
sudo docker exec host2 sh -c 'kill 1' | ||
sudo docker exec lighthouse1 sh -c 'kill 1' | ||
sleep 1 | ||
|
||
if [ "$(jobs -r)" ] | ||
then | ||
echo "nebula still running after SIGTERM sent" >&2 | ||
exit 1 | ||
fi |
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
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
Oops, something went wrong.