diff --git a/Dockerfile b/Dockerfile index caddc3b..de441cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,12 +15,7 @@ RUN install -dm 2750 -o root -g root /var/lib/monit # Install config. monit.conf~ will be activated after allow_networks # runs. COPY ./monitrc /etc/monitrc -COPY ./monit /etc/monit.d/monit.conf~ -COPY ./allow_networks.sh /usr/local/bin/allow_networks - -# Set permissions -RUN chmod 700 /etc/monitrc /etc/monit.d/monit.conf~ -RUN chmod 755 /usr/local/bin/allow_networks +RUN chmod 600 /etc/monitrc # Allow access to the web GUI EXPOSE 2812 diff --git a/allow_networks.sh b/allow_networks.sh deleted file mode 100644 index a537688..0000000 --- a/allow_networks.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -set -e - -# Everything's OK -test -f /etc/monit.d/monit.conf && exit 0 - -# Obtain current IP addresses -ip route \ - | grep "^[0-9]" \ - | cut -d " " -f 1 \ - | sed -re "s/^/ allow /" \ - >> /etc/monit.d/monit.conf~ - -# Put in place -mv /etc/monit.d/monit.conf~ /etc/monit.d/monit.conf - -# Configure email -grep -q "${EMAIL}" /etc/monitrc || echo "set alert ${EMAIL}" >> /etc/monitrc - -# Reload config -monit reload diff --git a/monit b/monit deleted file mode 100644 index 7c190d9..0000000 --- a/monit +++ /dev/null @@ -1,2 +0,0 @@ -set httpd port 2812 - allow localhost diff --git a/monitrc b/monitrc index 61620a8..60f0940 100644 --- a/monitrc +++ b/monitrc @@ -8,9 +8,8 @@ set eventqueue basedir /var/lib/monit/events slots 100 set mailserver postfix set limits { programoutput: 1 MB } -check program allow_networks - with path "/usr/local/bin/allow_networks" - every 1 cycles - if status = 0 then unmonitor +set httpd port 2812 + allow localhost + allow 172.0.0.0/8 include /etc/monit.d/*.conf