Below are the directions that I used to install 5 Nagios XI servers in a row to test and use the SSL connection. This seems to work with no issues and is as simple as you can get.
Encrypted Logins
You do have a few requirements for installation.
Create a Self-Signed Certificate
OpenSSL should be installed on the server as this will be used to create the keys. Create a RSA private key for the server:
Code: Select all
cd
openssl genrsa -des3 -out server.key 2048
Generating RSA private key, 2046 bit long modulus
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
Code: Select all
openssl rsa -noout -text -in server.key
Enter pass phrase for server.key:
Create a Certificate Signing Request with the server’s RSA private key
Code: Select all
openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:Montana
Locality Name (eg, city) [Newbury]:Trout Creek
Organization Name (eg, company) [My Company Ltd]:My Company
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:ns.example.com
Email Address []:
[email protected]
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:Mu75Rdes43
An optional company name []:
Code: Select all
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=US/ST=Montana/L=Trout Creek/O=My Company/CN=ns.example.com/emailAddress=
[email protected] Getting Private key
Enter pass phrase for server.key:
Code: Select all
cp server.crt /etc/pki/tls/certs/
cp server.key /etc/pki/tls/private/
cp server.csr /etc/pki/tls/private/
Now edit the /etc/httpd/conf.d/ssl.conf file and verify these lines with paths exist.
Code: Select all
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
Change the permissions:
Code: Select all
chmod go-rwx /etc/pki/tls/certs/server.crt
chmod go-rwx /etc/pki/tls/private/server.key
Remove the key passphrase so you do not have to be present for restart.
Code: Select all
openssl rsa -in server.key -out /etc/pki/tls/private/server.key
###########################################
Edit /etc/httpd/conf/httpd.conf
###########################################
Place this text at the end of the file.
Code: Select all
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
###########################################
Edit /usr/local/nagiosxi/html/config.inc.php
###########################################
Change the false to true so it looks like this:
// force http/https
###########################################
Edit Admin/System Config/System Settings
###########################################
Change the Program URL: to https
###########################################
Edit Configure/Core Config Manager/Config Manager Admin/Config Manager Settings
###########################################
Modify the Config Manager Settings:
Proceed to Config/Core Config Manager/Config Manager Admin/ Config Manager Settings. Before making changes, alter the permissions on the file to modify with:
chown apache:nagios /var/www/html/nagiosql/config/settings.php
In the XI interface choose Configure/Core Config Manager/Config Manager Admin/Config Manager Settings. Then select the "Server Protocol" and make it HTTPS.
Restart apache with:
When you access a self-signed certificate some browsers will indicate a problem. This is just because it is not an official certificate, the security is still fine. Here is an example with Chrome.