forked from slackhq/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes it easier to use the docker container smoke test that GitHub actions runs. There is also `make smoke-docker-race` that runs the smoke test with `-race` enabled.
- Loading branch information
Showing
6 changed files
with
75 additions
and
42 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
FROM debian:buster | ||
|
||
ADD ./build / | ||
ADD ./build /nebula | ||
|
||
ENTRYPOINT ["/nebula"] | ||
WORKDIR /nebula | ||
|
||
ENTRYPOINT ["/nebula/nebula"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,83 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -e -x | ||
|
||
docker run --name lighthouse1 --rm nebula:smoke -config lighthouse1.yml -test | ||
docker run --name host2 --rm nebula:smoke -config host2.yml -test | ||
docker run --name host3 --rm nebula:smoke -config host3.yml -test | ||
docker run --name host4 --rm nebula:smoke -config host4.yml -test | ||
set -o pipefail | ||
|
||
docker run --name lighthouse1 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config lighthouse1.yml & | ||
mkdir -p logs | ||
|
||
cleanup() { | ||
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 -config lighthouse1.yml -test | ||
sudo docker run --name host2 --rm nebula:smoke -config host2.yml -test | ||
sudo docker run --name host3 --rm nebula:smoke -config host3.yml -test | ||
sudo docker run --name host4 --rm nebula:smoke -config host4.yml -test | ||
|
||
sudo docker run --name lighthouse1 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config lighthouse1.yml 2>&1 | tee logs/lighthouse1 & | ||
sleep 1 | ||
docker run --name host2 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config host2.yml & | ||
sudo docker run --name host2 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config host2.yml 2>&1 | tee logs/host2 & | ||
sleep 1 | ||
docker run --name host3 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config host3.yml & | ||
sudo docker run --name host3 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config host3.yml 2>&1 | tee logs/host3 & | ||
sleep 1 | ||
docker run --name host4 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config host4.yml & | ||
sudo docker run --name host4 --device /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --rm nebula:smoke -config host4.yml 2>&1 | tee logs/host4 & | ||
sleep 1 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from lighthouse1" | ||
echo | ||
set -x | ||
docker exec lighthouse1 ping -c1 192.168.100.2 | ||
docker exec lighthouse1 ping -c1 192.168.100.3 | ||
sudo docker exec lighthouse1 ping -c1 192.168.100.2 | ||
sudo docker exec lighthouse1 ping -c1 192.168.100.3 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from host2" | ||
echo | ||
set -x | ||
docker exec host2 ping -c1 192.168.100.1 | ||
sudo docker exec host2 ping -c1 192.168.100.1 | ||
# Should fail because not allowed by host3 inbound firewall | ||
! docker exec host2 ping -c1 192.168.100.3 -w5 || exit 1 | ||
! sudo docker exec host2 ping -c1 192.168.100.3 -w5 || exit 1 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from host3" | ||
echo | ||
set -x | ||
docker exec host3 ping -c1 192.168.100.1 | ||
docker exec host3 ping -c1 192.168.100.2 | ||
sudo docker exec host3 ping -c1 192.168.100.1 | ||
sudo docker exec host3 ping -c1 192.168.100.2 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing ping from host4" | ||
echo | ||
set -x | ||
docker exec host4 ping -c1 192.168.100.1 | ||
sudo docker exec host4 ping -c1 192.168.100.1 | ||
# Should fail because not allowed by host4 outbound firewall | ||
! docker exec host4 ping -c1 192.168.100.2 -w5 || exit 1 | ||
! docker exec host4 ping -c1 192.168.100.3 -w5 || exit 1 | ||
! sudo docker exec host4 ping -c1 192.168.100.2 -w5 || exit 1 | ||
! sudo docker exec host4 ping -c1 192.168.100.3 -w5 || exit 1 | ||
|
||
set +x | ||
echo | ||
echo " *** Testing conntrack" | ||
echo | ||
set -x | ||
# host2 can ping host3 now that host3 pinged it first | ||
docker exec host2 ping -c1 192.168.100.3 | ||
sudo docker exec host2 ping -c1 192.168.100.3 | ||
# host4 can ping host2 once conntrack established | ||
docker exec host2 ping -c1 192.168.100.4 | ||
docker exec host4 ping -c1 192.168.100.2 | ||
sudo docker exec host2 ping -c1 192.168.100.4 | ||
sudo docker exec host4 ping -c1 192.168.100.2 | ||
|
||
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 |
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