From 5628984d6cd5a79b2dbaa3cdccdacea17f47521b Mon Sep 17 00:00:00 2001 From: Stefan Baas Date: Mon, 9 Aug 2021 16:18:40 +0200 Subject: [PATCH 1/2] Added selinux ldap booleon --- idoit-install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/idoit-install b/idoit-install index 6f820e3..a5d6adc 100755 --- a/idoit-install +++ b/idoit-install @@ -1147,6 +1147,10 @@ EOF abort "Unable to give read permissions recursively" chcon -t httpd_sys_rw_content_t "${INSTALL_DIR}/" -R || \ abort "Unable to give write permissions recursively" + + log "SELinux: Allow Apache to use PHP-LDAP" + setsebool -P httpd_can_connect_ldap on || \ + abort "Unable to set sebool to true" ## mpm_event is already enabled on RHEL 8: if [[ "$OS" != "rhel8" ]]; then From 7ab7a8180c0f0213ac5985ce595c494cfebefa9e Mon Sep 17 00:00:00 2001 From: sirbaas <54206898+sirbaas@users.noreply.github.com> Date: Sun, 25 Dec 2022 15:06:54 +0100 Subject: [PATCH 2/2] Update idoit-install Added if statement based on https://www.thegeekdiary.com/how-to-check-whether-selinux-is-enabled-or-disabled/ --- idoit-install | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/idoit-install b/idoit-install index a5d6adc..f789a54 100755 --- a/idoit-install +++ b/idoit-install @@ -1142,11 +1142,17 @@ EOF chown "$APACHE_USER":"$APACHE_GROUP" -R "${INSTALL_DIR}/" || \ abort "Unable to change ownership" - log "SELinux: Allow Apache Web server to read/write files under ${INSTALL_DIR}/" - chcon -t httpd_sys_content_t "${INSTALL_DIR}/" -R || \ - abort "Unable to give read permissions recursively" - chcon -t httpd_sys_rw_content_t "${INSTALL_DIR}/" -R || \ - abort "Unable to give write permissions recursively" + log "Check if selinux is enabled" + if [ $? -ne 0 ] + then + log "selinux is disable" + else + log "SELinux: Allow Apache Web server to read/write files under ${INSTALL_DIR}/" + chcon -t httpd_sys_content_t "${INSTALL_DIR}/" -R || \ + abort "Unable to give read permissions recursively" + chcon -t httpd_sys_rw_content_t "${INSTALL_DIR}/" -R || \ + abort "Unable to give write permissions recursively" + fi log "SELinux: Allow Apache to use PHP-LDAP" setsebool -P httpd_can_connect_ldap on || \