Configure Zabbix 7 with SSL certificates and database encryption

Intermediate 45 min Apr 24, 2026
Ubuntu 24.04 Debian 12 AlmaLinux 9 Rocky Linux 9

Secure your Zabbix 7 monitoring infrastructure with SSL certificates for the web interface, encrypted database connections, and TLS-protected agent communication. Essential for production monitoring environments.

Prerequisites

  • Zabbix 7 server installed
  • Apache web server running
  • MySQL or PostgreSQL database
  • Root or sudo access

What this solves

Zabbix 7 monitors your infrastructure but transmits sensitive data like credentials, performance metrics, and system information. This tutorial secures all communication channels with SSL/TLS encryption, protecting your monitoring data from interception and ensuring compliance with security standards.

Step-by-step configuration

Update system packages

Start by updating your package manager to ensure you have the latest security patches.

sudo apt update && sudo apt upgrade -y
sudo dnf update -y

Install SSL certificate tools

Install OpenSSL and certificate management tools for generating and managing SSL certificates.

sudo apt install -y openssl ca-certificates
sudo dnf install -y openssl ca-certificates

Create SSL certificate directory

Create a dedicated directory for Zabbix SSL certificates with proper ownership and permissions.

sudo mkdir -p /etc/zabbix/ssl
sudo chown zabbix:zabbix /etc/zabbix/ssl
sudo chmod 750 /etc/zabbix/ssl

Generate SSL certificates for web interface

Create a self-signed SSL certificate for the Zabbix web interface. For production, replace with certificates from a trusted CA.

sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 \
  -keyout /etc/zabbix/ssl/zabbix-web.key \
  -out /etc/zabbix/ssl/zabbix-web.crt \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=zabbix.example.com"

Set SSL certificate permissions

Configure proper ownership and permissions for the SSL certificates to ensure security while allowing Zabbix services to access them.

sudo chown zabbix:zabbix /etc/zabbix/ssl/zabbix-web.*
sudo chmod 600 /etc/zabbix/ssl/zabbix-web.key
sudo chmod 644 /etc/zabbix/ssl/zabbix-web.crt
Never use chmod 777. SSL private keys must be readable only by the service user. Using 777 would expose your private key to all system users.

Configure Apache SSL for Zabbix web interface

Enable Apache SSL module and configure virtual host with SSL termination for the Zabbix web interface.

sudo a2enmod ssl
sudo a2enmod rewrite
sudo dnf install -y mod_ssl

Create Apache SSL virtual host configuration

Create a secure Apache virtual host configuration that enables HTTPS and redirects HTTP traffic to HTTPS.


    ServerName zabbix.example.com
    Redirect permanent / https://zabbix.example.com/



    ServerName zabbix.example.com
    DocumentRoot /usr/share/zabbix
    
    SSLEngine on
    SSLCertificateFile /etc/zabbix/ssl/zabbix-web.crt
    SSLCertificateKeyFile /etc/zabbix/ssl/zabbix-web.key
    
    # Modern SSL configuration
    SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
    SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
    SSLHonorCipherOrder off
    SSLSessionTickets off
    
    # Security headers
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    Header always set X-Frame-Options SAMEORIGIN
    Header always set X-Content-Type-Options nosniff
    
    
        Options FollowSymLinks
        AllowOverride None
        Require all granted
        
        
            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
            php_value max_input_vars 10000
            php_value always_populate_raw_post_data -1
            php_value date.timezone Europe/London
        
    
    
    ErrorLog ${APACHE_LOG_DIR}/zabbix_ssl_error.log
    CustomLog ${APACHE_LOG_DIR}/zabbix_ssl_access.log combined

Enable the SSL virtual host

Enable the new SSL virtual host and restart Apache to apply the SSL configuration.

sudo a2ensite zabbix-ssl
sudo a2dissite 000-default
sudo systemctl restart apache2
sudo systemctl restart httpd

Configure database SSL encryption

Generate SSL certificates for MySQL/PostgreSQL database connections to encrypt data in transit between Zabbix server and database.

sudo mkdir -p /etc/zabbix/ssl/db
sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 \
  -keyout /etc/zabbix/ssl/db/client-key.pem \
  -out /etc/zabbix/ssl/db/client-cert.pem \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=zabbix-db-client"
sudo chown -R zabbix:zabbix /etc/zabbix/ssl/db
sudo chmod 600 /etc/zabbix/ssl/db/client-key.pem
sudo chmod 644 /etc/zabbix/ssl/db/client-cert.pem

Configure Zabbix server database SSL connection

Modify the Zabbix server configuration to use SSL for database connections, ensuring all database traffic is encrypted.

# Database SSL configuration
DBTLSConnect=required
DBTLSCertFile=/etc/zabbix/ssl/db/client-cert.pem
DBTLSKeyFile=/etc/zabbix/ssl/db/client-key.pem
DBTLSCAFile=/etc/zabbix/ssl/db/ca-cert.pem

Existing database configuration

DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=your_secure_password

Server SSL configuration for agent communication

TLSCertFile=/etc/zabbix/ssl/zabbix-server.crt TLSKeyFile=/etc/zabbix/ssl/zabbix-server.key TLSCAFile=/etc/zabbix/ssl/ca.crt

Generate certificates for agent communication

Create SSL certificates for secure communication between Zabbix server and agents using TLS encryption.

# Create CA certificate
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:4096 \
  -keyout /etc/zabbix/ssl/ca.key \
  -out /etc/zabbix/ssl/ca.crt \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=Zabbix-CA"

Create server certificate

sudo openssl req -nodes -newkey rsa:4096 \ -keyout /etc/zabbix/ssl/zabbix-server.key \ -out /etc/zabbix/ssl/zabbix-server.csr \ -subj "/C=US/ST=State/L=City/O=Organization/CN=zabbix-server" sudo openssl x509 -req -days 365 \ -in /etc/zabbix/ssl/zabbix-server.csr \ -CA /etc/zabbix/ssl/ca.crt \ -CAkey /etc/zabbix/ssl/ca.key \ -CAcreateserial \ -out /etc/zabbix/ssl/zabbix-server.crt

Set permissions

sudo chown zabbix:zabbix /etc/zabbix/ssl/zabbix-server.* sudo chown zabbix:zabbix /etc/zabbix/ssl/ca.* sudo chmod 600 /etc/zabbix/ssl/zabbix-server.key sudo chmod 600 /etc/zabbix/ssl/ca.key sudo chmod 644 /etc/zabbix/ssl/zabbix-server.crt sudo chmod 644 /etc/zabbix/ssl/ca.crt

Configure Zabbix agent SSL communication

Generate agent certificates and configure the Zabbix agent to use TLS for secure communication with the server.

# Generate agent certificate
sudo openssl req -nodes -newkey rsa:4096 \
  -keyout /etc/zabbix/ssl/zabbix-agent.key \
  -out /etc/zabbix/ssl/zabbix-agent.csr \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=zabbix-agent"

sudo openssl x509 -req -days 365 \
  -in /etc/zabbix/ssl/zabbix-agent.csr \
  -CA /etc/zabbix/ssl/ca.crt \
  -CAkey /etc/zabbix/ssl/ca.key \
  -CAcreateserial \
  -out /etc/zabbix/ssl/zabbix-agent.crt

sudo chown zabbix:zabbix /etc/zabbix/ssl/zabbix-agent.*
sudo chmod 600 /etc/zabbix/ssl/zabbix-agent.key
sudo chmod 644 /etc/zabbix/ssl/zabbix-agent.crt

Update Zabbix agent configuration

Configure the Zabbix agent to use SSL certificates for encrypted communication with the Zabbix server.

# Server configuration
Server=203.0.113.10
ServerActive=203.0.113.10
Hostname=zabbix-agent-01

TLS configuration

TLSConnect=cert TLSAccept=cert TLSCertFile=/etc/zabbix/ssl/zabbix-agent.crt TLSKeyFile=/etc/zabbix/ssl/zabbix-agent.key TLSCAFile=/etc/zabbix/ssl/ca.crt TLSServerCertIssuer=CN=Zabbix-CA TLSServerCertSubject=CN=zabbix-server

Configure firewall rules for HTTPS

Open the necessary firewall ports for HTTPS web interface and secure Zabbix agent communication.

sudo ufw allow 443/tcp comment 'Zabbix HTTPS'
sudo ufw allow 10051/tcp comment 'Zabbix Server'
sudo ufw reload
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=10051/tcp
sudo firewall-cmd --reload

Restart Zabbix services

Restart all Zabbix services to apply the SSL configuration and enable encrypted communication.

sudo systemctl restart zabbix-server
sudo systemctl restart zabbix-agent
sudo systemctl status zabbix-server
sudo systemctl status zabbix-agent

Verify your setup

Test that SSL encryption is working correctly for all Zabbix components.

# Test HTTPS web interface
curl -k https://zabbix.example.com

Check SSL certificate

openssl s_client -connect zabbix.example.com:443 -servername zabbix.example.com

Verify Zabbix server SSL configuration

sudo zabbix_server -R config_cache_reload

Check agent TLS communication

zabbix_get -s 127.0.0.1 -p 10050 -k "system.uname" --tls-connect=cert \ --tls-ca-file=/etc/zabbix/ssl/ca.crt \ --tls-cert-file=/etc/zabbix/ssl/zabbix-server.crt \ --tls-key-file=/etc/zabbix/ssl/zabbix-server.key

Check service status

sudo systemctl status zabbix-server zabbix-agent apache2

Configure web interface SSL settings

Update Zabbix web configuration

Configure the Zabbix web interface to use HTTPS and secure session handling.

Common issues

SymptomCauseFix
SSL certificate errors in browser Self-signed certificate not trusted Add certificate to browser trust store or use CA-signed certificate
Zabbix server cannot connect to database Database SSL not configured properly Verify DBTLSConnect settings and certificate paths in server config
Agent communication fails with TLS errors Certificate subject/issuer mismatch Check TLSServerCertSubject and TLSServerCertIssuer match certificate values
Apache fails to start after SSL config SSL certificate permission issues Verify certificate ownership: chown www-data:www-data /etc/zabbix/ssl/zabbix-web.*
Zabbix web interface shows database connection error PHP cannot access database certificates Set proper ownership: chown www-data:zabbix /etc/zabbix/ssl/db/*

Security hardening

Additional security measures to further protect your Zabbix installation.

Configure session security

Enhance web interface session security with secure cookies and session timeout.

; Session security
session.cookie_secure = On
session.cookie_httponly = On
session.cookie_samesite = Strict
session.use_strict_mode = On

; Disable potentially dangerous functions
disable_functions = exec,passthru,shell_exec,system,proc_open,popen

; Hide PHP version
expose_php = Off

Set up log monitoring

Configure log monitoring to detect SSL-related issues and security events.

sudo mkdir -p /var/log/zabbix/ssl
sudo chown zabbix:zabbix /var/log/zabbix/ssl
sudo chmod 750 /var/log/zabbix/ssl

Add to zabbix_server.conf

echo "LogFile=/var/log/zabbix/ssl/zabbix_server.log" | sudo tee -a /etc/zabbix/zabbix_server.conf echo "LogFileSize=10" | sudo tee -a /etc/zabbix/zabbix_server.conf

You now have a fully encrypted Zabbix 7 monitoring setup with SSL-protected web interface, encrypted database connections, and secure agent communication. This configuration is now compatible with the comprehensive alerting setup covered in our Zabbix alerting tutorial, and can be extended with distributed monitoring using our Zabbix proxy configuration guide.

Next steps

Running this in production?

Want this handled for you? Setting up Zabbix SSL once is straightforward. Keeping certificates renewed, monitoring encrypted properly, and maintaining security compliance across environments is the harder part. See how we run infrastructure like this for European SaaS and e-commerce teams.

Automated install script

Run this to automate the entire setup

Need help?

Don't want to manage this yourself?

We handle infrastructure security hardening for businesses that depend on uptime. From initial setup to ongoing operations.