File tree Expand file tree Collapse file tree 11 files changed +222
-194
lines changed Expand file tree Collapse file tree 11 files changed +222
-194
lines changed Original file line number Diff line number Diff line change 3
3
language : go
4
4
5
5
env :
6
- global :
7
- - GO111MODULE=on
8
- - TENSORFLOW_SRC=https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
9
-
10
- before_install :
11
- - curl -fsSL $TENSORFLOW_SRC | sudo tar -C /usr/ -xzf -
12
- - sudo ldconfig
6
+ - GO111MODULE=on
13
7
14
8
go :
15
9
- " 1.12.x"
Original file line number Diff line number Diff line change 1
1
. {
2
2
dnstun {
3
- graph /var/dnstun/dnscnn.pb
3
+ runtime 127.0.0.1:8501
4
+ detector reverse dnscnn:1
4
5
}
5
6
forward . 8.8.8.8
6
7
Original file line number Diff line number Diff line change 1
- ARG GOVERSION=1.14
1
+ ARG GOVERSION=1.12
2
2
3
3
FROM golang:${GOVERSION}-buster
4
4
5
5
# All args after each FROM command are no longer available.
6
6
ARG COREDNSVERSION=v1.6.4
7
- ARG TENSORFLOWVERSION=1.15.0
8
7
9
8
RUN apt-get update && apt-get -uy upgrade
10
9
RUN apt-get -y install ca-certificates && update-ca-certificates
11
10
12
11
ENV COREDNSPATH github.com/coredns/coredns
13
12
ENV DNSTUNPATH github.com/netrack/dnstun
14
- ENV TENSORFLOWPATH storage.googleapis.com/tensorflow/libtensorflow
15
13
ENV GO111MODULE on
14
+ ENV CGO_ENABLED 0
16
15
17
16
RUN curl -fsSL https://${COREDNSPATH}/archive/${COREDNSVERSION}.tar.gz -o coredns.tar.gz \
18
17
&& mkdir -p coredns \
19
18
&& tar -xzf coredns.tar.gz --strip-components=1 -C coredns \
20
19
&& rm -rf coredns.tar.gz
21
20
22
-
23
- RUN curl -fsSL https://${TENSORFLOWPATH}/libtensorflow-cpu-linux-x86_64-${TENSORFLOWVERSION}.tar.gz -o tensorflow.tar.gz \
24
- && tar -xzf tensorflow.tar.gz -C /usr/ \
25
- && rm -rf tensorflow.tar.gz \
26
- && ldconfig
27
-
28
21
COPY . ${GOPATH}/src/${DNSTUNPATH}
29
22
COPY plugin.cfg coredns/plugin.cfg
30
23
@@ -36,9 +29,8 @@ RUN go mod edit -replace ${DNSTUNPATH}@v0.0.0=${GOPATH}/src/${DNSTUNPATH}
36
29
RUN go generate && go build -o /bin/coredns
37
30
38
31
39
- FROM debian:buster-slim
32
+ FROM scratch
40
33
COPY --from=0 /etc/ssl/certs /etc/ssl/certs
41
- COPY --from=0 /usr/lib/libtensorflow* /usr/lib/
42
34
COPY --from=0 /bin/coredns /bin/coredns
43
35
COPY Corefile /etc/coredns/Corefile
44
36
VOLUME /etc/coredns
Original file line number Diff line number Diff line change @@ -13,22 +13,33 @@ tunnels.
13
13
14
14
``` txt
15
15
dnstun {
16
- graph PATH
16
+ runtime HOST:PORT
17
+ detector forward|reverse DETECTOR:VERSION
17
18
}
18
19
```
19
20
20
- * ` graph ` is a directive to configure detector. It is a path to the ` .pb ` file
21
- with constant graph used to classify DNS traffic.
21
+ * ` runtime ` specifies the endpoint in ` HOST:PORT ` format to the remote model
22
+ runtime. This runtime should comply with e.g. ` tensorcraft ` HTTP interface.
23
+
24
+ * ` detector ` is a directive to configure detector. Option ` forward ` instructs
25
+ the plugin to treat higher probability in the second element of prediction tuple
26
+ as DNS tunnel, while ` reverse ` tells that first element in the prediction tuple
27
+ identifies DNS tunnel.
22
28
23
29
## Examples
24
30
25
31
Here are the few basic examples of how to enable DNS tunnelling detection.
26
32
Usually DNS tunneling detection is turned only for all DNS queries.
27
33
34
+ Analyze all DNS queries through remote resolver listening on TCP socket.
28
35
``` txt
29
36
. {
30
37
dnstun {
31
- graph /var/dnstun/dnscnn.pb
38
+ # Connect to the runtime that stores model and executes it.
39
+ runtime 10.240.0.1:5678
40
+
41
+ # Choose detector and it's version.
42
+ detector reverse dns_cnn:latest
32
43
}
33
44
}
34
45
```
You can’t perform that action at this time.
0 commit comments