|
| 1 | +FROM debian:sid |
| 2 | + |
| 3 | +LABEL maintainer "fooinha@gmail.com" |
| 4 | + |
| 5 | +# Build arguments |
| 6 | +ARG DEBIAN_REPO_HOST=httpredir.debian.org |
| 7 | +ARG GIT_LOCATION=https://github.com/fooinha/nginx-ssl-ja3.git |
| 8 | +ARG GIT_BRANCH=master |
| 9 | + |
| 10 | +# Mirror to my location |
| 11 | +RUN echo "deb http://${DEBIAN_REPO_HOST}/debian sid main" > /etc/apt/sources.list |
| 12 | +RUN echo "deb-src http://${DEBIAN_REPO_HOST}/debian sid main" >> /etc/apt/sources.list |
| 13 | + |
| 14 | +# Update |
| 15 | +RUN DEBIAN_FRONTEND=noninteractive apt-get update || true |
| 16 | + |
| 17 | +# Install build dependencies |
| 18 | +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing \ |
| 19 | + apt-utils \ |
| 20 | + autoconf \ |
| 21 | + automake \ |
| 22 | + bind9-host \ |
| 23 | + build-essential \ |
| 24 | + dh-autoreconf \ |
| 25 | + cpanminus \ |
| 26 | + curl \ |
| 27 | + devscripts \ |
| 28 | + exuberant-ctags \ |
| 29 | + git-core \ |
| 30 | + jq \ |
| 31 | + llvm \ |
| 32 | + libgeoip1 \ |
| 33 | + libgeoip-dev \ |
| 34 | + libpcre3 \ |
| 35 | + libpcre3-dbg \ |
| 36 | + libpcre3-dev \ |
| 37 | + libperl-dev \ |
| 38 | + libmagic-dev \ |
| 39 | + libtool \ |
| 40 | + lsof \ |
| 41 | + make \ |
| 42 | + mercurial \ |
| 43 | + ngrep \ |
| 44 | + procps \ |
| 45 | + python \ |
| 46 | + telnet \ |
| 47 | + tcpflow \ |
| 48 | + valgrind \ |
| 49 | + vim \ |
| 50 | + wget \ |
| 51 | + zlib1g \ |
| 52 | + zlib1g-dev |
| 53 | + |
| 54 | +# Create build directory |
| 55 | +RUN mkdir -p /build |
| 56 | + |
| 57 | +WORKDIR /build |
| 58 | + |
| 59 | +# Fetches and clones from git location |
| 60 | +RUN git clone ${GIT_LOCATION} |
| 61 | +RUN cd nginx-ssl-ja3 && git checkout ${GIT_BRANCH} |
| 62 | + |
| 63 | +WORKDIR /build |
| 64 | + |
| 65 | +# Get openssl master from git |
| 66 | +RUN git clone https://github.com/openssl/openssl |
| 67 | + |
| 68 | +# Build and install openssl |
| 69 | +WORKDIR /build/openssl |
| 70 | +RUN ./config -d |
| 71 | +RUN make |
| 72 | +RUN make install |
| 73 | + |
| 74 | +# Clone from nginx |
| 75 | +WORKDIR /build |
| 76 | +RUN hg clone http://hg.nginx.org/nginx |
| 77 | + |
| 78 | +# Patch nginx for fetching ssl client extensions |
| 79 | +WORKDIR /build/nginx |
| 80 | +COPY nginx.ssl.extensions.patch /build/nginx |
| 81 | +RUN cat nginx.ssl.extensions.patch |
| 82 | +RUN patch -p1 < nginx.ssl.extensions.patch |
| 83 | + |
| 84 | +# Get test framework |
| 85 | +RUN git clone https://github.com/openresty/test-nginx.git |
| 86 | + |
| 87 | +# Install test framework and dependencies |
| 88 | +RUN cd test-nginx/ && cpanm . |
| 89 | + |
| 90 | +# Configure, make and install |
| 91 | +RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib |
| 92 | +RUN ./auto/configure --add-module=/build/nginx-ssl-ja3 --with-http_ssl_module --with-stream_ssl_module --with-debug --with-stream --with-cc-opt="-fsanitize=address -O -fno-omit-frame-pointer" --with-ld-opt="-Wl,-E -lasan" |
| 93 | +RUN make install |
| 94 | + |
| 95 | +# Install files |
| 96 | +RUN mkdir -p /usr/local/nginx/conf/ |
| 97 | +COPY nginx.conf /usr/local/nginx/conf/nginx.conf |
| 98 | + |
| 99 | +# Install self-signed certificate |
| 100 | +RUN LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib /usr/local/bin/openssl req -new -x509 -days 365 -nodes -out /usr/local/nginx/conf/cert.pem -keyout /usr/local/nginx/conf/rsa.key -subj "/C=PT/ST=Lisbon/L=Lisbon/O=Development/CN=foo.local" |
| 101 | + |
| 102 | +# exuberant ctags |
| 103 | +RUN cd /build/nginx-ssl-ja3 && ctags -R src/ ../nginx/src/ |
| 104 | + |
| 105 | +# vim config |
| 106 | +COPY vimrc /etc/vim/vimrc |
| 107 | + |
| 108 | +RUN echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' | tee -a /root/.bashrc |
| 109 | +RUN echo 'export PATH=$PATH:/usr/local/bin:/usr/local/nginx/sbin' | tee -a /root/.bashrc |
| 110 | +RUN echo '' | tee -a /root/.bashrc |
| 111 | +RUN echo 'export ASAN_OPTIONS=symbolize=1' | tee -a /root/.bashrc |
| 112 | +RUN echo 'export export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer' | tee -a /root/.bashrc |
| 113 | +RUN echo '' | tee -a /root/.bashrc |
| 114 | +RUN echo 'TO TEST RUN:\n nginx &\n openssl s_client -connect 127.0.0.1:12345 -cipher "AES128-SHA" -curves secp521r1' | tee -a /build/TEST.README |
| 115 | + |
0 commit comments