CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/test/smb/Dockerfile
Views: 11766
# syntax=docker/dockerfile:1
FROM ubuntu:22.04 AS build
MAINTAINER metasploit-framework <https://github.com/rapid7/metasploit-framework>
WORKDIR /opt

EXPOSE 445 139

# Switch shells to support ANSI-C quoting:
#   https://stackoverflow.com/questions/33439230/how-to-write-commands-with-multiple-lines-in-dockerfile-while-preserving-the-new
SHELL ["/bin/bash", "-c"]

# Install Samba
RUN apt update && apt install -y samba smbclient

# To add a credential to Samba, the user needs to be created on the system
RUN useradd -m acceptance_tests_user

# Configure a few shares
COPY shares shares

RUN chmod -R 777 shares

COPY config/smb.conf /etc/samba/smb.conf

# Change the passwords for our user
RUN smbpasswd -a acceptance_tests_user <<EOF
acceptance_tests_password
acceptance_tests_password
EOF

# Enable the users
RUN smbpasswd -e acceptance_tests_user

RUN service smbd restart

FROM build AS runner

ENTRYPOINT ["smbd", "--foreground", "--no-process-group"]