diff --git a/Dockerfile b/Dockerfile index 7eaa488..01ae2c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,68 @@ -FROM python:3.7-slim +FROM ubuntu:18.04 -WORKDIR /deepstate +# Set up the non-root user +RUN apt-get update \ + && apt-get -y install sudo \ + && useradd -ms /bin/bash user && echo "user:user" | chpasswd && adduser user sudo -COPY . /deepstate +ADD /sudoers.txt /etc/sudoers +ENV ECLIPSER_HOME /home/user/Eclipser + +WORKDIR /home/user + +COPY . /home/user/deepstate + +# Eclipser requires deb-src entries +RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted \n\ +deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted \n\ +deb-src http://archive.ubuntu.com/ubuntu/ bionic universe \n\ +deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe \n\ +deb-src http://archive.ubuntu.com/ubuntu/ bionic multiverse \n\ +deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse \n\ +deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse \n\ +deb-src http://archive.canonical.com/ubuntu bionic partner \n\ +deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted \n\ +deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe \n\ +deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse' >> /etc/apt/sources.list + +# # Install Eclipser dependencies +RUN apt-get update \ + && apt-get -y build-dep qemu \ + && apt-get install -y libtool \ + libtool-bin wget automake autoconf \ + bison gdb git \ + && wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && apt-get install -y apt-transport-https \ + && apt-get update \ + && apt-get install -y dotnet-sdk-2.2 + +# Install DeepState dependencies RUN apt-get update \ && apt-get install -y build-essential \ gcc-multilib g++-multilib cmake \ - python3-setuptools libffi-dev z3 \ - && rm -rf /var/lib/apt/lists/* \ + python3-setuptools libffi-dev z3 python3-pip \ + && rm -rf /var/lib/apt/lists/* + +RUN chown -R user:user /home/user + +USER user + +# Install Eclipser +RUN git clone https://github.com/SoftSec-KAIST/Eclipser \ + && cd Eclipser \ + && make \ + && cd ../ + +# Install DeepState +RUN cd deepstate \ && mkdir build \ && cd build \ && cmake ../ \ && make \ && cd .. \ - && pip install claripy angr manticore \ - && python ./build/setup.py install + && pip3 install 'z3-solver==4.5.1.0.post2' angr manticore \ + && sudo python3 ./build/setup.py install CMD ["/bin/bash"] diff --git a/sudoers.txt b/sudoers.txt new file mode 100644 index 0000000..c478710 --- /dev/null +++ b/sudoers.txt @@ -0,0 +1,4 @@ +root ALL=(ALL) ALL +user ALL=(ALL) NOPASSWD: ALL +Defaults env_reset +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"