@@ -16,48 +16,44 @@ RUN apt install -y \
16
16
tmux
17
17
18
18
# Create the required users. The game master is the `git` account, and the player is the user's account
19
- # TODO - change the gamemaster password?
20
- # TODO - change the gamemaster username to git?
21
- RUN useradd --comment "GameMaster account" --create-home --password $(mkpasswd -m sha-512 gamemaster) gamemaster
22
- RUN useradd --comment "Player account" --create-home --password $(mkpasswd -m sha-512 player) --shell /bin/zsh player
19
+ RUN useradd --comment "GameMaster account" --create-home --password $(mkpasswd -m sha-512 94+wings+STRONG+mountain+35) gamemaster
20
+ RUN useradd --comment "Player account" --create-home --password $(mkpasswd -m sha-512 player) --shell $(which zsh) player
23
21
24
22
# Set up the player's SSH keys and copy the public key to /tmp
25
23
COPY build/player_entrypoint.sh /home/player
26
- RUN ls -Rla /home/player
27
24
RUN chown player:player /home/player/player_entrypoint.sh
28
25
RUN chmod 770 /home/player/player_entrypoint.sh
29
- RUN ls -Rla /home/player
30
26
RUN su -c "/home/player/player_entrypoint.sh" - player
27
+ COPY build/player_zshrc.sh /home/player/.zshrc
28
+ RUN chown player:player /home/player/.zshrc
29
+ RUN chmod 770 /home/player/.zshrc
31
30
32
31
RUN mkdir /var/run/sshd
33
32
RUN echo 'ClientAliveInterval 60' >> /etc/ssh/sshd_config
34
33
RUN echo 'ClientAliveCountMax 10' >> /etc/ssh/sshd_config
35
- COPY build/ssh_banner.txt /etc/banner
36
- RUN echo 'Banner /etc/banner' >> /etc/ssh/sshd_config
34
+ COPY build/login_banner.txt /etc/motd
37
35
38
- # Set up the git server so that the player can run git clone gamemaster@localhost:/home/gamemaster/game -repo
39
- RUN git clone --bare https://github.com/ShayNehmad/make-git-better-levels.git /home/gamemaster/game -repo
36
+ # Set up the git server so that the player can run git clone gamemaster@localhost:/home/gamemaster/ctf -repo
37
+ RUN git clone --bare https://github.com/ShayNehmad/make-git-better-levels.git /home/gamemaster/ctf -repo
40
38
# This file adds the player's ssh public key from before
41
39
COPY build/gamemaster_entrypoint.sh /home/gamemaster
42
40
RUN chown gamemaster:gamemaster /home/gamemaster/gamemaster_entrypoint.sh
43
41
RUN chmod 770 /home/gamemaster/gamemaster_entrypoint.sh
44
42
RUN su -c "/home/gamemaster/gamemaster_entrypoint.sh" - gamemaster
45
43
# Set up the hooks for the actual gameplay in the repo
46
- COPY levels/checkers /home/gamemaster/game -repo/hooks/checkers
47
- COPY scripts/generate-pre-receive-hook/output/pre-receive /home/gamemaster/game -repo/hooks
44
+ COPY levels/checkers /home/gamemaster/ctf -repo/hooks/checkers
45
+ COPY scripts/generate-pre-receive-hook/output/pre-receive /home/gamemaster/ctf -repo/hooks
48
46
# Make sure that gamemaster owns all of their files
49
47
RUN chown -R gamemaster:gamemaster /home/gamemaster
50
48
51
- # Now that we're done with gamemaster's setup we can change his shell to git shell
49
+ # Now that we're done with gamemaster's setup we can change their shell to git shell and block their home directory
52
50
RUN chsh gamemaster -s $(which git-shell)
51
+ RUN chmod 700 -R /home/gamemaster
53
52
54
53
# Cleanup
55
54
RUN rm -rf /tmp/*
56
55
RUN rm -rf /home/player/player_entrypoint.sh
57
56
58
- # Some debug messages
59
- RUN ls -Rla /home
60
-
61
57
EXPOSE 22
62
58
CMD ["/usr/sbin/sshd" , "-D" ]
63
59
0 commit comments