Dockerfile 5.07 KB
Newer Older
Alija's avatar
Alija committed
1
2
FROM ubuntu:16.04

3
4
# Partially based on https://sublimerobots.com/2017/07/installing-snort-3-b237-in-ubuntu

5
ENV DOWNLOAD_DIR 	/home/temp
6
ENV SNORT_DIR		/opt/snort
7
8
9
ENV SNORT_VER		3.0.0-239
ENV SNORT_EXTRA_VER	1.0.0-239
ENV DAQ_VER		2.2.2
10
11
12
ENV HWLOC_VER		1.11.8
ENV LUAJIT_VER		2.0.5
ENV SSL_VER		1.1.0g
13
14
ENV PCAP_VER		1.8.1
ENV PCRE_VER		8.41
15
16
ENV PKG_CONFIG_VER	0.29.2
ENV ZLIB_VER 		1.2.11
17
18
19
20
21
ENV LIBSAFEC_VER	10052013
ENV RAGEL_VER		6.10
ENV BOOST_VER		1.64.0
ENV BOOST_DIR		boost_1_64_0
ENV HYPERSCAN_VER	4.5.1
22
23
# ENV LIBDNET_GIT	https://github.com/dugsong/libdnet.git
ENV LIBDNET_GIT		https://github.com/jncornett/libdnet.git
24
25
ENV LUA_PATH		/opt/snort/include/snort/lua/\?.lua\;\;
ENV SNORT_LUA_PATH      /opt/snort/etc/snort
26
27
28
29
30
31
32


# Needed tools
RUN apt-get update && apt-get install -y \
    wget

# Snort Dependencies #######################################
33
# RUN apt-get install linux-headers-$(uname -r) -y
34

35
36
37
38
39
40
41
42
43
44
45
# Prerequisites
RUN apt-get install -y \
    build-essential \
    autotools-dev \
    libpcap-dev

# DAQ Prerequisites
RUN apt-get install -y \
    bison \
    flex

46
47
48
49
# Hyperscan Prerequisities
RUN apt-get install -y \
    python

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# for compiling source from github
RUN apt-get install -y \
    libtool \
    git \
    autoconf

# Recommended software (optional)
RUN apt-get install -y \
    liblzma-dev \
    cpputest \
    libsqlite3-dev \
    cmake

# Documentation
# RUN apt-get install -y \
#    asciidoc \
#    dblatex \
#    source-highlight
    

70
# Download packages need for snort
71
# git clone https://github.com/snortadmin/snort3.git && \
72
73
# wget -qO- https://github.com/snortadmin/snort3/archive/master.tar.gz | tar xvz && \
# wget -qO- https://github.com/Xiche/libdaq/archive/v$DAQ_VER.tar.gz | tar xvz && \
74
RUN mkdir -p $DOWNLOAD_DIR && cd $DOWNLOAD_DIR && \
75
76
77
78
    wget -qO- http://downloads.sourceforge.net/project/safeclib/libsafec-10052013.tar.gz | tar xvz && \
    wget -qO- http://www.colm.net/files/ragel/ragel-$RAGEL_VER.tar.gz | tar xvz && \
    wget -qO- https://dl.bintray.com/boostorg/release/$BOOST_VER/source/$BOOST_DIR.tar.gz | tar xvz && \
    wget -qO- https://github.com/01org/hyperscan/archive/v$HYPERSCAN_VER.tar.gz | tar xvz && \
79
80
81
82
83
    wget -qO- https://www.snort.org/downloads/snortplus/snort-$SNORT_VER-auto.tar.gz | tar xvz && \
    wget -qO- https://www.snort.org/downloads/snortplus/snort_extra-$SNORT_EXTRA_VER-auto.tar.gz | tar xvz && \
    wget -qO- https://www.snort.org/downloads/snortplus/snort-$SNORT_VER-cmake.tar.gz | tar xvz && \
    wget -qO- https://www.snort.org/downloads/snortplus/snort_extra-$SNORT_EXTRA_VER-cmake.tar.gz | tar xvz && \
    wget -qO- https://www.snort.org/downloads/snortplus/daq-$DAQ_VER.tar.gz | tar xvz && \
84
85
86
87
    git clone $LIBDNET_GIT && \
    wget -qO- https://www.open-mpi.org/software/hwloc/v1.11/downloads/hwloc-$HWLOC_VER.tar.gz | tar xvz && \
    wget -qO- http://luajit.org/download/LuaJIT-$LUAJIT_VER.tar.gz | tar xvz && \
    wget -qO- https://www.openssl.org/source/openssl-$SSL_VER.tar.gz | tar xvz && \
88
89
    wget -qO- http://www.tcpdump.org/release/libpcap-$PCAP_VER.tar.gz | tar xvz && \
    wget -qO- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$PCRE_VER.tar.gz | tar xvz && \
90
91
    wget -qO- https://pkg-config.freedesktop.org/releases/pkg-config-$PKG_CONFIG_VER.tar.gz | tar xvz && \
    wget -qO- www.zlib.net/zlib-$ZLIB_VER.tar.gz | tar xvz
92

93
94
95
# Zlib
WORKDIR $DOWNLOAD_DIR/zlib-$ZLIB_VER
RUN ./configure && make && make install
96
97
98
99
100
101
102
103
104
105
106
107
108

# Pkg Config
WORKDIR $DOWNLOAD_DIR/pkg-config-$PKG_CONFIG_VER
RUN ./configure --with-internal-glib && make && make install

# PCAP
WORKDIR $DOWNLOAD_DIR/libpcap-$PCAP_VER
RUN ./configure && make && make install

# PCRE
WORKDIR $DOWNLOAD_DIR/pcre-$PCRE_VER
RUN ./configure && make && make install

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# OpenSSL
WORKDIR $DOWNLOAD_DIR/openssl-$SSL_VER
RUN ./config && make && make install

# LuaJIT
WORKDIR $DOWNLOAD_DIR/LuaJIT-$LUAJIT_VER
RUN make && make install

# hwloc
WORKDIR $DOWNLOAD_DIR/hwloc-$HWLOC_VER
RUN ./configure && make && make install

# libdnet
WORKDIR $DOWNLOAD_DIR/libdnet
RUN ./configure && make && make install

125
126
127
128
129
130
131
132
133
134
135
136
137
138
# libsafec
WORKDIR $DOWNLOAD_DIR/libsafec-10052013
RUN ./configure && make && make install

# Ragel
WORKDIR $DOWNLOAD_DIR/ragel-$RAGEL_VER
RUN ./configure && make && make install

# Hyperscan
WORKDIR $DOWNLOAD_DIR
RUN mkdir hyperscan-$HYPERSCAN_VER-build && cd hyperscan-$HYPERSCAN_VER-build && \
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local \
          -DBOOST_ROOT=$DOWNLOAD_DIR/$BOOST_DIR/ \
          ../hyperscan-$HYPERSCAN_VER && \
139
    make && make install && ./bin/unit-hyperscan
140
141
    

142
143
144
145
146
147
# netmap
#WORKDIR $DOWNLOAD_DIR
#RUN git clone https://github.com/luigirizzo/netmap.git && \
#    cd netmap && ./configure --no-drivers && make && make install

# DAQ
148
WORKDIR $DOWNLOAD_DIR/daq-$DAQ_VER
149
RUN ./configure && make && make install && ldconfig
150
151

# Snort 3
152
153
154
#WORKDIR $DOWNLOAD_DIR/snort3-master
#RUN autoreconf -isvf && ./configure --prefix=$SNORT_DIR && make && make install
#RUN ln -s /opt/snort/bin/snort /usr/sbin/snort
155
156
#RUN sh -c "echo 'export LUA_PATH=/opt/snort/include/snort/lua/\?.lua\;\;' >> ~/.bashrc"
#RUN sh -c "echo 'export SNORT_LUA_PATH=/opt/snort/etc/snort' >> ~/.bashrc
157
158

WORKDIR /home/$DOWNLOAD_DIR
Alija's avatar
Alija committed
159
CMD ["/bin/bash"]
160