Last active
February 14, 2024 10:39
-
-
Save meaksh/041952be6dca6513848737076fff6ffe to your computer and use it in GitHub Desktop.
Dockerfile to create a container with Salt API / Salt SSH environment to replicate importlib deadlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM registry.suse.com/bci/bci-base:15.4 | |
RUN zypper in -y salt-api salt-master openssh curl vim | |
RUN echo "admin:admin" > /tmp/users | |
RUN salt-call --local tls.create_self_signed_cert | |
RUN chown -R salt:salt /etc/pki/tls/certs/ | |
RUN <<EOF cat >> /etc/salt/master.d/custom.conf | |
rest_cherrypy: | |
port: 8082 | |
ssl_crt: /etc/pki/tls/certs/localhost.crt | |
ssl_key: /etc/pki/tls/certs/localhost.key | |
netapi_enable_clients: | |
- local | |
- local_async | |
- local_batch | |
- local_subset | |
- runner | |
- runner_async | |
- ssh | |
- wheel | |
- wheel_async | |
# Setup API authentication | |
external_auth: | |
file: | |
^filename: /tmp/users | |
admin: | |
- .* | |
- '@wheel' | |
- '@runner' | |
- '@jobs' | |
log_level: trace | |
EOF | |
RUN <<EOF cat >> /srv/pillar/top.sls | |
base: | |
'*': | |
- foobar | |
EOF | |
RUN <<EOF cat >> /srv/pillar/foobar.sls | |
test_pillar: foobar | |
EOF | |
RUN <<EOF cat >> /etc/salt/roster | |
test1: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test2: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test3: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test4: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test5: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test6: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test7: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test8: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
test9: | |
host: 127.0.0.1 | |
user: root | |
passwd: 1234 | |
port: 22 | |
ssh_options: | |
- StrictHostKeyChecking=no | |
EOF | |
RUN ssh-keygen -A | |
RUN sed -i '/ requi/s/^/#/' /etc/pam.d/sshd | |
RUN echo "root:1234" | chpasswd | |
RUN <<EOF cat >> /root/entrypoint.sh | |
#!/bin/bash | |
salt-master -d && salt-api -d | |
/usr/sbin/sshd -D & | |
bash | |
EOF | |
RUN chmod +x /root/entrypoint.sh | |
ENTRYPOINT ["/bin/bash", "-c", "/root/entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment