Skip to content

Commit

Permalink
remove nologin-file so we can test pam
Browse files Browse the repository at this point in the history
see: dev-sec/ansible-collection-hardening#690
Signed-off-by: Sebastian Gumprich <[email protected]>
  • Loading branch information
Sebastian Gumprich committed Aug 8, 2023
1 parent b968023 commit 7b89150
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 9 deletions.
3 changes: 3 additions & 0 deletions alpine-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ RUN apk add --update ansible
RUN mkdir -p /etc/ansible \
&& echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions amazon2-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions amazon2023-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions arch-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "s/^# \(%${SUDO_GROUP} ALL=(ALL:ALL) NOPASSWD: ALL\)/\\1/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions centos7-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions centos8-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions centosstream8-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions centosstream9-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions debian10-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ RUN set -xe \
# Make sure systemd doesn't start agettys on tty[1-6].
RUN rm -f /lib/systemd/system/multi-user.target.wants/getty.target

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions debian11-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions debian12-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions fedora37-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions fedora38-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions opensuse_tumbleweed-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "s/^# \(%${SUDO_GROUP} ALL=(ALL:ALL) NOPASSWD: ALL\)/\\1/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup", "/run"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions openwrt-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ RUN set -xe \
RUN opkg remove --autoremove \
python3-pip shadow-groupadd shadow-useradd shadow-usermod sed

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions oracle7-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions rocky8-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
12 changes: 3 additions & 9 deletions rocky9-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ RUN yum makecache --timer \
python3-pip \
&& yum clean all

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

# upgrade pip because of the rust dependency error
RUN pip3 install --upgrade pip

Expand All @@ -51,5 +42,8 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

VOLUME ["/sys/fs/cgroup"]
CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions ubuntu1804-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions ubuntu2004-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]
3 changes: 3 additions & 0 deletions ubuntu2204-ansible-latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ RUN set -xe \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

# delete file created by systemd that prevents login via ssh
RUN rm -f /{var/run,etc,run}/nologin

CMD [ "ansible-playbook", "--version" ]

0 comments on commit 7b89150

Please sign in to comment.