This commit is contained in:
Zhang Huangbin 2020-04-15 20:51:30 +08:00
parent d70d3ce1e5
commit 0c51d2d4af
2 changed files with 8 additions and 6 deletions

View File

@ -155,9 +155,10 @@ File `/etc/fail2ban/action.d/banned_db.conf` indicates we now have a new action
named `banned_db` (it's file name without extension). Feel free to open this
file and check what it does.
Script `/usr/local/bin/fail2ban_banned_db` will read `/root/.my.cnf-fail2ban`
(OpenLDAP/MySQL/MariaDB backends) or `~postgresql/.pgpass` (PostgreSQL backend)
to read SQL credential.
Script `/usr/local/bin/fail2ban_banned_db` will read SQL username and password
from `/root/.my.cnf-fail2ban` (OpenLDAP/MySQL/MariaDB backends) or
`~postgresql/.pgpass` (PostgreSQL backend), then connect to SQL server and
add or remove banned IP addresses.
## Enable the new action `banned_db`

View File

@ -173,9 +173,10 @@ chmod 0550 /usr/local/bin/fail2ban_banned_db
<p>File <code>/etc/fail2ban/action.d/banned_db.conf</code> indicates we now have a new action
named <code>banned_db</code> (it's file name without extension). Feel free to open this
file and check what it does.</p>
<p>Script <code>/usr/local/bin/fail2ban_banned_db</code> will read <code>/root/.my.cnf-fail2ban</code>
(OpenLDAP/MySQL/MariaDB backends) or <code>~postgresql/.pgpass</code> (PostgreSQL backend)
to read SQL credential.</p>
<p>Script <code>/usr/local/bin/fail2ban_banned_db</code> will read SQL username and password
from <code>/root/.my.cnf-fail2ban</code> (OpenLDAP/MySQL/MariaDB backends) or
<code>~postgresql/.pgpass</code> (PostgreSQL backend), then connect to SQL server and
add or remove banned IP addresses.</p>
<h2 id="enable-the-new-action-banned_db">Enable the new action <code>banned_db</code></h2>
<p>Now go to <code>/etc/fail2ban/jail.d/</code> and update config files for the jails you
want to store banned IP in SQL db. Let's take <code>dovecot.local</code> for example.</p>