Skip to content

Commit df6e4dc

Browse files
committed
update logrotating, cleanup.sh, add Suricata ET Pro support, tweaking
1 parent 201aa85 commit df6e4dc

File tree

7 files changed

+74
-16
lines changed

7 files changed

+74
-16
lines changed

bin/clean.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ chown tpot:tpot $myCOWRIETTYLOGS $myCOWRIEDL $myDIONAEABI $myDIONAEABIN $myHONEY
6666
logrotate -s $mySTATUS $myCONF
6767
}
6868

69+
# Let's create a function to clean up and prepare ciscoasa data
70+
fuCISCOASA () {
71+
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/ciscoasa/*; fi
72+
mkdir -p /data/ciscoasa/log
73+
chmod 760 /data/ciscoasa -R
74+
chown tpot:tpot /data/ciscoasa -R
75+
}
76+
6977
# Let's create a function to clean up and prepare conpot data
7078
fuCONPOT () {
7179
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/conpot/*; fi
@@ -124,6 +132,14 @@ fuGLASTOPF () {
124132
chown tpot:tpot /data/glastopf -R
125133
}
126134

135+
# Let's create a function to clean up and prepare heralding data
136+
fuHERALDING () {
137+
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/heralding/*; fi
138+
mkdir -p /data/heralding/log
139+
chmod 760 /data/heralding -R
140+
chown tpot:tpot /data/heralding -R
141+
}
142+
127143
# Let's create a function to clean up and prepare honeytrap data
128144
fuHONEYTRAP () {
129145
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/honeytrap/*; fi
@@ -210,13 +226,15 @@ if [ "$myPERSISTENCE" = "on" ];
210226
fuLOGROTATE
211227
else
212228
echo "Cleaning up and preparing data folders."
229+
fuCISCOASA
213230
fuCONPOT
214231
fuCOWRIE
215232
fuDIONAEA
216233
fuELASTICPOT
217234
fuELK
218235
fuEMOBILITY
219236
fuGLASTOPF
237+
fuHERALDING
220238
fuHONEYTRAP
221239
fuMAILONEY
222240
fuNGINX

docker/suricata/Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
FROM alpine
2-
MAINTAINER MO
32

43
# Include dist
54
ADD dist/ /root/dist/
65

76
# Install packages
87
RUN apk -U upgrade && \
9-
apk add bash ca-certificates file procps wget && \
10-
apk -U add --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \
8+
apk add bash \
9+
ca-certificates \
10+
file \
11+
libcap \
12+
procps \
13+
wget && \
14+
apk -U add --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
1115
suricata && \
1216

1317
# Setup user, groups and configs
@@ -18,12 +22,12 @@ RUN apk -U upgrade && \
1822

1923
# Download the latest EmergingThreats ruleset, replace rulebase and enable all rules
2024
cp /root/dist/update.sh /usr/bin/ && \
21-
chmod u+x /usr/bin/update.sh && \
22-
update.sh && \
25+
chmod 755 /usr/bin/update.sh && \
26+
update.sh OPEN && \
2327

2428
# Clean up
2529
rm -rf /root/* && \
2630
rm -rf /var/cache/apk/*
2731

2832
# Start suricata
29-
CMD update.sh && suricata -v -F /etc/suricata/capture-filter.bpf -i $(/sbin/ip address | grep '^2: ' | awk '{ print $2 }' | tr -d [:punct:])
33+
CMD update.sh $OINKCODE && suricata -v -F /etc/suricata/capture-filter.bpf -i $(/sbin/ip address | grep '^2: ' | awk '{ print $2 }' | tr -d [:punct:])

docker/suricata/dist/update.sh

100644100755
Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,31 @@ function fuCLEANUP {
66
}
77
trap fuCLEANUP EXIT
88

9-
# Download the latest EmergingThreats ruleset, replace rulebase and enable all rules
10-
cd /tmp
11-
wget --tries=2 --timeout=2 https://rules.emergingthreats.net/open/suricata-4.0/emerging.rules.tar.gz
12-
tar xvfz emerging.rules.tar.gz -C /etc/suricata/
9+
### Vars
10+
myOINKCODE="$1"
11+
12+
function fuDLRULES {
13+
### Check if args are present then download rules, if not throw error
14+
15+
if [ "$myOINKCODE" != "" ] && [ "$myOINKCODE" == "OPEN" ];
16+
then
17+
echo "Downloading ET open ruleset."
18+
wget --tries=2 --timeout=2 https://rules.emergingthreats.net/open/suricata-4.0/emerging.rules.tar.gz -O /tmp/rules.tar.gz
19+
else
20+
if [ "$myOINKCODE" != "" ];
21+
then
22+
echo "Downloading ET pro ruleset with Oinkcode $myOINKCODE."
23+
wget --tries=2 --timeout=2 https://rules.emergingthreatspro.com/$myOINKCODE/suricata-4.0/etpro.rules.tar.gz -O /tmp/rules.tar.gz
24+
else
25+
echo "Usage: update.sh <[OPEN, OINKCODE]>"
26+
exit
27+
fi
28+
fi
29+
}
30+
31+
# Download rules
32+
fuDLRULES
33+
34+
# Extract and enable all rules
35+
tar xvfz /tmp/rules.tar.gz -C /etc/suricata/
1336
sed -i s/^#alert/alert/ /etc/suricata/rules/*.rules

docker/suricata/docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# T-Pot (Standard)
22
# For docker-compose ...
3-
version: '2.1'
3+
version: '2.2'
44

55
services:
66

77
# Suricata service
88
suricata:
9+
build: .
910
container_name: suricata
1011
restart: always
12+
environment:
13+
# For ET Pro ruleset replace <OPEN> with your OINKCODE
14+
- OINKCODE=OPEN
1115
network_mode: "host"
1216
cap_add:
1317
- NET_ADMIN
1418
- SYS_NICE
1519
- NET_RAW
16-
image: "dtagdevsec/suricata:1710"
20+
image: "dtagdevsec/suricata:1804"
1721
volumes:
1822
- /data/suricata/log:/var/log/suricata

etc/compose/collect.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,15 @@ services:
189189
suricata:
190190
container_name: suricata
191191
restart: always
192+
environment:
193+
# For ET Pro ruleset replace <OPEN> with your OINKCODE
194+
- OINKCODE=OPEN
192195
network_mode: "host"
193196
cap_add:
194197
- NET_ADMIN
195198
- SYS_NICE
196199
- NET_RAW
197-
image: "dtagdevsec/suricata:1710"
200+
image: "dtagdevsec/suricata:1804"
198201
volumes:
199202
- /data/suricata/log:/var/log/suricata
200203

etc/compose/tpot.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,15 @@ services:
291291
suricata:
292292
container_name: suricata
293293
restart: always
294+
environment:
295+
# For ET Pro ruleset replace <OPEN> with your OINKCODE
296+
- OINKCODE=OPEN
294297
network_mode: "host"
295298
cap_add:
296299
- NET_ADMIN
297300
- SYS_NICE
298301
- NET_RAW
299-
image: "dtagdevsec/suricata:1710"
302+
image: "dtagdevsec/suricata:1804"
300303
volumes:
301304
- /data/suricata/log:/var/log/suricata
302305

etc/logrotate/logrotate.conf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/data/conpot/log/conpot.json
2-
/data/conpot/log/conpot.log
1+
/data/ciscoasa/log/ciscoasa.log
2+
/data/conpot/log/conpot*.json
3+
/data/conpot/log/conpot*.log
34
/data/cowrie/log/cowrie.json
45
/data/cowrie/log/cowrie-textlog.log
56
/data/cowrie/log/lastlog.txt
@@ -16,6 +17,8 @@
1617
/data/emobility/log/centralsystemEWS.log
1718
/data/glastopf/log/glastopf.log
1819
/data/glastopf/db/glastopf.db
20+
/data/heralding/log/*.log
21+
/data/heralding/log/*.csv
1922
/data/honeytrap/log/*.log
2023
/data/honeytrap/log/*.json
2124
/data/honeytrap/attacks.tgz

0 commit comments

Comments
 (0)