Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 8c0e4d9

Browse files
committed
One last attempt not to use a host mounted volume
1 parent 4fa0eae commit 8c0e4d9

15 files changed

Lines changed: 33 additions & 29 deletions

integrationTest.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ echo "Building containers..."
3636
cd ../docker/ && make && cd ../tests/
3737
docker-compose build
3838
echo "Running integration tests..."
39-
# Make an empty host mounted volume for shared data
40-
rm -rf /tmp/bot-ssh-ca-integration-volume
41-
mkdir -p /tmp/bot-ssh-ca-integration-volume
4239
docker-compose up -d
4340

4441
docker logs kssh -f | indent

tests/Dockerfile-sshd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This dockerfile builds an openssh server that will accept SSH keys signed by the key provided in /mnt/keybase-ca-key.pub
1+
# This dockerfile builds an openssh server that will accept SSH keys signed by the key provided in /shared/keybase-ca-key.pub
22
# It takes in a build argument and only allows keys with the build argument in the principals field
33
FROM ubuntu:18.04
44

@@ -26,4 +26,4 @@ RUN echo -n "uniquestring" > /etc/unique
2626

2727
EXPOSE 22
2828

29-
CMD ln -sf /mnt/keybase-ca-key.pub /etc/ssh/ca.pub && /usr/sbin/sshd -D
29+
CMD ln -sf /shared/keybase-ca-key.pub /etc/ssh/ca.pub && /usr/sbin/sshd -D

tests/bot-entrypoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def load_env():
2424
"bin/keybaseca --wipe-all-configs\n"
2525
"bin/keybaseca --wipe-logs || true\n"
2626
"bin/keybaseca generate --overwrite-existing-key\n"
27-
"echo yes | bin/keybaseca backup > /mnt/cakey.backup\n"
27+
"echo yes | bin/keybaseca backup > /shared/cakey.backup\n"
2828
"bin/keybaseca service &"
2929
) % (shlex.quote(path)))
3030
# Sleep so keybaseca has time to start

tests/bot-entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
set -euo pipefail
33
IFS=$'\n\t'
44

5-
# For some reason it is necessary to touch a file in /mnt/ in order to get the volume permissions to work correctly
5+
# For some reason it is necessary to touch a file in /shared/ in order to get the volume permissions to work correctly
66
# when keybaseca generate runs
7-
touch /mnt/.keep
7+
touch /shared/.keep
88

99
# Generate the env files that will be used for tests
1010
source tests/env.sh
@@ -14,5 +14,5 @@ ls tests/envFiles/ | xargs -I {} -- bash -c 'cat tests/envFiles/{} | envsubst >
1414
nohup bash -c "run_keybase -g &"
1515
sleep 3
1616
keybase oneshot --username $BOT_USERNAME --paperkey "$BOT_PAPERKEY"
17-
touch /mnt/ready
17+
touch /shared/ready
1818
python3 tests/bot-entrypoint.py

tests/docker-compose.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ services:
1010
- BOT_PAPERKEY
1111
- BOT_USERNAME
1212
volumes:
13-
- /tmp/bot-ssh-ca-integration-volume/:/mnt/
13+
- app-volume:/shared/
1414
user: root
15-
command: "sh -c 'chown -R keybase:keybase /mnt && su keybase -c \"bash tests/bot-entrypoint.sh\"'"
15+
command: "sh -c 'chown -R keybase:keybase /shared && su keybase -c \"bash tests/bot-entrypoint.sh\"'"
1616
ports:
1717
- 8080 # Used for the flask webserver that manages restarting keybaseca with different config options
1818
depends_on:
@@ -31,14 +31,14 @@ services:
3131
- SUBTEAM
3232
- SUBTEAM_SECONDARY
3333
volumes:
34-
- /tmp/bot-ssh-ca-integration-volume/:/mnt/
34+
- app-volume:/shared/
3535
user: keybase
3636
command: "bash tests/tester-entrypoint.sh"
3737
depends_on:
3838
- sshd-staging
3939
- sshd-prod
4040
- ca-bot
41-
# An ssh server that will accept signed requests with the principal "team.ssh.staging"
41+
# An ssh server that will accept signed requests with the principal "staging"
4242
sshd-staging:
4343
image: sshd-staging
4444
container_name: sshd-staging
@@ -49,8 +49,8 @@ services:
4949
user_principal: ${SUBTEAM}.ssh.staging
5050
root_principal: ${SUBTEAM}.ssh.root_everywhere
5151
volumes:
52-
- /tmp/bot-ssh-ca-integration-volume/:/mnt/
53-
# An ssh server that will accept signed requests with the principal "team.ssh.prod"
52+
- app-volume:/shared/
53+
# An ssh server that will accept signed requests with the principal "prod"
5454
sshd-prod:
5555
image: sshd-prod
5656
container_name: sshd-prod
@@ -61,4 +61,6 @@ services:
6161
user_principal: ${SUBTEAM}.ssh.prod
6262
root_principal: ${SUBTEAM}.ssh.root_everywhere
6363
volumes:
64-
- /tmp/bot-ssh-ca-integration-volume/:/mnt/
64+
- app-volume:/shared/
65+
volumes:
66+
app-volume:

tests/envFiles/test_env_1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export TEAMS="$SUBTEAM.ssh.staging,$SUBTEAM.ssh.prod,$SUBTEAM.ssh.root_everywher
66
export KEYBASE_PAPERKEY="$BOT_PAPERKEY"
77
export KEYBASE_USERNAME="$BOT_USERNAME"
88
export CHAT_CHANNEL="$SUBTEAM.ssh#ssh-provision"
9+
export CA_KEY_LOCATION="/shared/keybase-ca-key"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Used to test sending the audit log to the normal filesystem. The code that handles local audit log writes is different
22
# from the code that handles KBFS audit log writes.
33
export KEY_EXPIRATION="+1h"
4-
export LOG_LOCATION="/mnt/ca.log"
4+
export LOG_LOCATION="/shared/ca.log"
55
export TEAMS="$SUBTEAM.ssh.staging,$SUBTEAM.ssh.prod,$SUBTEAM.ssh.root_everywhere"
66
export KEYBASE_PAPERKEY="$BOT_PAPERKEY"
77
export KEYBASE_USERNAME="$BOT_USERNAME"
8+
export CA_KEY_LOCATION="/shared/keybase-ca-key"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Used to test the behavior of the chatbot when the user is not in the first listed team. This used to not work
22
# due to the choice of only placing config files in the first team.
33
export KEY_EXPIRATION="+1h"
4-
export LOG_LOCATION="/mnt/ca.log"
4+
export LOG_LOCATION="/shared/ca.log"
55
export TEAMS="$SUBTEAM.ssh.prod,$SUBTEAM.ssh.staging,$SUBTEAM.ssh.root_everywhere"
66
export KEYBASE_PAPERKEY="$BOT_PAPERKEY"
77
export KEYBASE_USERNAME="$BOT_USERNAME"
8+
export CA_KEY_LOCATION="/shared/keybase-ca-key"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Used to test the behavior of the chatbot when the user is not in any of the listed teams. Meant to ensure that the
22
# bot does not respond to messages from users outside of the teams (a security regression test).
33
export KEY_EXPIRATION="+1h"
4-
export LOG_LOCATION="/mnt/ca.log"
4+
export LOG_LOCATION="/shared/ca.log"
55
export TEAMS="$SUBTEAM.ssh.prod"
66
export KEYBASE_PAPERKEY="$BOT_PAPERKEY"
77
export KEYBASE_USERNAME="$BOT_USERNAME"
8+
export CA_KEY_LOCATION="/shared/keybase-ca-key"

tests/tester-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ IFS=$'\n\t'
55
nohup bash -c "run_keybase -g &"
66

77
# Sleep until the CA bot has started
8-
while ! [ -f /mnt/ready ];
8+
while ! [ -f /shared/ready ];
99
do
1010
sleep 1
1111
done

0 commit comments

Comments
 (0)