Usually, this would be a permissions issue, where the WAF files are stuck and can’t be overwritten, though you said you have already checked permissions. There could be something like selinux preventing writing files, despite the permissions, I’d check if you’re using that or any other security software on the server outside of WP that might block writing files.
It perhaps is some security software but I can’t think what that might be. It’s not Ubuntu’s selinux equivalent, (AppArmor) there is an AppArmor rule but it is not enabled.
[email protected]:/SecureCoop# grep /var/www/html /etc/apparmor.d/abstractions/web-data
/var/www/html/ r,
/var/www/html/** r,
[email protected]:/SecureCoop# apparmor_status
apparmor module is loaded.
40 profiles are loaded.
40 profiles are in enforce mode.
/snap/core/11167/usr/lib/snapd/snap-confine
/snap/core/11167/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/snap/snapd/11841/usr/lib/snapd/snap-confine
/snap/snapd/11841/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/snap/snapd/12057/usr/lib/snapd/snap-confine
/snap/snapd/12057/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/usr/bin/lxc-start
/usr/bin/man
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/NetworkManager/nm-dhcp-helper
/usr/lib/connman/scripts/dhclient-script
/usr/lib/snapd/snap-confine
/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/usr/sbin/mysqld
/usr/sbin/tcpdump
/{,usr/}sbin/dhclient
lsb_release
lxc-container-default
lxc-container-default-cgns
lxc-container-default-with-mounting
lxc-container-default-with-nesting
man_filter
man_groff
nvidia_modprobe
nvidia_modprobe//kmod
snap-update-ns.core
snap-update-ns.lxd
snap.core.hook.configure
snap.lxd.activate
snap.lxd.benchmark
snap.lxd.buginfo
snap.lxd.check-kernel
snap.lxd.daemon
snap.lxd.hook.configure
snap.lxd.hook.install
snap.lxd.hook.remove
snap.lxd.lxc
snap.lxd.lxc-to-lxd
snap.lxd.lxd
snap.lxd.migrate
0 profiles are in complain mode.
1 processes have profiles defined.
1 processes are in enforce mode.
/usr/sbin/mysqld (916)
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
[email protected]:/SecureCoop#
You checked the main error log, but I see diagnostics shows an error log at wp-content/debug.log with a nonzero size. Can you check that one for any errors. The drawback about using WP_DEBUG is that errors that occur during the WAF code before WP loads won’t be there if the WAF is optimized. You might need to set the error log path in php.ini to be sure those earlier errors are logged.
That log file might have existed at one time, but it has since been removed. I believe it belonged to a debug plugin which I have removed.
[email protected]:/SecureCoop# ls -l /var/www/html/wp-content/debug.log
ls: cannot access '/var/www/html/wp-content/debug.log': No such file or directory
[email protected]:/SecureCoop#
It’s possible that an issue that’s preventing writing to the wflogs files may also be preventing the webserver from writing to the default log as well, which could leave it at 0 bytes permanently.
If you can send the output of ls -l /var/www/html/wp-content/wflogs it would be good to see if any of the files have newer dates.
Interestingly, attack-data.php and ips.php are being updated, which clues to me that it’s probably not some other security software. If that were the case I would not expect anything in this directory to update.
[email protected]:/SecureCoop# ls -l /var/www/html/wp-content/wflogs
total 5584
-rw-r----- 1 www-data www-data 3890328 Mar 24 18:02 GeoLite2-Country.mmdb
-rw-rw---- 1 www-data www-data 181249 Jun 5 16:14 attack-data.php
-rw-rw---- 1 www-data www-data 601 Mar 29 02:17 config-livewaf.php
-rw-rw---- 1 www-data www-data 13868 Mar 29 02:17 config-synced.php
-rw-rw---- 1 www-data www-data 1201202 Mar 29 02:17 config-transient.php
-rw-rw---- 1 www-data www-data 560 Mar 29 02:17 config.php
-rw-rw---- 1 www-data www-data 51 Jun 11 10:21 ips.php
-rw-rw-r-- 1 www-data www-data 403981 Mar 29 02:17 rules.php
[email protected]:/SecureCoop#
It may be worth trying renaming the whole wflogs directory temporarily, this loses some WAF settings, but we can see if the files get re-created, and if they contain anything.
[email protected]:/SecureCoop# mv /var/www/html/wp-content/wflogs /var/www/html/wp-content/wflogs.disabled
# Refreshed Wordfence options in the WordPress GUI
[email protected]:/SecureCoop# ls -l /var/www/html/wp-content/wflogs
total 3860
-rw-r--r-- 1 www-data www-data 3890328 Jun 11 10:24 GeoLite2-Country.mmdb
-rw-rw---- 1 www-data www-data 40083 Jun 11 10:24 attack-data.php
-rw-rw---- 1 www-data www-data 325 Jun 11 10:24 config-livewaf.php
-rw-rw---- 1 www-data www-data 325 Jun 11 10:24 config-synced.php
-rw-rw---- 1 www-data www-data 325 Jun 11 10:24 config-transient.php
-rw-rw---- 1 www-data www-data 534 Jun 11 10:24 config.php
-rw-rw---- 1 www-data www-data 51 Jun 11 10:25 ips.php
-rw-rw-r-- 1 www-data www-data 0 Jun 11 10:24 rules.php
[email protected]:/SecureCoop#
So, yes they were all rebuilt, except rules.php. I put the old directory back.
What I noticed about this is that rules.php had indeed updated on last time I messed with it on March 29th. It probably came from plugin installation though.
phpinfo() must be disabled since it’s missing in Diagnostics, but I’m not sure if it will help in this case. You could temporarily enable it in php.ini, run Diagnostics once again, and then disable it again. I’d be looking for what’s in disable_functions, open_basedir, or possibly any missing or unexpected PHP extensions.
I have enabled phpinfo() and re-uploaded Diagnostics, please check.
Is it possible to just download rules.php manually and scp it into place? I can do that periodically, or by script.