This commit is contained in:
t3chn0m4g3
2021-12-21 11:37:18 +00:00
14 changed files with 390 additions and 17 deletions

View File

@ -1,7 +1,7 @@
FROM alpine:3.14
#
# VARS
ENV ES_VER=7.15.1 \
ENV ES_VER=7.16.2 \
ES_JAVA_HOME=/usr/lib/jvm/java-16-openjdk
# Include dist
@ -14,7 +14,7 @@ RUN apk -U --no-cache add \
bash \
curl \
nss && \
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing openjdk16-jre && \
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community openjdk16-jre && \
#
# Get and install packages
cd /root/dist/ && \

View File

@ -1,7 +1,7 @@
FROM node:14.17.6-alpine3.14
FROM node:16.13.0-alpine3.14
#
# VARS
ENV KB_VER=7.15.1
ENV KB_VER=7.16.2
#
# Include dist
ADD dist/ /root/dist/

View File

@ -147,6 +147,13 @@ input {
type => "Ipphoney"
}
# Log4pot
file {
path => ["/data/log4pot/log/log4pot.log"]
codec => json
type => "Log4pot"
}
# Mailoney
file {
path => ["/data/mailoney/log/commands.log"]
@ -564,6 +571,20 @@ filter {
}
}
# Log4pot
if [type] == "Log4pot" {
date {
match => [ "timestamp", "ISO8601" ]
}
mutate {
rename => {
"server_port" => "dest_port"
"port" => "src_port"
"client" => "src_ip"
}
}
}
# Mailoney
if [type] == "Mailoney" {
date {
@ -649,12 +670,12 @@ if "_jsonparsefailure" in [tags] { drop {} }
geoip {
cache_size => 10000
source => "src_ip"
database => "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-geoip-7.2.3-java/vendor/GeoLite2-City.mmdb"
database => "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-geoip-7.2.8-java/vendor/GeoLite2-City.mmdb"
}
geoip {
cache_size => 10000
source => "src_ip"
database => "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-geoip-7.2.3-java/vendor/GeoLite2-ASN.mmdb"
database => "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-geoip-7.2.8-java/vendor/GeoLite2-ASN.mmdb"
}
translate {
refresh_interval => 86400

58
docker/log4pot/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive
#
# Install packages
RUN apt-get update && \
apt-get update -y && \
apt-get dist-upgrade -y && \
apt-get install -y \
build-essential \
cargo \
cleo \
git \
libcap2 \
libcap2-bin \
libcurl4 \
libcurl4-nss-dev \
libffi7 \
libffi-dev \
libssl-dev \
python3-pip \
python3 \
python3-dev \
rust-all && \
pip3 install --upgrade pip && \
pip3 install poetry pycurl && \
#
# Install log4pot from GitHub and setup
mkdir -p /opt /var/log/log4pot && \
cd /opt/ && \
git clone https://github.com/thomaspatzke/Log4Pot && \
cd Log4Pot && \
# git checkout 4269bf4a91457328fb64c3e7941cb2f520e5e911 && \
git checkout 4e9bac32605e4d2dd4bbc6df56365988b4815c4a && \
sed -i 's#"type": logtype,#"reason": logtype,#g' log4pot.py && \
poetry install && \
setcap cap_net_bind_service=+ep /usr/bin/python3.8 && \
#
# Setup user, groups and configs
addgroup --gid 2000 log4pot && \
adduser --system --no-create-home --shell /bin/bash -uid 2000 --disabled-password --disabled-login -gid 2000 log4pot && \
chown log4pot:log4pot -R /opt/Log4Pot && \
#
# Clean up
apt-get purge -y build-essential \
cargo \
git \
libffi-dev \
libssl-dev \
python3-dev \
rust-all && \
apt-get autoremove -y --purge && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#
# Start log4pot
STOPSIGNAL SIGINT
USER log4pot:log4pot
WORKDIR /opt/Log4Pot/
CMD ["/usr/bin/python3","log4pot.py","--port","8080","--log","/var/log/log4pot/log/log4pot.log","--download-dir","/var/log/log4pot/payloads/","--download-class","--download-payloads"]

View File

@ -0,0 +1,27 @@
version: '2.3'
networks:
log4pot_local:
services:
# Log4pot service
log4pot:
build: .
container_name: log4pot
restart: always
tmpfs:
- /tmp:uid=2000,gid=2000
networks:
- log4pot_local
ports:
- "80:8080"
- "443:8080"
- "8080:8080"
- "9200:8080"
- "25565:8080"
image: "dtagdevsec/log4pot:2006"
read_only: true
volumes:
- /data/log4pot/log:/var/log/log4pot/log
- /data/log4pot/payloads:/var/log/log4pot/payloads