Skip to content

Commit 0e352ef

Browse files
docs: update SSL config with ECDSA keys, TLS 1.2+, Let's Encrypt
Refs Cacti#220 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
1 parent ed4c330 commit 0e352ef

1 file changed

Lines changed: 124 additions & 25 deletions

File tree

Cacti-SSL-Configuration.md

Lines changed: 124 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,142 @@
1-
# Configuring and enabling SSL for Cacti with a self signed certificate
1+
# Configuring SSL for Cacti
22

3-
Enabling SSL for Cacti is mostly done at the webserver level. An example SSL
4-
config for HTTP is as follows:
3+
Enabling HTTPS for Cacti is done at the web server level. This page covers
4+
self-signed certificates for internal use and Let's Encrypt for public-facing
5+
servers.
56

6-
```bash
7-
yum install -y mod_ssl -y
8-
openssl genrsa -out ca.key 2048
9-
openssl req -new -key ca.key -out ca.csr
10-
openssl x509 -req -days 700 -in ca.csr -signkey ca.key -out ca.crt
11-
cp ca.crt /etc/pki/tls/certs
12-
cp ca.key /etc/pki/tls/private/ca.key
13-
cp ca.csr /etc/pki/tls/private/ca.csr
7+
> **Note**: If using multiple Data Collectors, all must have HTTPS enabled for
8+
> the remote polling feature to work correctly.
149
10+
## Self-Signed Certificate (Internal Use)
11+
12+
Self-signed certificates are suitable for internal networks where you control
13+
the clients. Use ECDSA (secp384r1) for best performance, or RSA 4096 if your
14+
environment requires RSA.
15+
16+
### ECDSA (recommended)
17+
18+
```shell
19+
# RHEL/Rocky/AlmaLinux
20+
dnf install -y mod_ssl
21+
22+
# Generate a 384-bit EC private key and self-signed certificate (valid 3 years)
23+
openssl req -x509 -nodes -newkey ec -pkeyopt ec_paramgen_curve:P-384 \
24+
-keyout /etc/pki/tls/private/cacti.key \
25+
-out /etc/pki/tls/certs/cacti.crt \
26+
-days 1095 \
27+
-subj "/CN=cacti.example.com" \
28+
-addext "subjectAltName=DNS:cacti.example.com"
29+
30+
chmod 600 /etc/pki/tls/private/cacti.key
1531
```
1632

17-
Then we need to update the Apache SSL configuration file:
33+
### RSA (alternative)
34+
35+
```shell
36+
# 4096-bit RSA — use when EC is not supported by your TLS client pool
37+
openssl req -x509 -nodes -newkey rsa:4096 \
38+
-keyout /etc/pki/tls/private/cacti.key \
39+
-out /etc/pki/tls/certs/cacti.crt \
40+
-days 1095 \
41+
-subj "/CN=cacti.example.com" \
42+
-addext "subjectAltName=DNS:cacti.example.com"
1843

19-
```ini
20-
vi +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf
21-
SSLCertificateFile /etc/pki/tls/certs/ca.crt
22-
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
44+
chmod 600 /etc/pki/tls/private/cacti.key
2345
```
2446

25-
Restart the httpd service:
47+
> **Key size**: RSA 2048-bit is below NIST SP 800-131A Rev 2 guidance for
48+
> long-term use. Use 4096-bit RSA or an ECDSA key.
49+
50+
## Apache Configuration
51+
52+
Update `/etc/httpd/conf.d/ssl.conf` (RHEL/Rocky/AlmaLinux) or
53+
`/etc/apache2/sites-available/cacti-ssl.conf` (Debian/Ubuntu):
2654

27-
```bash
28-
systemctl restart httpd
55+
```apache
56+
<VirtualHost *:443>
57+
ServerName cacti.example.com
58+
DocumentRoot /var/www/html/cacti
59+
60+
SSLEngine on
61+
# RHEL/Rocky/AlmaLinux cert paths:
62+
# SSLCertificateFile /etc/pki/tls/certs/cacti.crt
63+
# SSLCertificateKeyFile /etc/pki/tls/private/cacti.key
64+
# Debian/Ubuntu cert paths:
65+
SSLCertificateFile /etc/ssl/certs/cacti.crt
66+
SSLCertificateKeyFile /etc/ssl/private/cacti.key
67+
68+
# Require TLS 1.2 or 1.3; TLS 1.0 and 1.1 are prohibited (RFC 8996)
69+
SSLProtocol -all +TLSv1.2 +TLSv1.3
70+
71+
# TLS 1.2 cipher suites -- no RC4, 3DES, or export ciphers
72+
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:\
73+
ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:\
74+
ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305
75+
SSLHonorCipherOrder on
76+
77+
# TLS 1.3 cipher suites (SSLCipherSuite does not apply to TLS 1.3)
78+
SSLOpenSSLConfCmd Ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
79+
</VirtualHost>
80+
81+
# Optional: redirect HTTP to HTTPS (uncomment to enable)
82+
#<VirtualHost *:80>
83+
# ServerName cacti.example.com
84+
# Redirect permanent / https://cacti.example.com/
85+
#</VirtualHost>
2986
```
3087

31-
After configuring the web server to accept https, you can enable https in the
32-
GUI
88+
Restart Apache after editing:
3389

34-
---
90+
```shell
91+
apachectl configtest
92+
systemctl restart httpd # RHEL/Rocky/AlmaLinux
93+
systemctl restart apache2 # Debian/Ubuntu
94+
```
3595

36-
**Note**: if using multiple pollers, all must have HTTPS enabled for the remote polling feature to work properly.
96+
## Let's Encrypt (Public-Facing Servers)
3797

38-
---
98+
For servers reachable from the internet, use Let's Encrypt for a
99+
browser-trusted certificate at no cost.
39100

40-
**Note**: If your Cacti system is public, it is recommended to get a certificate from a trusted certificate provider.
101+
### RHEL/Rocky/AlmaLinux
102+
103+
```shell
104+
dnf install -y certbot python3-certbot-apache
105+
certbot --apache -d cacti.example.com
106+
```
107+
108+
### Debian/Ubuntu
109+
110+
```shell
111+
apt-get install -y certbot python3-certbot-apache
112+
certbot --apache -d cacti.example.com
113+
```
114+
115+
Certbot configures Apache and sets up automatic renewal. Verify auto-renewal
116+
works:
117+
118+
```shell
119+
certbot renew --dry-run
120+
```
121+
122+
## Verifying the Configuration
123+
124+
After restarting Apache, confirm TLS is working and that weak protocols are
125+
disabled:
126+
127+
```shell
128+
# Check the certificate and protocol support
129+
openssl s_client -connect cacti.example.com:443 -tls1_2 < /dev/null
130+
openssl s_client -connect cacti.example.com:443 -tls1 < /dev/null # should fail
131+
```
132+
133+
For a comprehensive scan, use [SSL Labs](https://www.ssllabs.com/ssltest/) on
134+
public servers or `testssl.sh` on internal hosts:
135+
136+
```shell
137+
# testssl.sh (download from https://testssl.sh/)
138+
./testssl.sh cacti.example.com
139+
```
41140

42141
---
43142

0 commit comments

Comments
 (0)