-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·109 lines (83 loc) · 2.46 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·109 lines (83 loc) · 2.46 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh
MY_INFO="\
###########################################
### heiDPI Image ###
###########################################
Starting services
----------------------------------
"
echo "$MY_INFO"
# Exit on any command failure
set -e
params_ndpisrvd=""
params_ndpid=""
###########################################
### Create params for nDPIsrvd ###
###########################################
if [ "$MAX_BUFFERED_LINES" -gt 0 ] 2>/dev/null; then
params_ndpisrvd="$params_ndpisrvd -C $MAX_BUFFERED_LINES"
fi
###########################################
### Create params for nDPId ###
###########################################
url_regex="^\(https\?\|ftp\|file\)://"
case "$JA3_URL" in
http://* | https://* | ftp://* | file://*)
curl "$JA3_URL" > /root/ja3_fingerprints.csv
params_ndpid="$params_ndpid -J /root/ja3_fingerprints.csv"
;;
esac
case "$SSL_SHA1_URL" in
http://* | https://* | ftp://* | file://*)
curl "$SSL_SHA1_URL" > /root/sslblacklist.csv
params_ndpid="$params_ndpid -S /root/sslblacklist.csv"
;;
esac
if [ -n "$INTERFACE" ]; then
params_ndpid="$params_ndpid -i $INTERFACE"
fi
if [ "$FLOW_ANALYSIS" = "1" ]; then
params_ndpid="$params_ndpid -A"
fi
if [ -n "$TUNE_PARAM" ]; then
OLD_IFS="$IFS"
IFS=','
for word in $TUNE_PARAM; do
params_ndpid="$params_ndpid -o $word"
done
IFS="$OLD_IFS"
fi
if [ -n "$PCAP_FILTER" ]; then
params_ndpid="$params_ndpid -B $PCAP_FILTER"
fi
if [ -n "$NDPI_CUSTOM_PROTOCOLS" ]; then
params_ndpid="$params_ndpid -P $NDPI_CUSTOM_PROTOCOLS"
fi
if [ -n "$NDPI_CUSTOM_CATEGORIES" ]; then
params_ndpid="$params_ndpid -C $NDPI_CUSTOM_CATEGORIES"
fi
if [ -n "$HOSTNAME" ]; then
params_ndpid="$params_ndpid -a $HOSTNAME"
fi
###########################################
### Start nDPIsrvd ###
###########################################
echo "Start nDPIsrvd..."
# Use eval to expand parameter string correctly
eval /root/nDPIsrvd -p /tmp/nDPIsrvd-daemon.pid \
-c /tmp/nDPIsrvd-daemon-collector.sock \
-s /tmp/nDPIsrvd-daemon-distributor.sock \
-S 0.0.0.0:$PORT \
-u root \
-d \
-L /tmp/nDPIsrvd.log \
$params_ndpisrvd
###########################################
### Start nDPId ###
###########################################
echo "Start nDPId..."
exec /root/nDPId -p /tmp/nDPId-daemon.pid \
-c /tmp/nDPIsrvd-daemon-collector.sock \
-u root \
-L /tmp/nDPId.log \
$params_ndpid