Categoriearchief: Debian

Nagios NRPE Server 2.15 Could not complete SSL handshake. 1

CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with [ip] 1

Found out it had to do with the major version difference 3.x connecting to 2.x. Adding -2 to the command line made no difference. Disabling SSL was an solution. But not preferred.

I recently upgraded (reinstalled) my vps from Debian Jessie to Debian Buster. I chose to install Nagios4 and NRPE client from Debian repositories. (Previous installation was build from source). I was using Nagios4x already, i guess the nrpe-plugins were a bit older.

On the other side i have an Netgear ReadyNAS Pro 6 to be monitored. This system is still running Debian Jessie. To stay compatible with Netgear updates, i am not doing an dist-upgrade on the OS. Debian Jessie has nagios-nrpe-server 2.x in it’s main repository.

While searching online, i came across a solution that rebuilds nagios-nrpe-server 2.x with a dh 2048 signature.

I tried to do the same thing, with success.

With https://wiki.debian.org/BuildingTutorial as base, i proceeded as following:

# Edit /etc/apt/sources.list, add an deb-src line
deb-src http://mirrors.kernel.org/debian jessie main

Now update apt

sudo apt-get update

Create a working directory and get source code

# Create working directory
mkdir -p src/debian
cd src/debian

# Get source
apt-get source nagios-nrpe-server

# Step into source
cd nagios-nrpe-2.15

# Build without patches, to check that all requirements a met
debuild -b -uc -us

# When build failed, try
sudo apt-get install build-essential fakeroot devscripts
# and
sudo apt-get build-dep nagios-nrpe-server

Now apply some changes to the source code.

Edit ./configure

OLD: $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h
NEW: $sslbin dhparam -C 2048 | awk '/^-----/ {exit} {print}' > include/dh.h

Edit ./configure.in

OLD: $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h
NEW: $sslbin dhparam -C 2048 | awk '/^-----/ {exit} {print}' > include/dh.h

Edit ./src/nrpe.c

OLD: dh=get_dh512();
NEW: dh=get_dh2048();

We can recompile now.

debuild -b -uc -us

If no error occurred, there should be 2 new .deb packages in your working directory.

Install both
sudo dpkg -i nagios-nrpe-plugin_2.15-1.deb
sudo dpkg -i nagios-nrpe-server_2.15-1.deb

Nagios Core (Server)

Leuk hé, elke morgen door tientallen mailtjes van diverse systemen werken. Gemak is anders. Van de week zelf toch maar eens gekeken naar een niet al te dure monitoring oplossing. En die is er: Nagios Core, een opensource gratis beschikbaar programma waar je tegen betaling ook support op kunt krijgen.

Eerst maar even de monitor server inrichten (Nagios Core server):

  • Zorg voor een Debian 6 machine (al dan niet een schone machine)
  • Ik heb voor de test (en later productie) een VPS op het net gehuurd.
  • Download nagios-core en nagios-plugins voor een basis monitoring server. (Pak gewoon de laatst beschikbare versie)

Download server components

$ mkdir nagiossetup
$ cd nagiossetup
$ wget http://../nagios-3.4.1.tar.gz
$ wget http://../nagios-plugins-1.4.15.tar.gz

Installeer nagios afhankelijkheden

$ apt-get install apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev

Serviceaccounts (windows term?) aanmaken

## Gebruiker aanmaken (in debian wordt ook een group aangemaakt)
$ useradd nagios
## Account activeren met wachtwoord, wachtwoord daarna documenteren/archiveren
$ passwd nagios 

## Nagios Command group aanmaken waar ook apache (www-data) lid van is
$ groupadd nagcmd
$ usermod -a -G nagcmd nagios
$ usermod -a -G nagcmd www-data

Nagios Core, uitpakken, configureren, compileren en installeren

$ cd ~/nagiossetup
## Extract download
$ tar xzf nagios-3.4.1.tar.gz
$ cd nagios-3.4.1
## Run configure script with servicegroup nagcmd
$ ./configure --with-command-group=nagcmd
## Compile source
$ make all
## Install nagios
$ make install
$ make install-init
$ make install-config
$ make install-commandmode
$ make install-webconf

Webtoegang regelen (aanmaken account in htpasswd)

## De eerste keer dit commando uitvoeren (-c = create NEW file)
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
## Voor iedere andere contactpersoon (zie etc/objects/contact.cfg)
htpasswd /usr/local/nagios/etc/htpasswd.users [[contact_name]]

## Opstarten/herstarten webserver:
$ service apache2 reload (or restart)

Nagios Core opstarten of herstarten

## Na iedere bewerken van Nagios Config files nagios herstarten
$ service nagios restart

Na de Core ook nog een basis set van Plugins installeren

## Download uitpakken
$ cd ~/nagiossetup
$ tar xzf nagios-plugins-1.4.15.tar.gz
$ cd nagios-plugins-1.4.15

## Configureren (met service account informatie)
$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios

## Compileren en installeren
$ make
$ make install

 De nagios monitor server is nu klaar voor gebruik

Binnenkort zal ik eens wat schrijven over het monitoren van remote diensten en remote systemen.

Wat nog wel even goed is om te weten:

## Nagios Program Files map (klink als windows?)
## Bevat configuratiebestanden en programmabestanden
$ cd /usr/local/nagios

## Controleren op fouten in configuratie:
$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

Nagios Downloads: http://nagios.org/download
Nagios Documentatie: http://nagios.sourceforge.net/docs/nagioscore/3/en/toc.html