Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/szepeviktor/waf4wordpress

WAF for WordPress 🔥 with 60+ security checks and weekly updates
https://github.com/szepeviktor/waf4wordpress

fail2ban firewall plugin security waf wordpress wordpress-security

Last synced: about 1 month ago
JSON representation

WAF for WordPress 🔥 with 60+ security checks and weekly updates

Awesome Lists containing this project

README

        

# WAF for WordPress

[![License][src-packagist-license]][href-license-file]
[![PHP Version][src-php-version]][href-composer-file]
[![Packagist stats][src-packagist-downloads]][href-packagist-stats]
[![Latest version][src-latest-version]][href-packagist]
[![PHPStan enabled][src-phpstan-enabled]][href-phpstan-org]

Stop real-life attacks on your WordPress website and
trigger [Fail2Ban](https://github.com/fail2ban/fail2ban).

:bulb: Before using this WAF you have to clean your website, get rid of even tiny errors.
See your access and error logs daily and run this WAF without Fail2ban for a week.

This WAF does not give proper HTTP responses to unusual requests.
It blocks the attacking IP address instantly, the purpose of this are the following.

1. Prevent website compromise in further requests
1. Prevent DoS attacks

Shared hosting has no server-wide banning (because of trust issues)
but you can still install this software without Fail2Ban to stop attacks by using one of the Miniban methods.

## Support my work

Please consider sponsoring me monthly if you use my packages in an agency.

[![Sponsor](https://github.com/szepeviktor/.github/raw/master/.github/assets/github-like-sponsor-button.svg)](https://github.com/sponsors/szepeviktor)

## Theory

Your WordPress - really general HTTP - security consists of the followings.

1. Use HTTPS
1. Have daily backups
1. Block [known hostile networks](https://github.com/szepeviktor/debian-server-tools/tree/master/security/myattackers-ipsets)
1. Have Fail2Ban installed (controls the firewall)
1. Maintain your website and use
[strict Fail2Ban filters](https://github.com/szepeviktor/debian-server-tools/tree/master/security/fail2ban-conf)
which ban on the first suspicious request instantly
1. Deny direct access to core WordPress files, themes and plugins
1. Install WAF for WordPress (this project)
1. Use [Leanmail](https://github.com/szepeviktor/debian-server-tools/tree/master/security/fail2ban-leanmail)
for filtering Fail2Ban notification emails

See the [Block WordPress attack vectors](https://github.com/szepeviktor/wordpress-website-lifecycle/blob/master/WordPress-security.md)
note in my other repository for an overview of the topic.

## Composer installation

Technically this is not a WordPress plugin nor an MU plugin.
WAF for WordPress is distributed and autoloaded as a Composer package.

1. Issue `composer require szepeviktor/waf4wordpress` command
1. Load `vendor/autoload.php` from your `wp-config`
1. Instantiate `SzepeViktor\WordPress\Waf\HttpAnalyzer` class early in `wp-config`
```php
require dirname(__DIR__) . '/vendor/autoload.php';
new SzepeViktor\WordPress\Waf\HttpAnalyzer();
```
1. Create an MU plugin in `wp-content/mu-plugins/waf4wordpress.php`
```php