open_basedir issues when toggling "Chroot PHP-FPM"

Discussion in 'General' started by Hbod, Dec 20, 2019.

  1. Hbod

    Hbod Member

    Hi,

    looks like my open_basedir settings getting ignored when I toggle "Chroot PHP-FPM".

    I have a vHost subdomain inside /app/api/public. In order to get my Laravel setup working, I had to change "api" from "root:root" to client0:web10. Everything was working, but I had to edit the open_basedir and inclide "api" to it.

    Code:
    /var/www/clients/client0/web10/app/api:/var/www/clients/client0/web10/app/api/public:/var/www/clients/client0/web10/private:/var/www/clients/client0/web10/tmp:/var/www/my.domain.de/app/api/public:/srv/www/my.domain.de/app/api/public:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom
    But now, since I've activated chroot php-fpm, my PHP scripts are complaining (first issue was with timezonedb, but I fixed that with pecl). Now I get:
    Code:
     open_basedir restriction in effect. File(/var/www/clients/client0/web10/app/api/resources/views/errors/500.blade.php) is not within the allowed path(s): (/private:/tmp:/var/www/my.domain.de/app/api/public:/srv/www/my.domain.de/app/api/public:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom) in /app/api/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:23
    
    The values there don't reflect my actual settings, so I assume it is ignoring my entries. Is this fixable?
     
    Last edited: Dec 20, 2019
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I doubt that your settings are ignored, the more likely reason is that you settings are not valid for a chroot.

    It might be that the open_basedir paths must be relative to the chroot, so instead of:

    /var/www/clients/client0/web10/app/api

    you use

    /app/api

    Or it might even be that paths outside of web are completely disallowed, so you have to move app/api into web then.
     
  3. Hbod

    Hbod Member

    The issue is that Laravel resolves the PATH to /var/www/clients/client0/web10/app/api but as soon as I toggle the value, its getting translated to /var/www/domain.name.com/app
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, then that's in purpose of the chroot as the chroot is the web dir. So you can not use the chroot security feature unless you are able to reconfigure laravel.
     
  5. Hbod

    Hbod Member

    This is what's inside:

    Code:
    /var/www/clients/client0/web10/app/api:/var/www/clients/client0/web10/app/api/public:/var/www/clients/client0/web10/private:/var/www/clients/client0/web10/tmp:/var/www/application.nummernschild.de/app/api:/var/www/my.domain.de/app/api/public:/srv/www/my.domain.de/app/api/public:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom
    And this are the paths in the error.

    Code:
    /app/api:/app/api/public:/private:/tmp:/var/www/my.domain.de/app/api:/var/www/my.domain.de/app/api/public:/srv/www/my.domain.de/app/api/public:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom
    As you can see, the values with clients/client0 are gone. Even though there are inside. So I think I need to change something on Laravel to get the right path.
     

Share This Page