[comment]: # ({ef4f3c90-6cfe5a3b})
# 2 Cryptography

[comment]: # ({/ef4f3c90-6cfe5a3b})

[comment]: # ({0f9857da-4b448800})
#### Overview

This section contains best practices for setting up cryptography in a secure way.

[comment]: # ({/0f9857da-4b448800})

[comment]: # ({369e2c77-f8f5054e})
#### Setting up SSL for Zabbix frontend

On RHEL-based systems, install the `mod_ssl` package:

```bash
dnf install mod_ssl
```

Create a directory for SSL keys:

```bash
mkdir -p /etc/httpd/ssl/private
chmod 700 /etc/httpd/ssl/private
```

Create the SSL certificate:

```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/private/apache-selfsigned.key -out /etc/httpd/ssl/apache-selfsigned.crt
```

Fill out the prompts appropriately.
The most important line is the one that requests the `Common Name`.
You must enter the domain name you want to be associated with your server.
You can enter the public IP address instead if you do not have a domain name.

```ini
Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:example.com
Email Address []:
```

Edit the Apache SSL configuration file (`/etc/httpd/conf.d/ssl.conf`):

```ini
DocumentRoot "/usr/share/zabbix"
ServerName example.com:443
SSLCertificateFile /etc/httpd/ssl/apache-selfsigned.crt
SSLCertificateKeyFile /etc/httpd/ssl/private/apache-selfsigned.key
```

Restart the Apache service to apply the changes:

```bash
systemctl restart httpd.service
```

[comment]: # ({/369e2c77-f8f5054e})
