Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bans in database won't be removed when unbanning #1582

Closed
L4rS6 opened this issue Oct 17, 2016 · 2 comments
Closed

Bans in database won't be removed when unbanning #1582

L4rS6 opened this issue Oct 17, 2016 · 2 comments

Comments

@L4rS6
Copy link

L4rS6 commented Oct 17, 2016

A banned IP will be added to the sqlite database when it gets banned[1]. When the IP gets unbanned, this records still exists (fail2ban version 0.9.5).

[1]
sqlite> select * from bans;
....
ssh|banned-ip|1476644580|{"matches": ["match-string"], "failures": 5}

@mitchellkrogza
Copy link

If you want to simply clear the database and start from scratch, it is very simple. (assuming you are on Ubuntu these are the commands) I have found a reset is needed some time to get everything working smoothly again. 

sudo service fail2ban stop
sudo truncate -s 0 /var/log/fail2ban.log
sudo rm /var/lib/fail2ban/fail2ban.sqlite3
sudo service fail2ban restart

This resets both the fail2ban.log file and deletes the database which gets re-created on startup.

KR
Mitchell

From: L4rS6 notifications@github.com
Reply: fail2ban/fail2ban reply@reply.github.com
Date: 17 October 2016 at 10:25:45 AM
To: fail2ban/fail2ban fail2ban@noreply.github.com
Subject:  [fail2ban/fail2ban] Bans in database won't be removed when unbanning (#1582)

A banned IP will be added to the sqlite database when it gets banned[1]

[1]
sqlite> select * from bans;
ssh||1476644580|{"matches": [""], "failures": 5}

We will be very grateful, if your problem was described as completely as possible,
enclosing excerpts from logs (if possible within DEBUG mode, if no errors evident
within INFO mode), and configuration in particular of effected relevant settings
(e.g., with fail2ban-client -d | grep 'affected-jail-name' for a particular
jail troubleshooting).
Thank you in advance for the details, because such issues like "It does not work"
alone could not help to resolve anything!
Thanks! (remove this paragraph and other comments upon reading)

Environment:

Fill out and check ([x]) the boxes which apply. If your Fail2Ban version is outdated,
and you can't verify that the issue persists in the recent release, better seek support
from the distribution you obtained Fail2Ban from

Fail2Ban version (including any possible distribution suffixes):
OS, including release name/version:
Fail2Ban installed via OS/distribution mechanisms
You have not applied any additional foreign patches to the codebase
Some customizations were done to the configuration (provide details below is so)
The issue:

Summary here

Steps to reproduce

Expected behavior

Observed behavior

Any additional information

Configuration, dump and another helpful excerpts

Any customizations done to /etc/fail2ban/ configuration

Relevant parts of /var/log/fail2ban.log file:

preferably obtained while running fail2ban with loglevel = 4

Relevant lines from monitored log files in question:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@sebres
Copy link
Contributor

sebres commented Oct 17, 2016

The obsolete IPs will be deleted after purgeage (but currently the purge will never called in current master, see #1267).
Fixed in #1460 (sebres:0.10-full)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants