SELinux and LDAP #1442

Closed
opened 2026-02-05 00:54:30 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @okwindart on GitHub (Nov 4, 2019).

BookStack is running great in CentOS 7 and Active Directory for login. The only issue I am running into is I have to disable SELinux in order to get LDAP to communicate with Active Directory. How can I have both SELinux enabled and LDAP working with AD as well? Basically, I want to have my cake and eat it too :)

I have tried some online suggestions but so far nothing has worked.

Any feedback would be appreciated!

Originally created by @okwindart on GitHub (Nov 4, 2019). BookStack is running great in CentOS 7 and Active Directory for login. The only issue I am running into is I have to disable SELinux in order to get LDAP to communicate with Active Directory. How can I have both SELinux enabled and LDAP working with AD as well? Basically, I want to have my cake and eat it too :) I have tried some online suggestions but so far nothing has worked. Any feedback would be appreciated!
Author
Owner

@Mant1kor commented on GitHub (Nov 5, 2019):

@okwindart
Use my installation script for fresh install, or this commands to configure SELinux

BOOKSTACK_DIR="/insert/path/to/bookstack_dir" 
# Example: BOOKSTACK_DIR="/var/www/bookstack"
# allow send emails
setsebool -P httpd_can_sendmail 1
# allow redirect authorization for LDAP
setsebool -P httpd_can_network_connect 1
# Configure folders SELinux context
semanage fcontext -a -t httpd_sys_rw_content_t "${BOOKSTACK_DIR}/public/uploads(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "${BOOKSTACK_DIR}/storage(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "${BOOKSTACK_DIR}/bootstrap/cache(/.*)?"
restorecon -R "$BOOKSTACK_DIR"
@Mant1kor commented on GitHub (Nov 5, 2019): @okwindart Use [my installation script](https://github.com/Mant1kor/devops/blob/master/scripts/installation-CentOS-7.sh) for fresh install, or this commands to configure SELinux ```bash BOOKSTACK_DIR="/insert/path/to/bookstack_dir" # Example: BOOKSTACK_DIR="/var/www/bookstack" # allow send emails setsebool -P httpd_can_sendmail 1 # allow redirect authorization for LDAP setsebool -P httpd_can_network_connect 1 # Configure folders SELinux context semanage fcontext -a -t httpd_sys_rw_content_t "${BOOKSTACK_DIR}/public/uploads(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "${BOOKSTACK_DIR}/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "${BOOKSTACK_DIR}/bootstrap/cache(/.*)?" restorecon -R "$BOOKSTACK_DIR" ```
Author
Owner

@okwindart commented on GitHub (Nov 8, 2019):

@Mant1kor Thanks.

A bit confused about your script. I actually used your install script when I first setup BookStack on CentOS. However, I had to disable SELinux in order to get httpd to work with LDAP.

Without doing another fresh install, how do I run these commands? Especially the "BOOKSTACK_DIR" (first line) you sent is what I am confused about.

Thank.

@okwindart commented on GitHub (Nov 8, 2019): @Mant1kor Thanks. A bit confused about your script. I actually used your install script when I first setup BookStack on CentOS. However, I had to disable SELinux in order to get httpd to work with LDAP. Without doing another fresh install, how do I run these commands? Especially the "BOOKSTACK_DIR" (first line) you sent is what I am confused about. Thank.
Author
Owner

@Mant1kor commented on GitHub (Nov 9, 2019):

@okwindart you can run the commands in command line one by one. If you only need to get httpd to work with LDAP just run:
sudo setsebool -P httpd_can_network_connect 1
BOOKSTACK_DIR - is variable to set BookStack root folder. If you used my script for fresh installation it should be:
BOOKSTACK_DIR="/var/www/bookstack"

@Mant1kor commented on GitHub (Nov 9, 2019): @okwindart you can run the commands in command line one by one. If you only need to get httpd to work with LDAP just run: `sudo setsebool -P httpd_can_network_connect 1` BOOKSTACK_DIR - is variable to set BookStack root folder. If you used my script for fresh installation it should be: `BOOKSTACK_DIR="/var/www/bookstack" `
Author
Owner

@okwindart commented on GitHub (Nov 9, 2019):

Thanks, @okwindart

Do I first need to enable SELinux in the the config file before I run your script? It is currently disabled. This is how my config file looks now.

image

@okwindart commented on GitHub (Nov 9, 2019): Thanks, @okwindart Do I first need to enable SELinux in the the config file before I run your script? It is currently disabled. This is how my config file looks now. ![image](https://user-images.githubusercontent.com/46505131/68510607-96865980-0239-11ea-985c-49b0168fa8e0.png)
Author
Owner

@Mant1kor commented on GitHub (Nov 9, 2019):

Do I first need to enable SELinux in the the config file before I run your script?

Yes, enable it first, then reboot and run command(s).

@Mant1kor commented on GitHub (Nov 9, 2019): > Do I first need to enable SELinux in the the config file before I run your script? Yes, enable it first, then reboot and run command(s).
Author
Owner

@okwindart commented on GitHub (Nov 9, 2019):

OK. When I do that, I get a doublescreen like this:

image

Here is the command I ran:
image

image

@okwindart commented on GitHub (Nov 9, 2019): OK. When I do that, I get a doublescreen like this: ![image](https://user-images.githubusercontent.com/46505131/68512408-f0891e00-023d-11ea-84ca-4f59f69bda8c.png) Here is the command I ran: ![image](https://user-images.githubusercontent.com/46505131/68512459-16162780-023e-11ea-9519-f535ccdf2c4e.png) ![image](https://user-images.githubusercontent.com/46505131/68512519-42ca3f00-023e-11ea-8740-1c54062b816b.png)
Author
Owner

@Mant1kor commented on GitHub (Nov 9, 2019):

Check /var/log/audit/audit.log or /var/log/audit.log for details.

@Mant1kor commented on GitHub (Nov 9, 2019): Check `/var/log/audit/audit.log` or `/var/log/audit.log` for details.
Author
Owner

@ssddanbrown commented on GitHub (Nov 15, 2019):

Thanks @Mant1kor for providing assistance here.

@ssddanbrown commented on GitHub (Nov 15, 2019): Thanks @Mant1kor for providing assistance here.
Author
Owner

@ssddanbrown commented on GitHub (Dec 12, 2020):

Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed please open a new issue, referencing this one.

@ssddanbrown commented on GitHub (Dec 12, 2020): Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed please open a new issue, referencing this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1442