{"authors":[{"name":"Misha Vyrtsev","url":"https://vyrtsev.com"}],"description":"Notes by Misha Vyrtsev, tagged F2B","feed_url":"https://notes.vyrtsev.com/rss.json?tags=f2b","home_page_url":"https://notes.vyrtsev.com/","icon":"https://notes.vyrtsev.com/images/avatar.png?v=a72e473e","items":[{"content_html":"<p><a href=\"https://apps.vyrtsev.com/f2b\" target=\"_blank\" rel=\"noopener noreferrer\">f2b</a> is fail2ban with a web interface and an API. Until now fail2ban on my servers was a folder of jail and filter files for each of them, with a docker-compose file and a script to deploy it. In f2b the jails, filters and actions are still files, but they&rsquo;re edited in the browser, in an editor that knows fail2ban&rsquo;s syntax. A save fail2ban would refuse is refused, in fail2ban&rsquo;s own words, and nothing is written. One it accepts is written, and fail2ban reloads, keeping its bans.</p>\n<p>A filter can be tried on a log before it&rsquo;s saved. fail2ban-regex runs over the end of a log a jail reads, any other log on the server, rotated <code>.gz</code> ones too, or lines pasted in, and marks each line matched, missed or ignored, again with every change to the filter. A line from the log can start a failregex: its date and address are taken out, and the rest is escaped.</p>\n<ul>\n<li>Who is banned now, where, since when and until when, and the log lines that did it. A ban can be lifted, and an address or a range banned by hand</li>\n<li>The history: bans per day by jail, the most banned addresses, and every ban fail2ban&rsquo;s database holds</li>\n<li>fail2ban&rsquo;s own filters and actions, to read and to override in one press</li>\n<li>fail2ban&rsquo;s log, following along</li>\n<li>One password, from the environment, and every wrong one is a line for fail2ban to read</li>\n<li>API tokens for scripts and agents, read-only or read and write, for a JSON:API described by an OpenAPI document. A link to paste into an agent opens a brief on the API, with a token that works for thirty minutes</li>\n</ul>\n<p>Like <a href=\"https://apps.vyrtsev.com/mailio\" target=\"_blank\" rel=\"noopener noreferrer\">mailio</a>, <a href=\"https://apps.vyrtsev.com/emguio\" target=\"_blank\" rel=\"noopener noreferrer\">emguio</a> and <a href=\"https://apps.vyrtsev.com/taskio\" target=\"_blank\" rel=\"noopener noreferrer\">taskio</a>, it runs in Docker, as two containers sharing a volume. The engine, fail2ban with the API, runs in the host&rsquo;s network, because fail2ban writes the host&rsquo;s firewall. The interface runs behind your reverse proxy and talks to the engine over a socket on the volume.</p>\n<p>The code and docs are on <a href=\"https://github.com/reeywhaar/f2b\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub</a>.</p>\n<div class=\"gallery\">\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/1-overview_hu_f2a4b7f057f4a5d7.webp?v=b4dda310\" alt=\"The overview: fail2ban&#39;s state, the bans per day by jail, and each jail with what it reads\" width=\"1252\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/2-bans_hu_e179795f5cc3e55a.webp?v=456ada11\" alt=\"The bans in force, with how often each address has been banned before and the lines that did it\" width=\"1252\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/3-filter_hu_5736c54325f5947e.webp?v=1a8631d3\" alt=\"A filter in the editor, tried on its jail&#39;s log as it is typed, every line marked with what fail2ban-regex made of it\" width=\"828\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/4-lines_hu_8423624e74cd2781.webp?v=3978dc22\" alt=\"Picking the lines to try: a log a jail reads, any other in the log directories, or lines pasted\" width=\"1136\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/5-history_hu_3bb5024d798f1954.webp?v=2c698122\" alt=\"The history: every ban fail2ban&#39;s database holds\" width=\"1252\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/6-config_hu_19cd0ad91dc874d5.webp?v=f618e6c9\" alt=\"Config: the jails, filters and actions, each a file laid over fail2ban&#39;s own configuration\" width=\"1252\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/7-log_hu_36bf13809a975e4b.webp?v=3cdfad9e\" alt=\"fail2ban&#39;s log, following along\" width=\"1408\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n    <img src=\"https://notes.vyrtsev.com/posts/f2b/screens/8-phone_hu_ee880c3fedfa4653.webp?v=96d05525\" alt=\"The overview on a phone\" width=\"407\" height=\"880\" loading=\"lazy\">\n    <span class=\"gallery-end\" aria-hidden=\"true\"></span>\n</div>\n\n","date_published":"2026-11-29T05:00:00+04:00","id":"https://notes.vyrtsev.com/posts/f2b/","summary":"fail2ban in Docker with a web interface and an API. Jails and filters are edited in the browser, a filter is tried on a log before it’s saved, and the bans show who, where and why.","tags":["F2B","Development","Self-Hosted"],"title":"f2b, fail2ban with a web interface and an API","url":"https://notes.vyrtsev.com/posts/f2b/"}],"language":"en-us","title":"F2B on Blips and Blinks","version":"https://jsonfeed.org/version/1.1"}
