Skip to content

Commit 634dbdf

Browse files
docs: fix SELinux policy guidance and add CentOS EOL notices
Replace the bare "disable temporarily" advice in the CentOS LAMP and LEMP install guides with actionable SELinux policy steps for Cacti: - setsebool httpd_can_network_connect + httpd_can_network_connect_db - semanage fcontext / restorecon for non-default install paths - link to current RHEL 9 SELinux docs (replaces broken CentOS link) - fix malformed URL: https:////wiki.centos.org → RHEL docs Add CentOS EOL notices to both guides: CentOS 7 EOL June 2024, CentOS 8 EOL December 2021. Direct users to Rocky Linux / AlmaLinux as binary-compatible RHEL rebuilds. Refs Cacti#208 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
1 parent ed4c330 commit 634dbdf

2 files changed

Lines changed: 68 additions & 30 deletions

File tree

Install-Under-CentOS_LAMP.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Installing on CentOS/RHEL/ROCKY
1+
# Installing on CentOS/RHEL/Rocky Linux/AlmaLinux
2+
3+
> **Note:** CentOS Linux reached end-of-life on June 30, 2024 (CentOS 7) and December 31, 2021 (CentOS 8). New installations should use [Rocky Linux](https://rockylinux.org/) or [AlmaLinux](https://almalinux.org/), which are binary-compatible RHEL rebuilds. The commands in this guide apply to both.
24
35
> **Note**: As of Cacti 1.2.31, PHP 8.1 is required and PHP Composer is required.
46
> Composer will be used to ensure all of the libraries are installed and are up to date.
@@ -478,31 +480,50 @@ configure the basics for Cacti.
478480

479481
### Security Enhanced Linux (SELinux)
480482

481-
If you are having issues to access the web page, disable SELinux temporarily to
482-
prove that the issues come from the SELinux policy. It is NOT recommended to
483-
disable SELinux permanently.
483+
If you suspect SELinux is blocking Cacti, disable it temporarily to confirm, then re-enable it and apply the correct policy rather than leaving it disabled.
484484

485-
[CentOS](https:////wiki.centos.org/es/HowTos/SELinux) has a lot of
486-
documentation on how to make your SELinux policy right.
485+
The [RHEL SELinux documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/using_selinux/) covers policy management in depth and applies equally to Rocky Linux and AlmaLinux.
487486

488487
1. Check SELinux status
489488

490489
```console
491490
getenforce
492491
```
493492

494-
2. Disable SELinux temporarily
493+
2. Disable SELinux temporarily for testing
495494

496495
```console
497496
setenforce 0
498497
```
499498

500-
3. Enable SELinux back
499+
3. Re-enable SELinux
501500

502501
```console
503502
setenforce 1
504503
```
505504

505+
4. Configure SELinux booleans for Cacti
506+
507+
Cacti requires two booleans so Apache can reach the database and make outbound SNMP connections during polling:
508+
509+
```console
510+
setsebool -P httpd_can_network_connect 1
511+
setsebool -P httpd_can_network_connect_db 1
512+
```
513+
514+
5. Set file contexts (only needed if Cacti is outside `/var/www/html`)
515+
516+
If you installed Cacti to a non-default path, apply the correct SELinux file contexts. Replace `/path/to/cacti` with your actual install path:
517+
518+
```console
519+
semanage fcontext -a -t httpd_sys_content_t "/path/to/cacti(/.*)?"
520+
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/cacti/rra(/.*)?"
521+
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/cacti/log(/.*)?"
522+
restorecon -Rv /path/to/cacti
523+
```
524+
525+
These labels grant Apache read access to Cacti's files and write access to the RRD and log directories. Without `httpd_sys_rw_content_t` on `rra/` and `log/`, graph generation silently fails even when UNIX permissions appear correct.
526+
506527
### Considerations when using Proxies in front of Cacti (Cacti 1.2.23+)
507528

508529
For optimal security, only specify the HTTP headers that are set by your proxy
@@ -536,8 +557,7 @@ These can be set by editing the following section of config.php
536557
$proxy_headers = null;
537558
```
538559

539-
**Note:** If you installed Cacti out of `/var/www/html` make sure you fix up
540-
all SELinux context and permissions.
560+
**Note:** If you installed Cacti outside `/var/www/html`, run the `semanage fcontext` and `restorecon` commands from step 5 of the SELinux section above to apply the correct file contexts.
541561

542562
---
543563
Copyright (c) 2004-2026 The Cacti Group

Install-Under-CentOS_LEMP.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Installing on CentOS 7
1+
# Installing on CentOS/RHEL/Rocky Linux/AlmaLinux (LEMP)
2+
3+
> **Note:** CentOS Linux reached end-of-life on June 30, 2024 (CentOS 7) and December 31, 2021 (CentOS 8). New installations should use [Rocky Linux](https://rockylinux.org/) or [AlmaLinux](https://almalinux.org/), which are binary-compatible RHEL rebuilds. The commands in this guide apply to both.
24
35
> **Note**: As of Cacti 1.2.31, PHP 8.1 is required and PHP Composer is required.
46
> Composer will be used to ensure all of the libraries are installed and are up to date.
@@ -528,33 +530,49 @@ configure the basics for Cacti.
528530

529531
### Security Enhanced Linux (SELinux)
530532

531-
If you are having issues to access the web page, disable SELinux temporarily to
532-
prove that the issues come from the SELinux policy. It is NOT recommended to
533-
disable SELinux permanently.
533+
If you suspect SELinux is blocking Cacti, disable it temporarily to confirm, then re-enable it and apply the correct policy rather than leaving it disabled.
534534

535-
[CentOS](https:////wiki.centos.org/es/HowTos/SELinux) has a lot of documentation
536-
on how to make your SELinux policy right.
535+
The [RHEL SELinux documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/using_selinux/) covers policy management in depth and applies equally to Rocky Linux and AlmaLinux.
537536

538-
Check SELinux status
537+
1. Check SELinux status
539538

540-
```console
541-
getenforce
542-
```
539+
```console
540+
getenforce
541+
```
543542

544-
Disable SELinux temporarily
543+
2. Disable SELinux temporarily for testing
545544

546-
```console
547-
setenforce 0
548-
```
545+
```console
546+
setenforce 0
547+
```
549548

550-
Enable SELinux back
549+
3. Re-enable SELinux
551550

552-
```console
553-
setenforce 1
554-
```
551+
```console
552+
setenforce 1
553+
```
554+
555+
4. Configure SELinux booleans for Cacti
556+
557+
Cacti requires two booleans so Nginx/PHP-FPM can reach the database and make outbound SNMP connections during polling:
558+
559+
```console
560+
setsebool -P httpd_can_network_connect 1
561+
setsebool -P httpd_can_network_connect_db 1
562+
```
563+
564+
5. Set file contexts (only needed if Cacti is outside `/usr/share/nginx/html`)
565+
566+
If you installed Cacti to a non-default path, apply the correct SELinux file contexts. Replace `/path/to/cacti` with your actual install path:
567+
568+
```console
569+
semanage fcontext -a -t httpd_sys_content_t "/path/to/cacti(/.*)?"
570+
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/cacti/rra(/.*)?"
571+
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/cacti/log(/.*)?"
572+
restorecon -Rv /path/to/cacti
573+
```
555574

556-
**Note:** If you installed Cacti out of `/usr/share/nginx/html` make sure you
557-
fix up all SELinux context and permissions.
575+
These labels grant the web server read access to Cacti's files and write access to the RRD and log directories. Without `httpd_sys_rw_content_t` on `rra/` and `log/`, graph generation silently fails even when UNIX permissions appear correct.
558576

559577
---
560578

0 commit comments

Comments
 (0)