By default, zabbix runs on http and sends all login data in cleartext which is not ideal in terms of security. This is a short writeup on how to configure the zabbix-frontend to run on https.
First up, you'll need a certificate. This can be obtained from your internal CA or you can generate a self-signed certificate using this handy command:
[archy@zabbix ~]$ sudo openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout /etc/pki/tls/private/zabbix.archyslife.lan.key -out /etc/pki/tls/certs/zabbix.archyslife.lan.cert
Now that you've got the certificate, reconfigure httpd to also listen on port 443. Add this line to /etc/httpd/conf/httpd.conf:
[archy@zabbix ~]$ sudo vim /etc/httpd/conf/httpd.conf
Listen 443
Now, let's configure the zabbix virtualhost. The virtualhost config is a slightly altered version of the default version provided by zabbix.
[archy@zabbix ~]$ sudo vim /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /usr/share/zabbix
<VirtualHost *:443>
SSLEngine on
SSLCipherSuite AES256+EECDH:AES256+EDH
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCertificateFile /etc/pki/tls/certs/zabbix.archyslife.lan.cert
SSLCertificateKeyFile /etc/pki/tls/private/zabbix.archyslife.lan.key
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# Removed in PHP 7
php_value always_populate_raw_post_data -1
php_flag session.auto_start off
php_value mbstring.func_overload 0
php_value date.timezone Europe/Prague
</IfModule>
</Directory>
<Directory ~ "^/usr/share/zabbix/(conf|app|include|local)/">
<IfModule mod_authz_core.c>
# Apache 2.4
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Deny from all
</IfModule>
<files *.php>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</files>
</Directory>
</VirtualHost>
The highlighted lines are responsible for SSL. Now that it's configured, check the syntax using httpd:
[archy@zabbix ~]$ sudo httpd -t
If that returns 'Syntax OK', you can go ahead and restart the httpd.service:
[archy@zabbix ~]$ sudo systemctl restart httpd.service
That's it, zabbix should not be reachable through https only.
Keep in mind that using a self-signed cert is not the way to go and the cert should be replaced with a cert issued by a trusted CA, such as one hosted by FreeIPA or Active Directory.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment