From 34220276a88c66bbfe48924b1d0bb0101e83e6af Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 5 Feb 2021 12:37:19 +0100 Subject: [PATCH 1/8] Revert "Make shipped mail notification scripts working" This reverts commit 247ec715e758bc70671099e42947f3bb8e7c91f4. That commit actually just silenced the not working mail notifications. --- deps.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.Dockerfile b/deps.Dockerfile index c80318e..3ead2aa 100644 --- a/deps.Dockerfile +++ b/deps.Dockerfile @@ -59,7 +59,7 @@ RUN cd /check_postgres ;\ FROM debian:buster-slim -RUN ["/bin/bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 mailutils monitoring-plugins openssh-client openssl postfix; apt-get clean; rm -vrf /var/lib/apt/lists/*"] +RUN ["/bin/bash", "-exo", "pipefail", "-c", "apt-get update; apt-get install --no-install-{recommends,suggests} -y dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 monitoring-plugins openssh-client openssl; apt-get clean; rm -vrf /var/lib/apt/lists/*"] COPY --from=entrypoint /entrypoint/entrypoint /entrypoint From f074b71db7cd4524e44dac18b936706e752e09b4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:24:29 +0000 Subject: [PATCH 2/8] Bump github.com/otiai10/copy from 1.4.0 to 1.5.0 in /entrypoint Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/otiai10/copy/releases) - [Commits](https://github.com/otiai10/copy/compare/v1.4.0...v1.5.0) Signed-off-by: dependabot-preview[bot] --- entrypoint/go.mod | 2 +- entrypoint/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint/go.mod b/entrypoint/go.mod index f099074..786ac01 100644 --- a/entrypoint/go.mod +++ b/entrypoint/go.mod @@ -3,6 +3,6 @@ module entrypoint go 1.14 require ( - github.com/otiai10/copy v1.4.0 + github.com/otiai10/copy v1.5.0 golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 ) diff --git a/entrypoint/go.sum b/entrypoint/go.sum index addf468..d5d7591 100644 --- a/entrypoint/go.sum +++ b/entrypoint/go.sum @@ -4,6 +4,8 @@ github.com/otiai10/copy v1.3.0 h1:Z0OIFgj8hyI18YVzgPXpp652vv0NggCGWaNKSPN9KU8= github.com/otiai10/copy v1.3.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/copy v1.4.0 h1:S9XdWuTRJ54QDIrdbPEVl/1lMwF5xOjd5AvF9S866y8= github.com/otiai10/copy v1.4.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= +github.com/otiai10/copy v1.5.0 h1:SoXDGnlTUZoqB/wSuj/Y5L6T5i6iN4YRAcMCd+JnLNU= +github.com/otiai10/copy v1.5.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= From dda64c17e46731d988f9c31e62ee5d8c421a5407 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 22 Feb 2021 11:52:25 +0100 Subject: [PATCH 3/8] GitHub actions: ensure buildability --- .github/workflows/build.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7c20340 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Build + +on: + push: + branches: + - master + pull_request: {} + +jobs: + build: + name: build + runs-on: ubuntu-latest + + steps: + - name: Checkout HEAD + uses: actions/checkout@v1 + + - name: Icinga 2 + run: git clone https://github.com/Icinga/icinga2.git + + - name: Build + run: ./build.bash ./icinga2 From 1c187ee17918099c23cd9446a72ec218317991a0 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 1 Mar 2021 17:16:17 +0100 Subject: [PATCH 4/8] Ship msmtp --- README.md | 5 +++++ deps.Dockerfile | 2 +- entrypoint/main.go | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 51a347a..f0c55ef 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ To configure it, do one of the following: on which configuration files there are. * Provide environment variables as shown above. +To notify by e-mail, provide an [msmtp configuration] - either +by mounting the `/etc/msmtprc` file or by specifying the desired content +of `~icinga/.msmtprc` via the environment variable `MSMTPRC`. + ### Environment variables Most of the following variables correspond to @@ -110,4 +114,5 @@ git clone https://github.com/Icinga/icinga2.git [Icinga 2]: https://github.com/Icinga/icinga2 [Docker]: https://www.docker.com [Icinga 2 configuration documentation]: https://icinga.com/docs/icinga2/latest/doc/04-configuration/ +[msmtp configuration]: https://wiki.archlinux.org/index.php/Msmtp [node setup command documentation]: https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#node-setup diff --git a/deps.Dockerfile b/deps.Dockerfile index 3ead2aa..b5186a4 100644 --- a/deps.Dockerfile +++ b/deps.Dockerfile @@ -59,7 +59,7 @@ RUN cd /check_postgres ;\ FROM debian:buster-slim -RUN ["/bin/bash", "-exo", "pipefail", "-c", "apt-get update; apt-get install --no-install-{recommends,suggests} -y dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 monitoring-plugins openssh-client openssl; apt-get clean; rm -vrf /var/lib/apt/lists/*"] +RUN ["/bin/bash", "-exo", "pipefail", "-c", "apt-get update; DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y ca-certificates dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 mailutils monitoring-plugins msmtp{,-mta} openssh-client openssl; apt-get clean; rm -vrf /var/lib/apt/lists/*"] COPY --from=entrypoint /entrypoint/entrypoint /entrypoint diff --git a/entrypoint/main.go b/entrypoint/main.go index c4bb0da..77b50bd 100644 --- a/entrypoint/main.go +++ b/entrypoint/main.go @@ -19,6 +19,7 @@ import ( const ca = "/var/lib/icinga2/certs/ca.crt" const crtMode = 0640 +const mSmtpRc = "/var/lib/icinga2/.msmtprc" func main() { if err := entrypoint(); err != nil { @@ -122,6 +123,14 @@ func entrypoint() error { } } + if mSmtpCfg, ok := os.LookupEnv("MSMTPRC"); ok { + logf(info, "Writing %#v", mSmtpRc) + + if errWF := ioutil.WriteFile(mSmtpRc, []byte(mSmtpCfg), 0644); errWF != nil { + return errWF + } + } + command = append([]string{"dumb-init", "-c", "--"}, command...) } From 88912f0c849326086fe624f81b23dbddc4746d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ha=CC=88cker?= Date: Wed, 3 Mar 2021 13:09:47 +0100 Subject: [PATCH 5/8] Add curl to the image to allow integration of scripts that use webhooks without modifying the base image. --- deps.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.Dockerfile b/deps.Dockerfile index b5186a4..550d593 100644 --- a/deps.Dockerfile +++ b/deps.Dockerfile @@ -59,7 +59,7 @@ RUN cd /check_postgres ;\ FROM debian:buster-slim -RUN ["/bin/bash", "-exo", "pipefail", "-c", "apt-get update; DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y ca-certificates dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 mailutils monitoring-plugins msmtp{,-mta} openssh-client openssl; apt-get clean; rm -vrf /var/lib/apt/lists/*"] +RUN ["/bin/bash", "-exo", "pipefail", "-c", "apt-get update; DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y ca-certificates curl dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 mailutils monitoring-plugins msmtp{,-mta} openssh-client openssl; apt-get clean; rm -vrf /var/lib/apt/lists/*"] COPY --from=entrypoint /entrypoint/entrypoint /entrypoint From 5dab413ab748e81babe4acc8315747c07b939622 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 8 Apr 2021 10:59:41 +0000 Subject: [PATCH 6/8] Bump github.com/otiai10/copy from 1.5.0 to 1.5.1 in /entrypoint Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/otiai10/copy/releases) - [Commits](https://github.com/otiai10/copy/compare/v1.5.0...v1.5.1) Signed-off-by: dependabot-preview[bot] --- entrypoint/go.mod | 2 +- entrypoint/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint/go.mod b/entrypoint/go.mod index 786ac01..31dad30 100644 --- a/entrypoint/go.mod +++ b/entrypoint/go.mod @@ -3,6 +3,6 @@ module entrypoint go 1.14 require ( - github.com/otiai10/copy v1.5.0 + github.com/otiai10/copy v1.5.1 golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 ) diff --git a/entrypoint/go.sum b/entrypoint/go.sum index d5d7591..1d8db75 100644 --- a/entrypoint/go.sum +++ b/entrypoint/go.sum @@ -6,6 +6,8 @@ github.com/otiai10/copy v1.4.0 h1:S9XdWuTRJ54QDIrdbPEVl/1lMwF5xOjd5AvF9S866y8= github.com/otiai10/copy v1.4.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/copy v1.5.0 h1:SoXDGnlTUZoqB/wSuj/Y5L6T5i6iN4YRAcMCd+JnLNU= github.com/otiai10/copy v1.5.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= +github.com/otiai10/copy v1.5.1 h1:a/cs2E1/1V0az8K5nblbl+ymEa4E11AfaOLMar8V34w= +github.com/otiai10/copy v1.5.1/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= From 34b7bfe657137369b360da6a285b6cf330d7470e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 28 Apr 2021 13:55:29 +0200 Subject: [PATCH 7/8] Document coreutils req for building on macOS --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f0c55ef..e70a816 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,15 @@ git clone https://github.com/Icinga/icinga2.git ./build.bash ./icinga2 ``` +In order to run the script on macOS, [coreutils] must be installed: + +* Install [Homebrew] +* Run `brew install coreutils` + [Icinga 2]: https://github.com/Icinga/icinga2 [Docker]: https://www.docker.com [Icinga 2 configuration documentation]: https://icinga.com/docs/icinga2/latest/doc/04-configuration/ [msmtp configuration]: https://wiki.archlinux.org/index.php/Msmtp [node setup command documentation]: https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#node-setup +[Homebrew]: https://brew.sh/ +[coreutils]: https://formulae.brew.sh/formula/coreutils From 761fa7b0f75dab7974d590573bc3e6756cda41fa Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:45:39 +0000 Subject: [PATCH 8/8] Upgrade to GitHub-native Dependabot --- .github/dependabot.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4a181d2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: +- package-ecosystem: gomod + directory: "/entrypoint" + schedule: + interval: daily + time: "10:00" + open-pull-requests-limit: 10 + ignore: + - dependency-name: github.com/otiai10/copy + versions: + - 1.4.2 + - 1.5.1 +- package-ecosystem: docker + directory: "/" + schedule: + interval: daily + time: "10:00" + open-pull-requests-limit: 10