-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (32 loc) · 1.17 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM centos:6.7
MAINTAINER Jeganathan Swaminathan <[email protected]> <http://www.tektutor.org>
#ENV container=docker
RUN yum -y update; yum clean all
RUN yum install -y epel-release
RUN yum install -y openssh-server openssh-clients
# Set the password of root user to root
RUN echo 'root:Tango@25' | chpasswd
RUN useradd devops
RUN echo 'devops:Tango@25' | chpasswd
RUN usermod -aG wheel root
RUN sed -ri 's/^session\s+required\s+pam_loginuid.so$/session optional pam_loginuid.so/' /etc/pam.d/sshd
# Disable root login &
# Disable password login, only allow public key.
#COPY sshd_config /etc/ssh/sshd_config
COPY sudoers /etc/sudoers
RUN mkdir -p /root/.ssh
RUN mkdir -p /home/devops/.ssh
COPY authorized_keys /root/.ssh/authorized_keys
COPY authorized_keys /.ssh/authorized_keys
COPY authorized_keys /etc/ssh/authorized_keys
COPY authorized_keys /home/devops/.ssh/authorized_keys
# Add sshd running directory.
RUN mkdir -m 755 /var/run/sshd
#RUN /usr/bin/systemctl enable sshd.service
#CMD /usr/bin/systemctl status
# Add ssh key directory.
RUN /sbin/service sshd start && /sbin/service sshd stop
#RUN /usr/sbin/systemctl start sshd
EXPOSE 22
EXPOSE 80
CMD ["/usr/sbin/sshd", "-D"]