mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-20 06:02:24 +00:00
update logrotating, cleanup.sh, add Suricata ET Pro support, tweaking
This commit is contained in:
parent
201aa85e68
commit
df6e4dcd44
7 changed files with 74 additions and 16 deletions
18
bin/clean.sh
18
bin/clean.sh
|
@ -66,6 +66,14 @@ chown tpot:tpot $myCOWRIETTYLOGS $myCOWRIEDL $myDIONAEABI $myDIONAEABIN $myHONEY
|
||||||
logrotate -s $mySTATUS $myCONF
|
logrotate -s $mySTATUS $myCONF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Let's create a function to clean up and prepare ciscoasa data
|
||||||
|
fuCISCOASA () {
|
||||||
|
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/ciscoasa/*; fi
|
||||||
|
mkdir -p /data/ciscoasa/log
|
||||||
|
chmod 760 /data/ciscoasa -R
|
||||||
|
chown tpot:tpot /data/ciscoasa -R
|
||||||
|
}
|
||||||
|
|
||||||
# Let's create a function to clean up and prepare conpot data
|
# Let's create a function to clean up and prepare conpot data
|
||||||
fuCONPOT () {
|
fuCONPOT () {
|
||||||
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/conpot/*; fi
|
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/conpot/*; fi
|
||||||
|
@ -124,6 +132,14 @@ fuGLASTOPF () {
|
||||||
chown tpot:tpot /data/glastopf -R
|
chown tpot:tpot /data/glastopf -R
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Let's create a function to clean up and prepare heralding data
|
||||||
|
fuHERALDING () {
|
||||||
|
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/heralding/*; fi
|
||||||
|
mkdir -p /data/heralding/log
|
||||||
|
chmod 760 /data/heralding -R
|
||||||
|
chown tpot:tpot /data/heralding -R
|
||||||
|
}
|
||||||
|
|
||||||
# Let's create a function to clean up and prepare honeytrap data
|
# Let's create a function to clean up and prepare honeytrap data
|
||||||
fuHONEYTRAP () {
|
fuHONEYTRAP () {
|
||||||
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/honeytrap/*; fi
|
if [ "$myPERSISTENCE" != "on" ]; then rm -rf /data/honeytrap/*; fi
|
||||||
|
@ -210,6 +226,7 @@ if [ "$myPERSISTENCE" = "on" ];
|
||||||
fuLOGROTATE
|
fuLOGROTATE
|
||||||
else
|
else
|
||||||
echo "Cleaning up and preparing data folders."
|
echo "Cleaning up and preparing data folders."
|
||||||
|
fuCISCOASA
|
||||||
fuCONPOT
|
fuCONPOT
|
||||||
fuCOWRIE
|
fuCOWRIE
|
||||||
fuDIONAEA
|
fuDIONAEA
|
||||||
|
@ -217,6 +234,7 @@ if [ "$myPERSISTENCE" = "on" ];
|
||||||
fuELK
|
fuELK
|
||||||
fuEMOBILITY
|
fuEMOBILITY
|
||||||
fuGLASTOPF
|
fuGLASTOPF
|
||||||
|
fuHERALDING
|
||||||
fuHONEYTRAP
|
fuHONEYTRAP
|
||||||
fuMAILONEY
|
fuMAILONEY
|
||||||
fuNGINX
|
fuNGINX
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
FROM alpine
|
FROM alpine
|
||||||
MAINTAINER MO
|
|
||||||
|
|
||||||
# Include dist
|
# Include dist
|
||||||
ADD dist/ /root/dist/
|
ADD dist/ /root/dist/
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
RUN apk -U upgrade && \
|
RUN apk -U upgrade && \
|
||||||
apk add bash ca-certificates file procps wget && \
|
apk add bash \
|
||||||
apk -U add --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \
|
ca-certificates \
|
||||||
|
file \
|
||||||
|
libcap \
|
||||||
|
procps \
|
||||||
|
wget && \
|
||||||
|
apk -U add --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||||
suricata && \
|
suricata && \
|
||||||
|
|
||||||
# Setup user, groups and configs
|
# Setup user, groups and configs
|
||||||
|
@ -18,12 +22,12 @@ RUN apk -U upgrade && \
|
||||||
|
|
||||||
# Download the latest EmergingThreats ruleset, replace rulebase and enable all rules
|
# Download the latest EmergingThreats ruleset, replace rulebase and enable all rules
|
||||||
cp /root/dist/update.sh /usr/bin/ && \
|
cp /root/dist/update.sh /usr/bin/ && \
|
||||||
chmod u+x /usr/bin/update.sh && \
|
chmod 755 /usr/bin/update.sh && \
|
||||||
update.sh && \
|
update.sh OPEN && \
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -rf /root/* && \
|
rm -rf /root/* && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# Start suricata
|
# Start suricata
|
||||||
CMD update.sh && suricata -v -F /etc/suricata/capture-filter.bpf -i $(/sbin/ip address | grep '^2: ' | awk '{ print $2 }' | tr -d [:punct:])
|
CMD update.sh $OINKCODE && suricata -v -F /etc/suricata/capture-filter.bpf -i $(/sbin/ip address | grep '^2: ' | awk '{ print $2 }' | tr -d [:punct:])
|
||||||
|
|
31
docker/suricata/dist/update.sh
vendored
Normal file → Executable file
31
docker/suricata/dist/update.sh
vendored
Normal file → Executable file
|
@ -6,8 +6,31 @@ function fuCLEANUP {
|
||||||
}
|
}
|
||||||
trap fuCLEANUP EXIT
|
trap fuCLEANUP EXIT
|
||||||
|
|
||||||
# Download the latest EmergingThreats ruleset, replace rulebase and enable all rules
|
### Vars
|
||||||
cd /tmp
|
myOINKCODE="$1"
|
||||||
wget --tries=2 --timeout=2 https://rules.emergingthreats.net/open/suricata-4.0/emerging.rules.tar.gz
|
|
||||||
tar xvfz emerging.rules.tar.gz -C /etc/suricata/
|
function fuDLRULES {
|
||||||
|
### Check if args are present then download rules, if not throw error
|
||||||
|
|
||||||
|
if [ "$myOINKCODE" != "" ] && [ "$myOINKCODE" == "OPEN" ];
|
||||||
|
then
|
||||||
|
echo "Downloading ET open ruleset."
|
||||||
|
wget --tries=2 --timeout=2 https://rules.emergingthreats.net/open/suricata-4.0/emerging.rules.tar.gz -O /tmp/rules.tar.gz
|
||||||
|
else
|
||||||
|
if [ "$myOINKCODE" != "" ];
|
||||||
|
then
|
||||||
|
echo "Downloading ET pro ruleset with Oinkcode $myOINKCODE."
|
||||||
|
wget --tries=2 --timeout=2 https://rules.emergingthreatspro.com/$myOINKCODE/suricata-4.0/etpro.rules.tar.gz -O /tmp/rules.tar.gz
|
||||||
|
else
|
||||||
|
echo "Usage: update.sh <[OPEN, OINKCODE]>"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download rules
|
||||||
|
fuDLRULES
|
||||||
|
|
||||||
|
# Extract and enable all rules
|
||||||
|
tar xvfz /tmp/rules.tar.gz -C /etc/suricata/
|
||||||
sed -i s/^#alert/alert/ /etc/suricata/rules/*.rules
|
sed -i s/^#alert/alert/ /etc/suricata/rules/*.rules
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
# T-Pot (Standard)
|
# T-Pot (Standard)
|
||||||
# For docker-compose ...
|
# For docker-compose ...
|
||||||
version: '2.1'
|
version: '2.2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
# Suricata service
|
# Suricata service
|
||||||
suricata:
|
suricata:
|
||||||
|
build: .
|
||||||
container_name: suricata
|
container_name: suricata
|
||||||
restart: always
|
restart: always
|
||||||
|
environment:
|
||||||
|
# For ET Pro ruleset replace <OPEN> with your OINKCODE
|
||||||
|
- OINKCODE=OPEN
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- SYS_NICE
|
- SYS_NICE
|
||||||
- NET_RAW
|
- NET_RAW
|
||||||
image: "dtagdevsec/suricata:1710"
|
image: "dtagdevsec/suricata:1804"
|
||||||
volumes:
|
volumes:
|
||||||
- /data/suricata/log:/var/log/suricata
|
- /data/suricata/log:/var/log/suricata
|
||||||
|
|
|
@ -189,12 +189,15 @@ services:
|
||||||
suricata:
|
suricata:
|
||||||
container_name: suricata
|
container_name: suricata
|
||||||
restart: always
|
restart: always
|
||||||
|
environment:
|
||||||
|
# For ET Pro ruleset replace <OPEN> with your OINKCODE
|
||||||
|
- OINKCODE=OPEN
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- SYS_NICE
|
- SYS_NICE
|
||||||
- NET_RAW
|
- NET_RAW
|
||||||
image: "dtagdevsec/suricata:1710"
|
image: "dtagdevsec/suricata:1804"
|
||||||
volumes:
|
volumes:
|
||||||
- /data/suricata/log:/var/log/suricata
|
- /data/suricata/log:/var/log/suricata
|
||||||
|
|
||||||
|
|
|
@ -291,12 +291,15 @@ services:
|
||||||
suricata:
|
suricata:
|
||||||
container_name: suricata
|
container_name: suricata
|
||||||
restart: always
|
restart: always
|
||||||
|
environment:
|
||||||
|
# For ET Pro ruleset replace <OPEN> with your OINKCODE
|
||||||
|
- OINKCODE=OPEN
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- SYS_NICE
|
- SYS_NICE
|
||||||
- NET_RAW
|
- NET_RAW
|
||||||
image: "dtagdevsec/suricata:1710"
|
image: "dtagdevsec/suricata:1804"
|
||||||
volumes:
|
volumes:
|
||||||
- /data/suricata/log:/var/log/suricata
|
- /data/suricata/log:/var/log/suricata
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/data/conpot/log/conpot.json
|
/data/ciscoasa/log/ciscoasa.log
|
||||||
/data/conpot/log/conpot.log
|
/data/conpot/log/conpot*.json
|
||||||
|
/data/conpot/log/conpot*.log
|
||||||
/data/cowrie/log/cowrie.json
|
/data/cowrie/log/cowrie.json
|
||||||
/data/cowrie/log/cowrie-textlog.log
|
/data/cowrie/log/cowrie-textlog.log
|
||||||
/data/cowrie/log/lastlog.txt
|
/data/cowrie/log/lastlog.txt
|
||||||
|
@ -16,6 +17,8 @@
|
||||||
/data/emobility/log/centralsystemEWS.log
|
/data/emobility/log/centralsystemEWS.log
|
||||||
/data/glastopf/log/glastopf.log
|
/data/glastopf/log/glastopf.log
|
||||||
/data/glastopf/db/glastopf.db
|
/data/glastopf/db/glastopf.db
|
||||||
|
/data/heralding/log/*.log
|
||||||
|
/data/heralding/log/*.csv
|
||||||
/data/honeytrap/log/*.log
|
/data/honeytrap/log/*.log
|
||||||
/data/honeytrap/log/*.json
|
/data/honeytrap/log/*.json
|
||||||
/data/honeytrap/attacks.tgz
|
/data/honeytrap/attacks.tgz
|
||||||
|
|
Loading…
Reference in a new issue