Files
ansible-testing/targets/ubuntu-weak/Dockerfile
T

27 lines
964 B
Docker

FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends nginx openssh-server openssl python3 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /run/sshd /etc/nginx/tls \
&& useradd --create-home --shell /bin/bash auditor \
&& echo 'auditor:DemoPassword1!' | chpasswd \
&& printf '%s\n' \
'PasswordAuthentication yes' \
'PermitRootLogin no' \
>> /etc/ssh/sshd_config \
&& openssl req -x509 -newkey rsa:2048 -nodes -days 30 \
-subj '/CN=demo-target' \
-keyout /etc/nginx/tls/server.key \
-out /etc/nginx/tls/server.crt
COPY targets/ubuntu-weak/nginx.conf /etc/nginx/sites-enabled/default
COPY targets/ubuntu-weak/index.html /var/www/html/index.html
COPY targets/ubuntu-weak/entrypoint.sh /usr/local/bin/demo-entrypoint
RUN chmod 0755 /usr/local/bin/demo-entrypoint
EXPOSE 22 443
ENTRYPOINT ["/usr/local/bin/demo-entrypoint"]