initial commit

This commit is contained in:
Pin
2022-12-20 22:15:44 -05:00
commit 9a0c74b701
7 changed files with 104 additions and 0 deletions

7
controller/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM alpine:3.16
RUN apk --no-cache add openssh-client bash
COPY scripts /opt/scripts
ENTRYPOINT ["sh", "-c", "/opt/scripts/init.sh"]

10
controller/scripts/gen_keys.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
TEAM_NUM=${TEAM_NUM:=10}
for (( i=1; i<=TEAM_NUM; i++ )); do
if [[ ! -e "${HOME}/.ssh/team-${i}" ]]; then
ssh-keygen -q -t ed25519 -N '' -f "${HOME}/.ssh/team-${i}" -C "team${i}"
fi
done

27
controller/scripts/init.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
SCORING_POD=${SCORING_POD:=client}
TEAM_NUM=${TEAM_NUM:=10}
echo "Generating scoring details"
/opt/scripts/gen_keys.sh
echo "Scoring Details"
cat /root/.ssh/*.pub
while true; do
echo "Testing Scoring"
for (( i=1; i<=${TEAM_NUM}; i++ )); do
echo "Testing Team ${i}"
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "team${i}@${SCORING_POD}" -i "/root/.ssh/team-${i}" \
'echo "flag" >.flag'
done
sleep 30
done