*

morfik

  • ****
  • 169 posts
Google Login Plugin: allow user to specify the TMP dir.
« on: March 03, 2023, 05:25:22 PM »
When I was testing the the Google Login Plugin, I noticed the following warnings in my server logs:

Code: [Select]
PHP Warning:  file_exists(): open_basedir restriction in effect.
    File(/tmp/Google_Client/62/6201104e2d7bc73dc749e196eb0c344b) is not within the allowed path(s):
    (/var/www/html/osclass:/php-temp/my-website/:/usr/share/php/:/usr/share/javascript/) in
    /var/www/html/osclass/oc-content/plugins/google_login/src/cache/Google_FileCache.php on line 96,
    referer: https://accounts.google.com/

The warning is s result of having the following config in my Apache2 server:

Code: [Select]
        <IfModule mod_php7.c>
            php_admin_value upload_tmp_dir /php-temp/my-website/tmp/
            php_admin_value open_basedir /var/www/html/osclass/:/php-temp/my-website/:/usr/share/php/:/usr/share/javascript/
        </IfModule>

I don't really like the /tmp/ dir, that's why I wanted to change it to /php-temp/my-website/ dir which is unique for any webpage I want to host on my server -- it helps with apparmor policy.

There's the plugins/google_login/src/config.php file, and the following code in it:

Code: [Select]
    // IO Class dependent configuration, you only have to configure the values
    // for the class that was configured as the ioClass above
    'ioFileCache_directory'  =>
        (function_exists('sys_get_temp_dir') ?
            sys_get_temp_dir() . '/Google_Client' :
        '/tmp/Google_Client'),

I tried to change this /Google_Client or /tmp/Google_Client to my /php-temp/my-website/Google_Client , but it always was /tmp/...

So I changed the above code to the following:
Code: [Select]
    'ioFileCache_directory'  => '/php-temp/my-website/Google_Client',
This helped, but I think users should be able to customize this TMP dir because in shared hosting, you are unable to change the open_basedir directive.

Also I've read about disabling cache for Google Login Plugin, which also could be the option to solve the issue.

*

MB Themes

Re: Google Login Plugin: allow user to specify the TMP dir.
« Reply #1 on: March 04, 2023, 09:09:38 AM »
I have never seen that plugin would create temp directory, thats weird.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: Google Login Plugin: allow user to specify the TMP dir.
« Reply #2 on: March 04, 2023, 09:23:13 AM »
But apparently it does. :)