2387


# barada-pam on centos
#
# VERSION               0.0.2
#
# ebal, Tue, 02 Sep 2014 22:26:27 +0300
 
FROM        centos:latest
MAINTAINER  Evaggelos Balaskas <ebalaskas@ebalaskas.gr>
 
# Update the repositories
RUN yum -y upgrade
 
# Install dependancies
RUN yum -y install boost boost-filesystem boost-devel pam-devel openssl-devel gcc gcc-c++ wget
 
# Build Barada-pam
RUN wget -c http://downloads.sourceforge.net/project/barada/barada-pam/barada-pam-0.5.3/barada-pam-0.5.3.tar.bz2
RUN tar xf barada-pam-0.5.3.tar.bz2
 
# Install Barada-pam
WORKDIR barada-pam-0.5.3
RUN ./configure
RUN make
RUN make install
 
# Edit pam sshd conf file
RUN sed -i -e '1s/^/auth\tsufficient\t\/lib\/security\/pam_barada.so\n/' /etc/pam.d/sshd
 
# Create a new User on Barada
## RUN /usr/local/bin/barada-add root 12345 
 
# The below values are ONLY for TESTING reason
RUN mkdir -pv /etc/barada.d/root
RUN echo 12345678901234567890123456789012 > /etc/barada.d/root/key
RUN echo 12345 > /etc/barada.d/root/pin
RUN echo 1 > /etc/barada.d/root/counter
 
# This will automaticaly create the ssh keys
RUN /etc/init.d/sshd start
 
EXPOSE 22
 
CMD ["/usr/sbin/sshd","-D"]
 
# docker notes:
# docker build -t barada .
# docker run --rm -p 2222:22 barada:latest
# ssh root@localhost -oPort=2222
#
# docker rm $(docker ps -a -q)
# docker rmi barada