-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
94 lines (67 loc) · 2.62 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This Dockerfile aims to substitute the docker-compose configuration
FROM aflplusplus/aflplusplus
################
##### JVM ######
################
RUN apt-get update
RUN apt-get install -y curl
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata wget
RUN apt-get install -y software-properties-common
RUN yes | add-apt-repository ppa:openjdk-r/ppa
RUN apt-get install -y openjdk-12-jdk-headless
#######################
##### Supervisor ######
#######################
RUN apt-get install -y supervisor
# Define working directory
WORKDIR /root
################################
##### fuzzing-server-swam ######
################################
ENV SRC_SWAM_DIR=/home/server/src
ENV WASM_DIR=/home/server/wasm
# Create the appropriate directories
RUN mkdir -p $SRC_SWAM_DIR
RUN mkdir -p $WASM_DIR
WORKDIR $SRC_SWAM_DIR
# TODO: Find way of installing dependencies with Mill without copying over entire repo
# See: https://stackoverflow.com/questions/62834693/mill-build-tool-install-dependencies-without-compiling-source-code
# DOWNLOAD latest version of SWAM cli jar file (wget into WORKDIR; wget works with cache in Dockerfile)
RUN wget https://github.com/KTH/swam/releases/download/v0.6.0-RC3/swam_cli.jar
RUN wget https://github.com/KTH/swam/releases/download/v0.6.0-RC3/swam_server.jar
ADD entrypoint_mill_server.sh /home
RUN chmod +x /home/entrypoint_mill_server.sh
#############################
#### fuzzing-client-afl #####
#############################
ENV SRC_INTERFACE_DIR=/home/client/interface
ENV OUT_INTERFACE_DIR=/home/client/interface/cpp_out
ENV INPUT_AFL_DIR=/home/client/in
ENV OUTPUT_AFL_DIR=/home/client/out
# Create the appropriate directories
RUN mkdir -p $SRC_INTERFACE_DIR
RUN mkdir -p $OUT_INTERFACE_DIR
RUN mkdir -p $INPUT_AFL_DIR
RUN mkdir -p $OUTPUT_AFL_DIR
WORKDIR $SRC_INTERFACE_DIR
ADD ./fuzzing-client-afl $SRC_INTERFACE_DIR
RUN g++ -o $OUT_INTERFACE_DIR/prepare_wasm_input.out ./prepare_wasm_input.cpp ./utils.cpp
RUN g++ -o $OUT_INTERFACE_DIR/getFileSize.out ./getFileSize.cpp ./utils.cpp
RUN g++ -o $OUT_INTERFACE_DIR/wait_for_server.out ./wait_for_server.cpp ./utils.cpp ./socket_client.cpp
RUN g++ -o $OUT_INTERFACE_DIR/interface.out ./interface.cpp ./socket_client.cpp ./utils.cpp
RUN chmod +x $SRC_INTERFACE_DIR/*.sh
#########################
######## Shared #########
#########################
ENV WAFL_HOME=/home
WORKDIR $WAFL_HOME
ENV LOGS_DIR=$WAFL_HOME/logs
RUN mkdir -p $LOGS_DIR
ADD supervisord.conf .
ADD supervisord.staging.conf .
ADD stop_supervisord_staging.py .
# dockerignore handles others
ADD *.sh ./
RUN chmod +x ./*.sh
RUN chmod +x ./stop_supervisord_staging.py
ENTRYPOINT ["/home/wafl.sh"]