From 32ca25c7ef3cd6c46baf1ae6c11f91f0c699d0b2 Mon Sep 17 00:00:00 2001 From: Paul Richards Date: Mon, 9 Dec 2013 20:46:36 +0000 Subject: [PATCH] NSCA-ng Vagrant Support: add nsca user to icingacmd group, move nsca-ng config files and set appropriate file permissions. Fixes #5222 Signed-off-by: Gunnar Beutner --- .vagrant-puppet/files/etc/.gitattributes | 2 ++ .../etc/icinga2/conf.d}/passive.conf | 0 .../nsca-ng/templates => files/etc}/nsca-ng.cfg | 2 +- .../templates => files/etc}/send_nsca.cfg | 1 - .../home/vagrant}/passive_result | 0 .../modules/nsca-ng/manifests/init.pp | 16 ++++++++++++---- 6 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .vagrant-puppet/files/etc/.gitattributes rename .vagrant-puppet/{modules/nsca-ng/templates => files/etc/icinga2/conf.d}/passive.conf (100%) rename .vagrant-puppet/{modules/nsca-ng/templates => files/etc}/nsca-ng.cfg (99%) rename .vagrant-puppet/{modules/nsca-ng/templates => files/etc}/send_nsca.cfg (97%) rename .vagrant-puppet/{modules/nsca-ng/templates => files/home/vagrant}/passive_result (100%) diff --git a/.vagrant-puppet/files/etc/.gitattributes b/.vagrant-puppet/files/etc/.gitattributes new file mode 100644 index 000000000..5e61c7cfa --- /dev/null +++ b/.vagrant-puppet/files/etc/.gitattributes @@ -0,0 +1,2 @@ +send_nsca.cfg text eol=lf +nsca-ng.cfg text eol=lf \ No newline at end of file diff --git a/.vagrant-puppet/modules/nsca-ng/templates/passive.conf b/.vagrant-puppet/files/etc/icinga2/conf.d/passive.conf similarity index 100% rename from .vagrant-puppet/modules/nsca-ng/templates/passive.conf rename to .vagrant-puppet/files/etc/icinga2/conf.d/passive.conf diff --git a/.vagrant-puppet/modules/nsca-ng/templates/nsca-ng.cfg b/.vagrant-puppet/files/etc/nsca-ng.cfg similarity index 99% rename from .vagrant-puppet/modules/nsca-ng/templates/nsca-ng.cfg rename to .vagrant-puppet/files/etc/nsca-ng.cfg index d1298f55b..f20a8c587 100644 --- a/.vagrant-puppet/modules/nsca-ng/templates/nsca-ng.cfg +++ b/.vagrant-puppet/files/etc/nsca-ng.cfg @@ -109,7 +109,7 @@ user = "nsca" # specified. # authorize "*" { - password = "password" + password = "change-me" # # The original NSCA server permits all authenticated clients to submit # arbitrary check results. To get this behaviour, enable the following diff --git a/.vagrant-puppet/modules/nsca-ng/templates/send_nsca.cfg b/.vagrant-puppet/files/etc/send_nsca.cfg similarity index 97% rename from .vagrant-puppet/modules/nsca-ng/templates/send_nsca.cfg rename to .vagrant-puppet/files/etc/send_nsca.cfg index 949dfa334..463019789 100644 --- a/.vagrant-puppet/modules/nsca-ng/templates/send_nsca.cfg +++ b/.vagrant-puppet/files/etc/send_nsca.cfg @@ -5,7 +5,6 @@ # AUTHORIZED USERS CAN ACCESS IT! # -password="password" identity="nsca-ng" # identity = "web-checker" # Default: `hostname`. # password = "8a5UMsMzZhu6sSPkSmSaqC3HjMGCLwdt" # Default: "change-me". diff --git a/.vagrant-puppet/modules/nsca-ng/templates/passive_result b/.vagrant-puppet/files/home/vagrant/passive_result similarity index 100% rename from .vagrant-puppet/modules/nsca-ng/templates/passive_result rename to .vagrant-puppet/files/home/vagrant/passive_result diff --git a/.vagrant-puppet/modules/nsca-ng/manifests/init.pp b/.vagrant-puppet/modules/nsca-ng/manifests/init.pp index 10b18a308..86d2df7b5 100644 --- a/.vagrant-puppet/modules/nsca-ng/manifests/init.pp +++ b/.vagrant-puppet/modules/nsca-ng/manifests/init.pp @@ -30,6 +30,11 @@ class nsca-ng-server { command => 'lokkit -p 5668:tcp' } + user { "nsca": + ensure => "present", + groups => "icingacmd" + } + service { 'nsca-ng': enable => true, ensure => running, @@ -39,7 +44,7 @@ class nsca-ng-server { } file { '/etc/nsca-ng.cfg': - content => template('nsca-ng/nsca-ng.cfg'), + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/nsca-ng.cfg', require => Package['nsca-ng-server'], notify => Service['nsca-ng'] } @@ -68,18 +73,21 @@ class nsca-ng-client { } file { '/etc/icinga2/conf.d/passive.conf': - content => template('nsca-ng/passive.conf'), + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/passive.conf', require => Package['nsca-ng-client'], notify => Service['icinga2'] } file { '/etc/send_nsca.cfg': - content => template('nsca-ng/send_nsca.cfg'), + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/send_nsca.cfg', + owner => 'root', + group => 'root', + mode => '0600', require => Package['nsca-ng-client'], } file { '/home/vagrant/passive_result': - content => template('nsca-ng/passive_result'), + source => 'puppet:////vagrant/.vagrant-puppet/files/home/vagrant/passive_result', require => Package['nsca-ng-client'], } } \ No newline at end of file