akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

Phx2Ban - a web application firewall built for Phoenix

Howdy howdy everyone!

@PJUllrich and I have built our first Pro library, Phx2Ban! Phx2Ban is a web application firewall that you can install in your Phoenix applications in less time than it takes to brew a cup of :coffee:. If you don’t believe me watch Peter install Phx2Ban in a Phoenix application with just a few minutes:

Phx2Ban can be used as an alternative to web application firewalls such as fail2ban without having to install anything on your host or add anything to your container given that it is an Elixir library. Since it lives within your application, Phx2Ban also comes with a Phoenix LiveDashboard plugin where you can see metrics collected by Phx2Ban as well as manage the block list (in case you need to unblock an IP address):

This built in dashboard will allow you to see how many unique IP addresses have accessed your service, how many requests were blocked and how many valid requests were allowed to proceed. Here is a snapshot of the firewall at work when my business was getting hit with bot requests in the middle of the night:

We have a lot of additional features planned for this Pro library and we will be rolling those out in the weeks to come! Since this is in early launch, Phx2Ban will be available for a one time fee of $99 (discounted by $50 while we are still in the active development phase).

Peter an I appreciate the support and we look forward to building additional Pro libraries tailored to bootstrapped business owners!

Where to buy: https://ezsuite.dev
Phx2Ban Docs: README — Phx2Ban v0.2.4

Most Liked

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

At the moment the block list only lives in memory, but that is definitely on the roadmap! We’re working on a couple of other features at the moment (namely support for stateful rules and the ability to download and use crowd sourced block lists of known malicious IPs). Our plan is to use Postgres both for persisting blocklist state and for replicating the blocklist across nodes when native clustering is not an option. In other words…coming soon!

jaimeiniesta

jaimeiniesta

That looks great!

Is the requests data and blocked IPs stored somewhere, or just in memory? I’m asking because I use Heroku and they reset the dynos daily, will the blocked IPs be wiped out in this case?

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

0.2.1 release announcement :tada:

@PJUllrich and I have been fairly busy with Phx2Ban since its initial release and we’ve gone though and added a bunch of features that were requested by users!

The biggest announcement in these last couple releases is the ability to pull down a serialized Cuckoo filter from ezsuite.dev that has IP addresses from the public block list https://www.abuseipdb.com/.

We have some other very cool features in the works so stay tuned!

Here is the full changelog from the last two releases with the latest version being 0.2.1:

[0.2.1] - 2024-11-29

Fixed

  • Fixes a FunctionClauseError in the KnownMaliciousIP rule when an IPv6 address was checked.
  • Bumped the dependency phoenix_live_dashboard to at least 0.8.0 because versions below that were missing some functions we use in the LiveDashboardPlugin and that lead to compilation errors. (See #2)

[0.2.0] - 2024-11-28

Added

  • New Rule KnownMaliciousIP. Fetches a public blocklist of ~85k known malicious IPs tracked by AbuseIPDB from ezsuite.dev and blocks requests originating from these IPs.
  • Phx2Ban.manually_block_ip_address/1 function will manually add an IP address to the block list..
  • Phx2Ban.ip_address_status/1 function will return the current status of an IP address.
  • Config option allow_list. Accepts a list of IP addresses as strings so that you can avoid analyzing/blocking traffic from certain trusted IP addresses.
  • Config option enabled for enabling/disabling the firewall. Can be triggered through the LiveDashboard plugin or manually through Phx2Ban.FirewallConfig.put!(:enabled, true|false).
  • Config option ignore_routes. Accepts a list of routes as string or regex that Phx2ban should ignore. Any requests to these routes are excluded from analysis and will never get blocked.

Where Next?

Popular in Discussions Top

scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40042 209
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 14350 124
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36654 110
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49084 226
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42533 114
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement