cookbook-sudo_rules/test/centos7-dockerfile

28 lines
1.1 KiB
Plaintext

FROM centos:7
RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs sudo openssh-server openssh-clients curl
RUN yum -y update; yum clean all; \
(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/*;
# OpenSSH Server Tweaks
RUN sed -i '/UsePAM/d' /etc/ssh/sshd_config
RUN echo 'UsePrivilegeSeparation no' >> /etc/ssh/sshd_config
RUN echo 'UsePAM no' >> /etc/ssh/sshd_config
RUN systemctl enable sshd
# test-kitchen
RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
RUN echo "kitchen:kitchen" | chpasswd
RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
VOLUME [ "/sys/fs/cgroup" ]
#VOLUME [ "/cgroup" ]
ENTRYPOINT ["/usr/sbin/init"]