Wordfence (2018-2022): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
k (Jeroen Strompf heeft pagina Wordfence (2018--2022) hernoemd naar Wordfence (2018-2022))
 
(51 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 1: Regel 1:
''Wordfence'' is een WordPress-plugin op het gebied van site-beveiliging. Oa. detecteert het gehackte sites en kan het sites zelfs weer schoonmaken. Sind begin 2018 gebruik ik Wordfence op al m'n sites.
+
''Wordfence'' is een WordPress-plugin op het gebied van site-beveiliging. Oa. detecteert het gehackte sites en kan het sites zelfs weer schoonmaken. Sind begin 2018 gebruik ik Wordfence op al m'n sites. Het bevalt goed, maar niets is perfect: Je moet dus (zoals altijd) je gezond verstand blijven gebruiken.
 +
 
 +
== Beperkingen ==
 +
 
 +
WordFence detecteert fraudeleuse admin-accounts niet, als deze zijn aangemaakt vóór de installatie van WordFence → Zelf controleren of de aanwezige (admin)-account legitiem zijn
  
 
== Installatie ==
 
== Installatie ==
Regel 7: Regel 11:
 
== Configuratie ==
 
== Configuratie ==
  
[[file:20181029-1119.png|thumb| Foutmelding: ''"The Wordfence Web Application Firewall cannot run. The configuration files are corrupt or inaccessible by the web server, which is preventing the WAF from functioning. Please verify the web server has permission to access the configuration files. You may also try to rebuild the configuration file by clicking here. It will automatically resume normal operation when it is fixed"'' en ''"We were unable to write to ~/wp-content/wflogs/ which the WAF uses for storage. Please update permissions on the parent directory so the web server can write to it."'']]
+
Zie de instellingen onder ''Wordfence » All Options'' in een bestaande website voor inspiratie.
 +
 
 +
''' Maak wp-content/wflogs beschrijfbaar voor Wordfence'''
  
* Alert emails: <code>Wordfence » All Options » General Wordfence options » Where to email alerts</code>
+
Wordfence komt met een firewall: ''Wordfence Web Application Firewall'' (WAF). Om deze te kunnen configureren, moet Wordfence z'n configuratiebestanden in <code>wp-content/wflogs</code> kunnen beschrijven. Wat in ieder geval help:
* Wordfence komt met een firewall: ''Wordfence Web Application Firewall'' (WAF). Om deze te kunnen configureren, moet Wordfence z'n configuratiebestanden in <code>wp-content/wflogs</code> kunnen beschrijven. Wat in ieder geval help:
 
  
 
<pre>
 
<pre>
Regel 17: Regel 22:
 
</pre>
 
</pre>
  
== Unable to open config.php-foutmelding (okt. 2018) ==
+
== Foutmelding: Unable to open <file> for reading and writing (okt. 2018) ==
  
 
''' Probleem '''
 
''' Probleem '''
Regel 28: Regel 33:
 
Unable to open /var/www/example.com/wp-content/wflogs/config-livewaf.php for reading and writing.
 
Unable to open /var/www/example.com/wp-content/wflogs/config-livewaf.php for reading and writing.
 
Unable to open /var/www/example.com/wp-content/wflogs/config-transient.php for reading and writing.
 
Unable to open /var/www/example.com/wp-content/wflogs/config-transient.php for reading and writing.
 +
Unable to open /var/www/example.com/wp-content/wflogs/ips.php for reading and writing.
 
</pre>
 
</pre>
  
Regel 47: Regel 53:
  
 
<pre>
 
<pre>
sudo chmod -R o+rw wp-content/wflogs
+
sudo chmod -R og+rw wp-content/wflogs
 
</pre>
 
</pre>
  
== Wordfence Web Application Firewall cannot run-foutmelding (okt. 2018) ==
+
Let op: Alleen <code>sudo chmod -R o+rw wp-content/wflogs</code> (dus alleen ''others'' en geen ''group'') werkt niet.
  
''' Probleem '''
+
Daarnaast moet ik een enkele keer mbv. ''chown'' en ''chgrp'' mezelf eigenaar maken:
 +
 
 +
<pre>
 +
cd wp-content/wflogs
 +
sudo chown strompf *
 +
sudo chgrp strompf *
 +
</pre>
 +
 
 +
== Foutmelding: Wordfence Web Application Firewall cannot run ==
 +
 
 +
=== Probleem ===
 +
 
 +
{|
 +
|[[file:20181218-1052.png|thumb|''"The Wordfence Web Application Firewall cannot run. The configuration files are corrupt or inaccessible by the web server, which is preventing the WAF from functioning. Please verify the web server has permission to access the configuration files. You may also try to rebuild the configuration file by clicking here. It will automatically resume normal operation when it is fixed."'']]
 +
|}
 +
 
 +
=== Oorzaak ===
 +
 
 +
[https://www.wordfence.com/help/firewall/troubleshooting/?utm_source=plugin&utm_medium=pluginUI&utm_campaign=docsIcon#problems-reading-wordfence-firewall-config-data]:
 +
 
 +
:The Wordfence Firewall stores some of its information in the file system. The files are located in wp-content/wflogs/. If there are issues with file writing or disk space on the server, the configuration file config.php could become corrupt. If this happens, you will receive an administrative notice on all Wordfence pages, prompting you to rebuild the configuration file automatically. If restoration completes successfully, no further action is required on your part. Your Firewall is now in perfect shape again.
 +
 
 +
:If the message still appears after reloading the page, you may need to fix file permissions on the files in wp-content/wflogs/, including the wflogs folder itself. Some hosting companies may need to do this for you, while most others allow you to do it yourself. You can also try renaming the wflogs folder, which will reset the firewall settings, including Learning Mode and any automatic whitelist entries.
 +
 
 +
Maw.: De webserver moet schrijftoegang hebben tot <code>wp-content/wflogs</code> en ik neem aan, dat dit niet alleen geldt tijdens installatie van Wordfence, maar ook als de site in bedrijf is.
 +
 
 +
=== Oplossing ===
 +
 
 +
Zorgen dat Apache kan schrijven naar <code>wp-content/wflogs</code>. Hoe je dat precies voor elkaar krijgt, hangt af van de configuratie van je webserver.
 +
 
 +
== Foutmelding: Unable to open <file> for reading and writing (dec. 2018) ==
 +
 
 +
Deze foutmelding kreeg ik tijdens updates via WP-CLI. Zelfde probleem als een paar maanden eerder → Zie aldaar voor details + oplossing
 +
 
 +
== Foutmelding: Error Saving Options ==
 +
 
 +
Tijdens configureren van WordFence:
  
 
{|
 
{|
|[[file:20181018-1214.png|thumb|''"The Wordfence Web Application Firewall cannot run. The configuration files are corrupt or inaccessible by the web server, which is preventing the WAF from functioning. Please verify the web server has permission to access the configuration files. You may also try to rebuild the configuration file by clicking here. It will automatically resume normal operation when it is fixed."'' en ''"We were unable to write to ~/wp-content/wflogs/ which the WAF uses for storage. Please update permissions on the parent directory so the web server can write to it."'']]
+
|[[file:20181219-1139.png|thumb|Error Saving Options - Unable to save the .htaccess file needed to disable script execution in the uploads directory. Please check your permissions on that directory]]
 
|}
 
|}
  
''' Oplossig '''
+
Oplossing (vanuit de ''root'' van de installatie):
 +
 
 +
sudo chmod -R o+rwX wp-content/uploads
 +
 
 +
== Foutmelding: Unable to create wordfence-waf.php (jan. 2019 & jan. 2022) ==
 +
 
 +
Deze foutmelding trad op bij een nieuwe site tijdens de installatieprocedure.
 +
 
 +
=== Oorzaak ===
 +
 
 +
Twee mogelijke oorzaken:
  
Vanaf de ''root'' van de installatie:
+
* Geen schrijfrechten op de hoofdmap van de installatie
 +
* Geen schrijfrechten op het al bestaande bestand ''wordfence-waf.php''
 +
 
 +
=== Oplossing ===
 +
 
 +
In de situatie waarin webserver in ''group'' zit, en ikzelf eigenaar ben:
  
 
<pre>
 
<pre>
sudo chmod -R o+rw wp-content/wflogs
+
# Vanaf de root van de WordPress-installatie
 +
#
 +
sudo chmod g+w .
 +
sudo chmod g+w wordence-waf.php
 
</pre>
 
</pre>
 +
 +
== Foutmelding: Last rules update unsuccessful (april 2022) ==
 +
 +
=== Foutmelding ===
 +
 +
<pre>
 +
The last rules update for the Wordfence Web Application Firewall was unsuccessful.
 +
The last successful update check was 4 March 2022 13:13, so this site may be
 +
missing new rules added since then. You may wait for the next automatic attempt at
 +
7 April 2022 15:37 or try to Manually Update by clicking the "Manually Refresh
 +
Rules" button below the Rules list.
 +
</pre>
 +
 +
=== Aanvullende informatie ===
 +
 +
''Rule update'' heeft betrekking op downloaden van een nieuwe versie van bestand <code>wp-content/wflogs/rules.php</code>
 +
 +
{|
 +
|[[file:20220405-1129.png|thumb|De melding bevat een link naar de WordFence-pagina. Daar heb je een knop om de regels handmatig bij te werken. Ik kreeg toen deze foutmelding]]
 +
|[[file:20220405-1134.png|thumb|Map <code>wp-content/wflogs/rules.php</code> is beschrijfbaar, maar bestand <code>rules.php</code> niet - Oorzaak?]]
 +
|}
 +
 +
Er zijn in ieder geval twee uitgebreide ''threads'' op WordPress.org over dit probleem, zij het dat die aan de oude kant zijn:
 +
 +
* https://wordpress.org/support/topic/the-last-rules-update-for-the-wordfence-web-application-firewall-was-unsuccessfu
 +
* https://wordpress.org/support/topic/the-last-rules-update-for-the-wordfence-web-application-firewall-was-unsuccessfu-7
 +
 +
''' Verwijderen & opnieuw installeren '''
 +
 +
* Verwijderen (<code>wp plugin deactivate wordfence; wp plugin delete wordfence</code> en opnieuw installeren (<code>wp plugin install wordfence; wp plugin activate wordfence</code>), hielpen niet. Het idee hierachter: Deze site is een kloon van een andere site, dus misschien dat dat een rol speelt
 +
* Script <code>wp_sr_op</code> toegepast - Geen verschil
 +
* Bijgewerkt middels knop ''Manually Refresh Rules'': Nu verdween de foutmelding. Ik heb één keer eerder meegemaakt dat de melding tijdelijk verdween. 's Kijken hoe het nu gaat.
 +
 +
=== Conclusie ===
 +
 +
Dit is een ''false negative'': Het bestand wordt wel degelijk bijgewerkt.
 +
 +
=== Oplossing ===
 +
 +
Negeren.
 +
 +
== Zie ook ==
 +
 +
* [[Mappen, bestanden & rechten - 2020 (WordPress, 2)]]
  
 
== Bronnen ==
 
== Bronnen ==
  
 
* https://www.wordfence.com/help/firewall/troubleshooting
 
* https://www.wordfence.com/help/firewall/troubleshooting

Huidige versie van 3 nov 2023 om 14:35

Wordfence is een WordPress-plugin op het gebied van site-beveiliging. Oa. detecteert het gehackte sites en kan het sites zelfs weer schoonmaken. Sind begin 2018 gebruik ik Wordfence op al m'n sites. Het bevalt goed, maar niets is perfect: Je moet dus (zoals altijd) je gezond verstand blijven gebruiken.

Beperkingen

WordFence detecteert fraudeleuse admin-accounts niet, als deze zijn aangemaakt vóór de installatie van WordFence → Zelf controleren of de aanwezige (admin)-account legitiem zijn

Installatie

wp plugin install wordfence --activate

Configuratie

Zie de instellingen onder Wordfence » All Options in een bestaande website voor inspiratie.

Maak wp-content/wflogs beschrijfbaar voor Wordfence

Wordfence komt met een firewall: Wordfence Web Application Firewall (WAF). Om deze te kunnen configureren, moet Wordfence z'n configuratiebestanden in wp-content/wflogs kunnen beschrijven. Wat in ieder geval help:

chmod o+w wp-content/wflogs           # Misschien niet nodig?
sudo chmod o+rw wp-content/wflogs/*   # Nodig!

Foutmelding: Unable to open <file> for reading and writing (okt. 2018)

Probleem

Diverse vergelijkbare foutmeldingen (via Bash):

Unable to open /var/www/example.com/wp-content/wflogs/config.php for reading and writing.
Unable to open /var/www/example.com/wp-content/wflogs/config-synced.php for reading and writing.
Unable to open /var/www/example.com/wp-content/wflogs/config-livewaf.php for reading and writing.
Unable to open /var/www/example.com/wp-content/wflogs/config-transient.php for reading and writing.
Unable to open /var/www/example.com/wp-content/wflogs/ips.php for reading and writing.

Aanvullende gegevens

Wat vreemd was: www-data is eigenaar van map + bestanden, de map had rechten 777, en www-data kon alle bestanden lezen en schrijven.

Oplossing

sudo chmod o+rw config.php
sudo chmod o+rw config-synced.php
sudo chmod o+rw config-livewaf.php
sudo chmod o+rw config-synced.php
sudo chmod o+rw config-transient.php

Een oplossing die nog iets radicaler is, en die ik evenmin helemaal vertrouw:

sudo chmod -R og+rw wp-content/wflogs

Let op: Alleen sudo chmod -R o+rw wp-content/wflogs (dus alleen others en geen group) werkt niet.

Daarnaast moet ik een enkele keer mbv. chown en chgrp mezelf eigenaar maken:

cd wp-content/wflogs
sudo chown strompf *
sudo chgrp strompf *

Foutmelding: Wordfence Web Application Firewall cannot run

Probleem

"The Wordfence Web Application Firewall cannot run. The configuration files are corrupt or inaccessible by the web server, which is preventing the WAF from functioning. Please verify the web server has permission to access the configuration files. You may also try to rebuild the configuration file by clicking here. It will automatically resume normal operation when it is fixed."

Oorzaak

[1]:

The Wordfence Firewall stores some of its information in the file system. The files are located in wp-content/wflogs/. If there are issues with file writing or disk space on the server, the configuration file config.php could become corrupt. If this happens, you will receive an administrative notice on all Wordfence pages, prompting you to rebuild the configuration file automatically. If restoration completes successfully, no further action is required on your part. Your Firewall is now in perfect shape again.
If the message still appears after reloading the page, you may need to fix file permissions on the files in wp-content/wflogs/, including the wflogs folder itself. Some hosting companies may need to do this for you, while most others allow you to do it yourself. You can also try renaming the wflogs folder, which will reset the firewall settings, including Learning Mode and any automatic whitelist entries.

Maw.: De webserver moet schrijftoegang hebben tot wp-content/wflogs en ik neem aan, dat dit niet alleen geldt tijdens installatie van Wordfence, maar ook als de site in bedrijf is.

Oplossing

Zorgen dat Apache kan schrijven naar wp-content/wflogs. Hoe je dat precies voor elkaar krijgt, hangt af van de configuratie van je webserver.

Foutmelding: Unable to open <file> for reading and writing (dec. 2018)

Deze foutmelding kreeg ik tijdens updates via WP-CLI. Zelfde probleem als een paar maanden eerder → Zie aldaar voor details + oplossing

Foutmelding: Error Saving Options

Tijdens configureren van WordFence:

Error Saving Options - Unable to save the .htaccess file needed to disable script execution in the uploads directory. Please check your permissions on that directory

Oplossing (vanuit de root van de installatie):

sudo chmod -R o+rwX wp-content/uploads

Foutmelding: Unable to create wordfence-waf.php (jan. 2019 & jan. 2022)

Deze foutmelding trad op bij een nieuwe site tijdens de installatieprocedure.

Oorzaak

Twee mogelijke oorzaken:

  • Geen schrijfrechten op de hoofdmap van de installatie
  • Geen schrijfrechten op het al bestaande bestand wordfence-waf.php

Oplossing

In de situatie waarin webserver in group zit, en ikzelf eigenaar ben:

# Vanaf de root van de WordPress-installatie
#
sudo chmod g+w .
sudo chmod g+w wordence-waf.php

Foutmelding: Last rules update unsuccessful (april 2022)

Foutmelding

The last rules update for the Wordfence Web Application Firewall was unsuccessful.
The last successful update check was 4 March 2022 13:13, so this site may be 
missing new rules added since then. You may wait for the next automatic attempt at
7 April 2022 15:37 or try to Manually Update by clicking the "Manually Refresh 
Rules" button below the Rules list.

Aanvullende informatie

Rule update heeft betrekking op downloaden van een nieuwe versie van bestand wp-content/wflogs/rules.php

De melding bevat een link naar de WordFence-pagina. Daar heb je een knop om de regels handmatig bij te werken. Ik kreeg toen deze foutmelding
Map wp-content/wflogs/rules.php is beschrijfbaar, maar bestand rules.php niet - Oorzaak?

Er zijn in ieder geval twee uitgebreide threads op WordPress.org over dit probleem, zij het dat die aan de oude kant zijn:

Verwijderen & opnieuw installeren

  • Verwijderen (wp plugin deactivate wordfence; wp plugin delete wordfence en opnieuw installeren (wp plugin install wordfence; wp plugin activate wordfence), hielpen niet. Het idee hierachter: Deze site is een kloon van een andere site, dus misschien dat dat een rol speelt
  • Script wp_sr_op toegepast - Geen verschil
  • Bijgewerkt middels knop Manually Refresh Rules: Nu verdween de foutmelding. Ik heb één keer eerder meegemaakt dat de melding tijdelijk verdween. 's Kijken hoe het nu gaat.

Conclusie

Dit is een false negative: Het bestand wordt wel degelijk bijgewerkt.

Oplossing

Negeren.

Zie ook

Bronnen