From 5e92209e5b284e0f0d99c30e555cc498a39c396e Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 12 Oct 2015 23:23:44 +0200 Subject: introduce gpg checks --- manifests/plugins/gpg.pp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 manifests/plugins/gpg.pp (limited to 'manifests/plugins') diff --git a/manifests/plugins/gpg.pp b/manifests/plugins/gpg.pp new file mode 100644 index 0000000..d8c1d40 --- /dev/null +++ b/manifests/plugins/gpg.pp @@ -0,0 +1,43 @@ +# check_gpg from +# https://github.com/lelutin/nagios-plugins/blob/master/check_gpg +class nagios::plugins::gpg { + require ::gnupg + nagios::plugin{'check_gpg': + source => 'nagios/plugins/check_gpg', + } + + $gpg_home = '/var/local/nagios_gpg_homedir' + file{ + $gpg_home: + ensure => 'directory', + owner => nagios, + group => nagios, + mode => '0600', + require => Nagios::Plugin['check_gpg']; + '/etc/cron.daily/update_nagios_gpgkeys': + content => "!#/bin/bash +function exec() { + cmd=\$1 + outout=\$(su - nagios -s /bin/bash -c 'gpg --homedir ${gpg_home} --logger-fd 1 \${cmd}') + if [ \$? -gt 0 ]; then + echo \$output + exit 1 + fi +} + +gpg('--with-fingerprint --list-keys --with-colons') | grep \"^pub\" -A 1 | tail -n 1 | cut -f10 -d\":\" | sort --random-sort | while read key; do + gpg(\"--recv-keys \${key}\") +done +", + owner => root, + group => 0, + mode => '0700', + require => File[$gpg_home]; + } + nagios_command { + 'check_gnupg': + command_line => "\$USER1\$/check_gpg --gnupg-homedir ${gpg_home} -w \$ARG1\$ \$ARG2\$", + require => Nagios::Plugin['check_gpg'], + } +} + -- cgit v1.2.3 From bbda7cef0b0d6d68c9d2c393592cbfbef9f3534e Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 12 Oct 2015 23:26:10 +0200 Subject: introduce horde_login checks --- manifests/plugins/horde_login.pp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 manifests/plugins/horde_login.pp (limited to 'manifests/plugins') diff --git a/manifests/plugins/horde_login.pp b/manifests/plugins/horde_login.pp new file mode 100644 index 0000000..908b57b --- /dev/null +++ b/manifests/plugins/horde_login.pp @@ -0,0 +1,9 @@ +# check_horde_login +class nagios::plugins::horde_login { + nagios::plugin { 'check_horde_login': + source => 'nagios/plugins/check_horde_login', + } -> nagios_command { + 'check_horde_login': + command_line => "\$USER1\$/check_horde_login -s \$ARG1\$ -u \$ARG2\$ -p \$ARG3\$", + } +} -- cgit v1.2.3 From c754ec94b331828588b6a3c2423ef9f21c849e18 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 12 Oct 2015 23:32:28 +0200 Subject: the module is called gpg --- manifests/plugins/gpg.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugins') diff --git a/manifests/plugins/gpg.pp b/manifests/plugins/gpg.pp index d8c1d40..3493ff8 100644 --- a/manifests/plugins/gpg.pp +++ b/manifests/plugins/gpg.pp @@ -1,7 +1,7 @@ # check_gpg from # https://github.com/lelutin/nagios-plugins/blob/master/check_gpg class nagios::plugins::gpg { - require ::gnupg + require ::gpg nagios::plugin{'check_gpg': source => 'nagios/plugins/check_gpg', } -- cgit v1.2.3 From e0b08c71a7aaa721481a5662dc3c4eef143f32e4 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 12 Oct 2015 23:52:12 +0200 Subject: make it possible to define the keyserver to fetch from --- manifests/plugins/gpg.pp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'manifests/plugins') diff --git a/manifests/plugins/gpg.pp b/manifests/plugins/gpg.pp index 3493ff8..198f5ab 100644 --- a/manifests/plugins/gpg.pp +++ b/manifests/plugins/gpg.pp @@ -1,6 +1,8 @@ # check_gpg from # https://github.com/lelutin/nagios-plugins/blob/master/check_gpg -class nagios::plugins::gpg { +class nagios::plugins::gpg( + $keyserver = 'hkp://keys.mayfirst.org', +) { require ::gpg nagios::plugin{'check_gpg': source => 'nagios/plugins/check_gpg', @@ -15,8 +17,8 @@ class nagios::plugins::gpg { mode => '0600', require => Nagios::Plugin['check_gpg']; '/etc/cron.daily/update_nagios_gpgkeys': - content => "!#/bin/bash -function exec() { + content => "#!/bin/bash +function gpg() { cmd=\$1 outout=\$(su - nagios -s /bin/bash -c 'gpg --homedir ${gpg_home} --logger-fd 1 \${cmd}') if [ \$? -gt 0 ]; then @@ -25,8 +27,8 @@ function exec() { fi } -gpg('--with-fingerprint --list-keys --with-colons') | grep \"^pub\" -A 1 | tail -n 1 | cut -f10 -d\":\" | sort --random-sort | while read key; do - gpg(\"--recv-keys \${key}\") +su - nagios -s /bin/bash -c 'gpg --homedir ${gpg_home} --with-fingerprint --list-keys --with-colons | grep \"^pub\" -A 1 | tail -n 1 | cut -f10 -d\":\" | sort --random-sort | while read key; do + gpg \"--keyserver ${keyserver} --recv-keys \${key}\" done ", owner => root, -- cgit v1.2.3 From 41cf7666abb78020c7ea3a331bd65f709e73fbf8 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 13 Oct 2015 00:01:11 +0200 Subject: correct naming --- manifests/plugins/gpg.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugins') diff --git a/manifests/plugins/gpg.pp b/manifests/plugins/gpg.pp index 198f5ab..632ad1f 100644 --- a/manifests/plugins/gpg.pp +++ b/manifests/plugins/gpg.pp @@ -37,7 +37,7 @@ done require => File[$gpg_home]; } nagios_command { - 'check_gnupg': + 'check_gpg': command_line => "\$USER1\$/check_gpg --gnupg-homedir ${gpg_home} -w \$ARG1\$ \$ARG2\$", require => Nagios::Plugin['check_gpg'], } -- cgit v1.2.3 From 77419fa626578d14e55042a39b2b87e5c0904ae2 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 13 Oct 2015 00:57:06 +0200 Subject: install requirements --- manifests/plugins/horde_login.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'manifests/plugins') diff --git a/manifests/plugins/horde_login.pp b/manifests/plugins/horde_login.pp index 908b57b..4274b4c 100644 --- a/manifests/plugins/horde_login.pp +++ b/manifests/plugins/horde_login.pp @@ -1,7 +1,9 @@ # check_horde_login class nagios::plugins::horde_login { + ensure_packages(['python-requests']) nagios::plugin { 'check_horde_login': - source => 'nagios/plugins/check_horde_login', + source => 'nagios/plugins/check_horde_login', + require => Package['python-requests'], } -> nagios_command { 'check_horde_login': command_line => "\$USER1\$/check_horde_login -s \$ARG1\$ -u \$ARG2\$ -p \$ARG3\$", -- cgit v1.2.3 From 3a39c6e693a835d98ed382bdc3ce72eac31ea664 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 16 Oct 2015 15:38:20 +0200 Subject: fetch things over hkps and on every check --- manifests/plugins/gpg.pp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'manifests/plugins') diff --git a/manifests/plugins/gpg.pp b/manifests/plugins/gpg.pp index 632ad1f..a09736a 100644 --- a/manifests/plugins/gpg.pp +++ b/manifests/plugins/gpg.pp @@ -1,8 +1,6 @@ # check_gpg from # https://github.com/lelutin/nagios-plugins/blob/master/check_gpg -class nagios::plugins::gpg( - $keyserver = 'hkp://keys.mayfirst.org', -) { +class nagios::plugins::gpg { require ::gpg nagios::plugin{'check_gpg': source => 'nagios/plugins/check_gpg', @@ -16,25 +14,12 @@ class nagios::plugins::gpg( group => nagios, mode => '0600', require => Nagios::Plugin['check_gpg']; - '/etc/cron.daily/update_nagios_gpgkeys': - content => "#!/bin/bash -function gpg() { - cmd=\$1 - outout=\$(su - nagios -s /bin/bash -c 'gpg --homedir ${gpg_home} --logger-fd 1 \${cmd}') - if [ \$? -gt 0 ]; then - echo \$output - exit 1 - fi -} - -su - nagios -s /bin/bash -c 'gpg --homedir ${gpg_home} --with-fingerprint --list-keys --with-colons | grep \"^pub\" -A 1 | tail -n 1 | cut -f10 -d\":\" | sort --random-sort | while read key; do - gpg \"--keyserver ${keyserver} --recv-keys \${key}\" -done -", - owner => root, + "${gpg_home}/sks-keyservers.netCA.pem": + source => 'puppet:///modules/nagios/plugin_data/sks-keyservers.netCA.pem', + owner => nagios, group => 0, - mode => '0700', - require => File[$gpg_home]; + mode => '0400', + before => Nagios_command['check_gpg']; } nagios_command { 'check_gpg': -- cgit v1.2.3 From e66581b620d89e81ec02754005f3e3fa2bc603cf Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 25 Oct 2015 16:28:46 +0100 Subject: add an imap_login check --- manifests/plugins/imap_login.pp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 manifests/plugins/imap_login.pp (limited to 'manifests/plugins') diff --git a/manifests/plugins/imap_login.pp b/manifests/plugins/imap_login.pp new file mode 100644 index 0000000..bb53b81 --- /dev/null +++ b/manifests/plugins/imap_login.pp @@ -0,0 +1,7 @@ +# a simple imap login check +class nagios::plugins::imap_login { + nagios::plugin { 'check_imap_login': + source => 'nagios/plugins/check_imap_login', + } +} + -- cgit v1.2.3 From c3ca4ac25d7cdfd5826149445f2946d64d968f97 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 31 Oct 2015 10:26:05 +0100 Subject: also add pop3 login checks --- manifests/plugins/imap_login.pp | 7 ------- manifests/plugins/mail_login.pp | 10 ++++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 manifests/plugins/imap_login.pp create mode 100644 manifests/plugins/mail_login.pp (limited to 'manifests/plugins') diff --git a/manifests/plugins/imap_login.pp b/manifests/plugins/imap_login.pp deleted file mode 100644 index bb53b81..0000000 --- a/manifests/plugins/imap_login.pp +++ /dev/null @@ -1,7 +0,0 @@ -# a simple imap login check -class nagios::plugins::imap_login { - nagios::plugin { 'check_imap_login': - source => 'nagios/plugins/check_imap_login', - } -} - diff --git a/manifests/plugins/mail_login.pp b/manifests/plugins/mail_login.pp new file mode 100644 index 0000000..a86cdc2 --- /dev/null +++ b/manifests/plugins/mail_login.pp @@ -0,0 +1,10 @@ +# simple mail login check +class nagios::plugins::mail_login { + nagios::plugin { + 'check_imap_login': + source => 'nagios/plugins/check_imap_login'; + 'check_pop3_login': + source => 'nagios/plugins/check_pop3_login'; + } +} + -- cgit v1.2.3