2017-10-13 18:58:14 +00:00
|
|
|
FROM alpine
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2020-01-31 14:21:55 +00:00
|
|
|
# VARS
|
|
|
|
ENV LS_VER=7.5.2
|
2017-10-13 18:58:14 +00:00
|
|
|
# Include dist
|
|
|
|
ADD dist/ /root/dist/
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Setup env and apt
|
2019-03-15 22:23:30 +00:00
|
|
|
RUN sed -i 's/dl-cdn/dl-2/g' /etc/apk/repositories && \
|
2019-03-10 18:15:59 +00:00
|
|
|
apk -U --no-cache add \
|
2019-03-15 22:23:30 +00:00
|
|
|
aria2 \
|
2018-11-22 23:18:59 +00:00
|
|
|
bash \
|
2019-08-14 14:43:47 +00:00
|
|
|
bzip2 \
|
|
|
|
curl \
|
2018-11-22 23:18:59 +00:00
|
|
|
libc6-compat \
|
|
|
|
libzmq \
|
2019-03-15 22:23:30 +00:00
|
|
|
nss \
|
2020-01-31 14:21:55 +00:00
|
|
|
openjdk11-jre && \
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Get and install packages
|
2019-08-14 14:43:47 +00:00
|
|
|
mkdir -p /etc/listbot && \
|
2019-08-15 08:32:04 +00:00
|
|
|
cd /etc/listbot && \
|
2019-08-14 14:43:47 +00:00
|
|
|
aria2c -s16 -x 16 https://raw.githubusercontent.com/dtag-dev-sec/listbot/master/cve.yaml.bz2 && \
|
|
|
|
aria2c -s16 -x 16 https://raw.githubusercontent.com/dtag-dev-sec/listbot/master/iprep.yaml.bz2 && \
|
|
|
|
bunzip2 *.bz2 && \
|
2017-10-13 18:58:14 +00:00
|
|
|
cd /root/dist/ && \
|
|
|
|
mkdir -p /usr/share/logstash/ && \
|
2020-01-31 14:21:55 +00:00
|
|
|
aria2c -s 16 -x 16 https://artifacts.elastic.co/downloads/logstash/logstash-$LS_VER.tar.gz && \
|
|
|
|
tar xvfz logstash-$LS_VER.tar.gz --strip-components=1 -C /usr/share/logstash/ && \
|
2017-10-13 18:58:14 +00:00
|
|
|
/usr/share/logstash/bin/logstash-plugin install logstash-filter-translate && \
|
|
|
|
/usr/share/logstash/bin/logstash-plugin install logstash-output-syslog && \
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Add and move files
|
|
|
|
cd /root/dist/ && \
|
|
|
|
cp update.sh /usr/bin/ && \
|
|
|
|
chmod u+x /usr/bin/update.sh && \
|
|
|
|
mkdir -p /etc/logstash/conf.d && \
|
|
|
|
cp logstash.conf /etc/logstash/conf.d/ && \
|
2020-01-31 14:21:55 +00:00
|
|
|
cp elasticsearch-template-es7x.json /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.2.3-java/lib/logstash/outputs/elasticsearch/ && \
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2018-03-31 15:18:28 +00:00
|
|
|
# Setup user, groups and configs
|
|
|
|
addgroup -g 2000 logstash && \
|
|
|
|
adduser -S -H -s /bin/bash -u 2000 -D -g 2000 logstash && \
|
|
|
|
chown -R logstash:logstash /usr/share/logstash && \
|
|
|
|
chown -R logstash:logstash /etc/listbot && \
|
|
|
|
chmod 755 /usr/bin/update.sh && \
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Clean up
|
2018-05-04 16:29:55 +00:00
|
|
|
rm -rf /root/* && \
|
2018-11-22 23:18:59 +00:00
|
|
|
rm -rf /tmp/* && \
|
2018-05-04 16:29:55 +00:00
|
|
|
rm -rf /var/cache/apk/*
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2017-10-13 18:58:14 +00:00
|
|
|
# Healthcheck
|
|
|
|
HEALTHCHECK --retries=10 CMD curl -s -XGET 'http://127.0.0.1:9600'
|
2019-08-14 14:43:47 +00:00
|
|
|
#
|
2017-10-23 11:02:04 +00:00
|
|
|
# Start logstash
|
2018-04-18 15:21:32 +00:00
|
|
|
#USER logstash:logstash
|
2019-02-28 14:52:42 +00:00
|
|
|
CMD update.sh && exec /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf --config.reload.automatic --java-execution
|