Browse Source

Add openssh with hack login to docker container

master
Matthew Faltys 5 years ago
parent
commit
a0ee6db7e5
  1. 10
      deps/Dockerfile
  2. 4
      deps/run.sh
  3. 1
      nethack-launcher.go

10
deps/Dockerfile vendored

@ -6,6 +6,7 @@ RUN apt-get update && \
ttyrec \
nethack-console \
redis-server \
openssh-server \
vim
# make required dirs
@ -15,6 +16,15 @@ RUN mkdir -p /redisbackup/
RUN mv /usr/games/nethack /bin/nethack
RUN mkdir /hack/
# update ssh config
RUN echo "AllowUsers hack" >> /etc/ssh/sshd_config
RUN echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
# add hack user
RUN useradd hack -s /nethack-launcher
RUN echo 'hack:U6aMy0wojraho' | chpasswd -e
RUN chown -R hack /hack/
# copy in files
COPY config.gcfg /
COPY nethack-launcher /

4
deps/run.sh vendored

@ -2,3 +2,7 @@
# start redis server
redis-server /redis.conf | sed "s/^/[redis] /"
# start ssh server
mkdir -p /run/sshd/
exec /usr/sbin/sshd -D

1
nethack-launcher.go

@ -357,7 +357,6 @@ func printRegisterScreen(redisClient *redis.Client) {
exec.Command("mkdir", "-p", userPath).Run()
// copy in rc file
// TODO make sure rc file exists before copying
hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir)
hackRCDest := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username)
exec.Command("cp", hackRCLoc, hackRCDest).Run()

Loading…
Cancel
Save