Support

Admin Tools for WordPress

#40507 Problem with WAF

Posted in ‘Admin Tools for WordPress’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

WordPress version
6.4.3
PHP version
8.2
Admin Tools version
1.6.5

Latest post by nicholas on Friday, 29 March 2024 13:54 CDT

Andreas67

Hello,
I am trying to use your WAF instead of the Ninja Firewall for the first time.
Unfortunately, I get the following error message at Optimize WAF:
An error occurred while trying to write the following file: /usr/www/users/kreutzer/main/

What am I doing wrong and which file is this? Main is the installation directory

 

Thanks

 

Andreas

nicholas
Akeeba Staff
Manager

I think something is missing from that error message. It should be followed by .user.ini, .htaccess, or php.ini.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Andreas67

Hello,

thanks for your fast answer.  Unfortunately there is no further information - see screenshot

 

 

nicholas
Akeeba Staff
Manager

Can you please tell me what you used for the server technology setting, and whether you've verified this with your host?

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Andreas67

Hello,

actually it should be Apache+fastCGI. I have now tried Apache + mod_php and seem to get a success message - see screenshots.
Should this then be the correct setting?

nicholas
Akeeba Staff
Manager

Based on the screenshots, you are not using mod_php. I was asking you which method you were using to understand the weird error message. Now I get it. You only get the weird error when you use Apache + FastCGI. That's because PHP was lying to us :) We ask it to tell us the name of the per-directory INI file (typically, that's .user.ini). It reported it's a blank string, which is not normal.

I have created a workaround for this. Please download and install the following dev release: https://www.akeeba.com/download/atwppro-dev/1-6-6-dev202403291634-rev9e2096b9.html Then go back to that page, select Apache + FastCGI and apply the change. Does it work now?

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Andreas67

Hello Nicholas,

thank you very much! I have now received the same confirmation as in the other mode - see screenshot. In addition, this part is now present in the htaccess

# BEGIN AdminTools
# +++OptimizeWaf+++
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# ---OptimizeWaf---

# END AdminTools

The message that the changes have not yet taken effect still remains after several minutes - see screenshot

 

 

nicholas
Akeeba Staff
Manager

Can you please ask your host if .user.ini files take effect? It's always possible that the answer is no, in which case you just won't be able to use this feature. Do note that this is a pretty marginal feature, so it's not a big deal if you cannot use it. It's only there to add some extra protection in the less common use case that a plugin uses a .php file being accessed directly over the web, and which .php file does not load WordPress itself.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Andreas67

Hello Nicholas,

in the user.ini is this code, but I think it is no longer read by my hoster since PHP 8

AdminTools WAF
auto_prepend_file = '/usr/www/users/kreutzer/main/admintools-waf.php'
END AdminTools WAF

I have therefore added this line to the htaccess and now everything seems to work.

php_value auto_prepend_file "/usr/www/users/kreutzer/main/admintools-waf.php"

Thanks for your great help

 

nicholas
Akeeba Staff
Manager

You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!