FROM ubuntu:14.04

RUN apt-get update
RUN apt-get install linux-headers-$(uname -r) dkms openssl python python-argparse module-assistant debhelper racoon python-openvswitch uuid-runtime openssh-server grub linux-image-$(uname -r) -y --force-yes --assume-yes

## Add sshd service to the container
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

## OVS2.3.0 for amd64
## If you need another architecture, or don't want to use the DropLink bellow,
## You can get the deb files here, those are the 3 needed
## https://packages.debian.org/sid/libssl1.0.2
## https://packages.debian.org/sid/openvswitch-common
## https://packages.debian.org/sid/openvswitch-switch
RUN wget -O ovs_2.3.0.tar.gz https://www.dropbox.com/s/4wvr4pt5pvu7nri/ovs_2.3.0.tar.gz?dl=0 

RUN tar xzf ovs_2.3.0.tar.gz -C /opt/

ADD run.sh /root/run.sh

## Install Precompiled OpenVSwitch Version 2.3.0
RUN dpkg -i /opt/libssl1.0.2_1.0.2f-2_amd64.deb
RUN dpkg -i /opt/openvswitch-common_2.3.0+git20140819-3+b1_amd64.deb /opt/openvswitch-switch_2.3.0+git20140819-3+b1_amd64.deb

## Open Required Ports
EXPOSE 22
EXPOSE 6633

CMD /usr/sbin/sshd -D ; /root/run.sh
