FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
    acl \
    iproute2 \
    openssh-server \
    python3 \
    python3-cryptography \
    sudo \
    util-linux \
    && rm -rf /var/lib/apt/lists/* \
    && mkdir -p /run/sshd \
    && sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
    && sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config \
    && echo "rocannon ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

RUN useradd -m -s /bin/bash rocannon \
    && echo "rocannon:rocannon" | chpasswd

EXPOSE 22
CMD ["/usr/sbin/sshd", "-D", "-e"]
