From 9ff7bd07815b63b33fe55dfa38249d55525af835 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 30 Jan 2022 19:38:57 +0100 Subject: [PATCH] Allow nagios to change ssmtp config --- Dockerfile | 8 ++++---- entrypoint.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 29675ab..83fa035 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,13 +18,13 @@ RUN apk add --no-cache \ nagios-plugins-ssl_validity \ nagios-web \ nrpe-plugin \ - ssmtp - -USER nagios + ssmtp && \ + chown nagios /etc/ssmtp/ssmtp.conf COPY FREE_send_notification.sh /usr/bin/FREE_send_notification.sh - COPY entrypoint.sh /docker-entrypoint.sh ENTRYPOINT ["/docker-entrypoint.sh"] +USER nagios + CMD ["/usr/sbin/nagios", "/etc/nagios/nagios.cfg"] diff --git a/entrypoint.sh b/entrypoint.sh index f2de375..900730f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/sh -[ -n "${MAILER_HOST}" ] && sed -r -i "/^mailhub=/s/.*/mailhub=${MAILER_HOST}/" /etc/ssmtp/ssmtp.conf +[ -n "${MAILER_HOST}" ] && sed -r "/^mailhub=/s/.*/mailhub=${MAILER_HOST}/" /etc/ssmtp/ssmtp.conf > ~/ssmtp.conf && cat ~/ssmtp.conf > /etc/ssmtp/ssmtp.conf exec $@