Control Web Panel

WebPanel => CentOS-WebPanel Bugs => Topic started by: NychosX on June 21, 2024, 03:43:27 PM

Title: CWP pro user login error
Post by: NychosX on June 21, 2024, 03:43:27 PM
Hello,
I hope someone could help me, since monday I can't login to any existing user panel, I always get an HTTP 500 error and this error in the log:

Code: [Select]
2024/06/21 17:27:07 [error] 947#0: *13228 FastCGI sent in stderr: "PHP message: PHP Warning:  main(): open_basedir restriction in effect. File(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php) is not within the allowed path(s): (/home/gep:/tmp:/usr/local/cwpsrv/var/services/users:/usr/local/cwpsrv/var/services/twig/:) in /usr/local/cwpsrv/var/services/users/index.php on line 0
PHP message: PHP Warning:  main(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php): failed to open stream: Operation not permitted in /usr/local/cwpsrv/var/services/users/index.php on line 0
PHP message: PHP Warning:  main(): open_basedir restriction in effect. File(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/classes/CWPAuth.php) is not within the allowed path(s): (/home/gep:/tmp:/usr/local/cwpsrv/var/services/users:/usr/local/cwpsrv/var/services/twig/:) in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php on line 0
PHP message: PHP Warning:  main(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/classes/CWPAuth.php): failed to open stream: Operation not permitted in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php on line 0
PHP message: PHP Fatal error:  main(): Failed opening required '/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/classes/CWPAuth.php' (include_path='.:/usr/local/cwp/php71/lib/php') in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php on line 0" while reading response header from upstream, client: 79.60.165.171, server: localhost, request: "POST /gep/ HTTP/1.1", upstream: "fastcgi://unix:/usr/local/cwp/php71/var/sockets/gep.sock:", host: "zeus.kiway.it:2083", referrer: "https://zeus.kiway.it:2083/login/?acc=logon"

If I create a new user the login works for it.

I already followed every guide on this forum or online but with no luck =(

Anyone is facing the same issue?

Thank you
Title: Re: CWP pro user login error
Post by: vnet on June 22, 2024, 11:53:54 AM
Hello,
I hope someone could help me, since monday I can't login to any existing user panel, I always get an HTTP 500 error and this error in the log:

Code: [Select]
2024/06/21 17:27:07 [error] 947#0: *13228 FastCGI sent in stderr: "PHP message: PHP Warning:  main(): open_basedir restriction in effect. File(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php) is not within the allowed path(s): (/home/gep:/tmp:/usr/local/cwpsrv/var/services/users:/usr/local/cwpsrv/var/services/twig/:) in /usr/local/cwpsrv/var/services/users/index.php on line 0
PHP message: PHP Warning:  main(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php): failed to open stream: Operation not permitted in /usr/local/cwpsrv/var/services/users/index.php on line 0
PHP message: PHP Warning:  main(): open_basedir restriction in effect. File(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/classes/CWPAuth.php) is not within the allowed path(s): (/home/gep:/tmp:/usr/local/cwpsrv/var/services/users:/usr/local/cwpsrv/var/services/twig/:) in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php on line 0
PHP message: PHP Warning:  main(/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/classes/CWPAuth.php): failed to open stream: Operation not permitted in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php on line 0
PHP message: PHP Fatal error:  main(): Failed opening required '/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/classes/CWPAuth.php' (include_path='.:/usr/local/cwp/php71/lib/php') in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/CWPUserIndex.php on line 0" while reading response header from upstream, client: 79.60.165.171, server: localhost, request: "POST /gep/ HTTP/1.1", upstream: "fastcgi://unix:/usr/local/cwp/php71/var/sockets/gep.sock:", host: "zeus.kiway.it:2083", referrer: "https://zeus.kiway.it:2083/login/?acc=logon"

If I create a new user the login works for it.

I already followed every guide on this forum or online but with no luck =(

Anyone is facing the same issue?

Thank you

Error Analysis

The error message indicates that PHP is trying to access files located in /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/, but these paths are not allowed according to the open_basedir settings configured in PHP. This restriction is in place to enhance security by limiting which files PHP scripts can access on the server.

1. Check open_basedir Configuration:

2. Locate PHP-FPM Configuration File:

3.Edit PHP-FPM Configuration:

Open the PHP-FPM configuration file (e.g., example.conf) with a text editor
Code: [Select]
sudo nano /etc/php-fpm.d/example.conf
4.Update open_basedir Directive:

Locate the php_admin_value[open_basedir] directive within the file. It might look something like this:
Code: [Select]
php_admin_value[open_basedir] = /home/gep:/tmp:/usr/local/cwpsrv/var/services/users:/usr/local/cwpsrv/var/services/twig/:/usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/
Ensure that /usr/local/cwpsrv/var/services/user_files/modules/cwp_framework/ (and any other relevant directories) is included in the open_basedir directive.
5. Restart php-fpm
Code: [Select]
sudo systemctl restart php-fpm

Test by attempting to log in to the existing user panels again. The HTTP 500 error and the PHP warnings should no longer appear if the open_basedir settings are correctly configured.

Additional Considerations
Security Implications: Be cautious when adjusting open_basedir as it directly affects PHP's ability to access files. Only include directories that are necessary for your application to function.

Backup: Before making changes, consider backing up your PHP-FPM configuration file to revert changes if necessary.
Title: Re: CWP pro user login error
Post by: josemnunez on June 22, 2024, 12:38:51 PM
Hi
Please run the following scripts

Code: [Select]
sh /scripts/cron_fix_openbasedir
sh /scripts/cwpsrv_rebuild_user_conf

This will solve the problem for you
Title: Re: CWP pro user login error
Post by: NychosX on June 24, 2024, 07:26:29 AM
Hi
Please run the following scripts

Code: [Select]
sh /scripts/cron_fix_openbasedir
sh /scripts/cwpsrv_rebuild_user_conf

This will solve the problem for you

Thank you josemnunez, you are my saviour!!  :D