Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a 403 forbidden error for simplesaml after Apache upgrade

My simplesaml was working perfectly until I upgraded Apache to 2.4.6 on Ubuntu

The error I was getting :

Forbidden

You don't have permission to access /simplesaml/ on this server.
like image 411
Russell England Avatar asked Apr 28 '14 09:04

Russell England


People also ask

Why do I keep seeing 403 Forbidden?

The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it. This status is similar to 401 , but for the 403 Forbidden status code re-authenticating makes no difference.


2 Answers

The instructions for installing simplesamlphp on Apache only require an alias for the simplesamlphp directory :

https://simplesamlphp.org/docs/stable/simplesamlphp-install#section_6

But for Apache 2.4.6+ the security has changed - it worked for me when I added a Directory directive. eg:

<VirtualHost *:80>
    ServerName mywebsite.dev
    DocumentRoot /home/myuser/www/mywebsite/

    <Directory /home/myuser/www/mywebsite/>
        Require all granted
    </Directory>

    Alias /simplesaml /var/simplesamlphp/www

    <Directory /var/simplesamlphp/www/>
        Require all granted
    </Directory>

</VirtualHost>
like image 148
Russell England Avatar answered Sep 18 '22 16:09

Russell England


While the chosen answer is correct I would like to add that SELinux can also cause this error. It took me a couple hours to realize that was my problem after following tons of examples online.

If you are running SELinux make sure you run the following command:

chcon -R --reference=/var/www /var/simplesamlphp

This will place the /var/simplesamlphp directory in the same security context as /var/www. You can't just place the /var/simplesamlphp/www directory in the same context because _include.php accesses files in /var/simplesamlphp/lib.

I hope this prevents someone from spending as much time on this problem as I did.

like image 32
sud0 Avatar answered Sep 17 '22 16:09

sud0