Created
October 30, 2016 03:56
-
-
Save otms61/a3d335b5e9a6253dd7c766fc89a689a7 to your computer and use it in GitHub Desktop.
centos6 google authenticator sshd
This file contains hidden or 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 centos:centos6 | |
RUN yum update -y | |
RUN yum install -y epel-release | |
RUN sed -i 's/\#baseurl/baseurl/g' /etc/yum.repos.d/epel.repo | |
RUN sed -i 's/mirrorlist/\#mirrorlist/g' /etc/yum.repos.d/epel.repo | |
# setup sshd and pam | |
RUN yum install -y openssh-server google-authenticator | |
RUN sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config | |
RUN sed -i 's/auth include password-auth/auth\t required pam_google_authenticator.so/g' /etc/pam.d/sshd | |
RUN echo 'root:root' | chpasswd | |
RUN mkdir /var/run/sshd | |
RUN useradd -m -s /bin/bash guest && \ | |
echo 'guest:password' | chpasswd | |
## Suppress error message 'Could not load host key: ...' | |
RUN /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N '' | |
RUN /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_dsa_key -C '' -N '' | |
EXPOSE 22 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.