Control Web Panel

WebPanel => Problems on other RedHat linux servers => Topic started by: iraqiboy90 on December 16, 2021, 08:24:41 PM

Title: PHP Defender nowhere to be found
Post by: iraqiboy90 on December 16, 2021, 08:24:41 PM
Hello

I'm in the process of figuring out this panel and its features. One of the most important features for me is Snuffleupagus. I have installed mod_security, though i don't like it as I know it will conflict with some wordpress plugins, I do prefer the aforementioned plugin which is named PHP Defender in CWP.

Snuffleupagus is only mentioned once through the entire panel, here:
https://i.gyazo.com/464479513ca25e09610216acbea39b92.png

I can't find how to get it installed through CWP. I don't want to manually install it.

I currently don't have the CWP pro
I'm running Centos 8 Stream with the delayed repos.
Title: Re: PHP Defender nowhere to be found
Post by: Netino on December 16, 2021, 11:33:46 PM
Yes, it is installed in panel, "Security" >> "Security Center".
It is simply installed choosing "Basic", "Intermediate" or "Advanced" levels.
Simply by clicking on "install" and that's it.

You must have login on the panel to see that.

(While reading your post, I installed in two servers, it is just very simple)

Regards,
Netino
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on December 17, 2021, 10:53:47 AM
Where is it?

(https://i.gyazo.com/55ab3691db55d9858aec96786e4bc0c3.gif)
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on December 17, 2021, 12:32:38 PM
I'd like to add, that I've already installed php 7.4.26 through the main version switcher.
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on December 18, 2021, 03:12:38 PM
I just found out that it doesnt work with the free version of CWP
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 04, 2022, 11:53:25 AM
it does not work in the paid one either !! Unfortunately, it is common with CWP (Pro) that so "often" things suddenly stop working. The aim is to boost pay support.

Je li to sada toliko uobičajeno u ZAGREBU?
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 04, 2022, 12:19:54 PM
the PHP Defender is only available for PHP CGI and PHP-FPM. These two PHP types are only available with the pro version.
If you got the pro version, install one of these types of PHP >v7.0 and it will appear.
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 05, 2022, 11:41:26 AM
Sorry we have 20x Pro installed and Php v 7.4. It was there before the update and has now disappeared, can no longer be installed! However thank you for your help.
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 05, 2022, 04:27:31 PM
care to run this command on the php7 fpm with broken PHP Defender and post the result here?
Code: [Select]
sudo /opt/alt//php-fpm74/usr/sbin/php-fpm -m
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 06, 2022, 02:12:07 AM
[PHP Modules]
apcu
bcmath
bz2
calendar
cgi-fcgi
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
imap
intl
ionCube Loader
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
the ionCube PHP Loader + ionCube24

open_basedir: /home:/tmp:/var/tmp:
memcache
redis

are installed
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 06, 2022, 07:52:31 PM
On a unrelated note or maybe it is... The Open_basedir should be
Code: [Select]
/home/USERNAME:/tmp if you did use exactly my command which is PHP-FPM 7.4.

Also, the Snuffleupagus module seems to be missing from the list. As a comparison, it's on my module list for PHP-FPM 7.4 modules.

Double check this to see if it's enabled, if it was enabled before:
Code: [Select]
/opt/alt/php-fpm74/usr/php/php.d/snuffleupagus.iniCheck here if the module actually exist:
Code: [Select]
/opt/alt/php-fpm74/usr/lib/php/extensions/no-debug-non-zts-20210902/If the .so file is there but the ini file not there then just add the ini file and paste this and see if it works (after restarting php-fpm):
Code: [Select]
;Snuffleupagus LIB
;defender_mode=custom
extension=snuffleupagus.so
sp.configuration_file=/opt/alt/php-fpm74/usr/php/snuffleupagus.rules

If the .so file is not there then read on...

You can try this, but at your own risk that there is a chance you may end up reinstalling php fpm if this breaks it.

Code: [Select]
cp -rp /usr/local/cwp/.conf/phpdefender/snuffleupagus-master /usr/local/cwp/.conf/phpdefender/snuffleupagus-master_BACKUP
cd /usr/local/cwp/.conf/phpdefender/snuffleupagus-master/src
/opt/alt/php-fpm74/usr/bin/phpize
chmod +x configure
./configure --with-php-config=/opt/alt/php-fpm74/usr/bin/php-config
make && make install
vi /opt/alt/php-fpm74/usr/php/php.d/snuffleupagus.ini
add the code mentioned above, restart php-fpm and check the security center to see if it appears there. Or at least in the module list.
If you get permission error with the phpize file, then it probably means that your php-fpm is disabled. This was the case with my test server because it doesnt have the pro version. I just had to "chmod +x" it to continue.

I have used the above commands to install suhosin on php-fpm56 as there wasnt an option to add it through CWP panel. I have just now tested to manually install snuffleupagus on a PHP-FPM version that is still installed on the test server (but disabled) and now it appears on the security center.
Title: Re: PHP Defender nowhere to be found
Post by: Netino on January 06, 2022, 09:21:12 PM
(..)
Code: [Select]
cp -rp /usr/local/cwp/.conf/phpdefender/snuffleupagus-master /usr/local/cwp/.conf/phpdefender/snuffleupagus-master_BACKUP
cd /usr/local/cwp/.conf/phpdefender/snuffleupagus-master/src
/opt/alt/php-fpm74/usr/bin/phpize
chmod +x configure
./configure --with-php-config=/opt/alt/php-fpm74/usr/bin/php-config
make && make install
vi /opt/alt/php-fpm74/usr/php/php.d/snuffleupagus.ini
add the code mentioned above, restart php-fpm and check the security center to see if it appears there. Or at least in the module list.
If you get permission error with the phpize file, then it probably means that your php-fpm is disabled. This was the case with my test server because it doesnt have the pro version. I just had to "chmod +x" it to continue.

I have used the above commands to install suhosin on php-fpm56 as there wasnt an option to add it through CWP panel. I have just now tested to manually install snuffleupagus on a PHP-FPM version that is still installed on the test server (but disabled) and now it appears on the security center.

These steps are almost correct, I think, except one, that is used by CWP team to compile it:
Instead:
Code: [Select]
./configure --with-php-config=/opt/alt/php-fpm74/usr/bin/php-config

...use:
Code: [Select]
./configure --with-php-config=/opt/alt/php-fpm74/usr/bin/php-config --enable-snuffleupagus

They have an additional problem, at least in my installation: The logs cannot be viewed in CWP panel anymore, and CWP cannot anymore change any configuration in snuffleupagus, nor compile again snuffleupagus.
But I just didn't try to reinstall PHP-FPM to check if solves.
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 06, 2022, 09:25:10 PM
But I just didn't try to reinstall PHP-FPM to check if solves.

If you reinstall PHP, it will wipe everything, so it would not "solve" anything other than getting back a php-fpm without snuffleupagus
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 07, 2022, 07:16:32 AM
thanks for the help

The latter was only partially a success


Error: Defender logs entries
None entry was found in logs.


It is not possible to configure or, better, to select Basic, Intermediate, Extreme, not even to change it.

Modifying Defender mode does not work either.

I've now installed a fresh one on a VPS and a dedicated server as well as on a new host machine. It is the same for all three. So very simple standard installation.

As I write in other forum posts, we are more busy tinkering with CWP than with other panels. Even those that have already been installed are repeatedly changed and destroyed after updates. Can't that make sense of it all?

It quickly takes a rethink in the way CWP processes updates, i.e. testing beforehand and the repos must be reconsidered.
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 07, 2022, 07:22:26 AM

we make it easy for us.


Before publication, internal tests are carried out on a VPS and a dedicated server. If everything runs, it is loaded onto "a" repo, from this a real installation is carried out. Only if this goes smoothly will it actually be published! And not before. Everyone in our team tests each script independently and conscientiously before it goes online. This is how it should be at CWP. Because if I earn money with it, I have a responsibility to the customers !!!!!!!
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 07, 2022, 10:20:18 AM
it is of no use if it is not even there! During a NEW installation, I just noticed that it is not installed in the directory, nor is it pulled or installed by CWP install script or PHP phpize.

pcre is also not installed
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 07, 2022, 06:44:23 PM

we make it easy for us.


Before publication, internal tests are carried out on a VPS and a dedicated server. If everything runs, it is loaded onto "a" repo, from this a real installation is carried out. Only if this goes smoothly will it actually be published! And not before. Everyone in our team tests each script independently and conscientiously before it goes online. This is how it should be at CWP. Because if I earn money with it, I have a responsibility to the customers !!!!!!!

I totally agree.

I would test for you as well on my test server by reinstalling CWP, I would if I had an extra pro license. If only CWP offered licenses for a test server for beta testing..
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 07, 2022, 06:47:08 PM
it is of no use if it is not even there! During a NEW installation, I just noticed that it is not installed in the directory, nor is it pulled or installed by CWP install script or PHP phpize.

pcre is also not installed

Which OS is this?
Before I installed CWP on an actual VPS, I have already tested it on a vmware VPS. So, I have accumilated notes on what to do and in what order.

If the OS you're trying is Centos 8 STREAM, I can give you my notes to follow it or compare it with yours.
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 08, 2022, 01:03:46 PM
Yes it is CentOS Steam and AlmaLinux these are the two OS on which we have installed CWP.

Fortunately, we haven't changed the CentOS7 yet.

I have to say that we have some VPS and dedicated servers running with CWP. But think that each of your notes will help us. Thanks again!
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 08, 2022, 05:37:13 PM
Yes it is CentOS Steam and AlmaLinux these are the two OS on which we have installed CWP.

Fortunately, we haven't changed the CentOS7 yet.

I have to say that we have some VPS and dedicated servers running with CWP. But think that each of your notes will help us. Thanks again!

Just sent them in PM
Title: Re: PHP Defender nowhere to be found
Post by: iraqiboy90 on January 09, 2022, 03:19:43 PM
Code: [Select]
cp -rp /usr/local/cwp/.conf/phpdefender/snuffleupagus-master /usr/local/cwp/.conf/phpdefender/snuffleupagus-master_BACKUP
cd /usr/local/cwp/.conf/phpdefender/snuffleupagus-master/src
/opt/alt/php-fpm74/usr/bin/phpize
chmod +x configure
./configure --with-php-config=/opt/alt/php-fpm74/usr/bin/php-config
make && make install
vi /opt/alt/php-fpm74/usr/php/php.d/snuffleupagus.ini
add the code mentioned above, restart php-fpm and check the security center to see if it appears there. Or at least in the module list.

After working with @Com-QuadTech and having access to his machine. I can confirm that the PHP defender module is broken. No logs inside /var/log/messages /var/log/cwp/* or /usr/local/cwpsrv/logs/* could say anything. The error message that happens on the module itself is just "Error. Unknown error".

I used my commands mentioned earlier in this thread, without the "--enable-snuffleupagus", and did manually create ini files and rule files and tested a variable that PHP defender would block. It's now working, but again; had to be manually installed. PHP Defender installer is broken.

(https://i.gyazo.com/1f5ca030f402373c97668acfd4b8bab3.png)

Can a developer look into this please?
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 09, 2022, 03:26:51 PM
dicord name?
Title: Re: PHP Defender nowhere to be found
Post by: Com-QuadTech on January 09, 2022, 03:30:18 PM

allow inquiries or
Masterx1010 # 9538