# Adding ban/unban notifications from Fail2Ban to Pushover!

**URL:** <https://forum.hhf.technology/t/adding-ban-unban-notifications-from-fail2ban-to-pushover/290>\
**Category:** Self-hosted Applications\
**Tags:** fail2ban, pushover, notifications\
**Created:** [October 24, 2024, 5:23am UTC](https://forum.hhf.technology/t/adding-ban-unban-notifications-from-fail2ban-to-pushover/290 "2024-10-24T05:23:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [October 24, 2024, 5:23am UTC](https://forum.hhf.technology/t/adding-ban-unban-notifications-from-fail2ban-to-pushover/290/1 "2024-10-24T05:23:54Z")

</div>

![image](https://forum-cdn.hhf.technology/original/1X/336b03baaf7de645a7a3cb327279c18c6a164b80.jpeg)

## Integrating Pushover with Fail2Ban for Notification Management

This guide outlines the process of integrating Pushover with Fail2Ban to receive notifications when IP addresses are banned or unbanned. The implementation is straightforward and enhances the security monitoring of your server.

### Setting Up Pushover

1. **Create an Account** : Visit [Pushover](https://pushover.net/) and register for a user account. Add the devices you wish to receive notifications on; for example, the iOS app is highly effective and offers a 7-day trial period.

2. **Obtain User Key** : Once logged in, locate your user key on the user page. This key is essential for configuring notifications.

3. **Create a Fail2Ban Application** : At the bottom of your user page, add a new application for Fail2Ban. After creating it, note the API token provided, as it will be used in the configuration.

 ![image](https://forum-cdn.hhf.technology/original/1X/34990dc0b3845bacc419d78ffb2c17cee6c38700.png)

 ![image](https://forum-cdn.hhf.technology/original/1X/363110e2745d80850889884cae1446a40afdb595.png)

1. **Test Notifications** : You can send a test notification from your user page to ensure that everything is set up correctly.

### Configuring Fail2Ban Actions

1. **Create Action File** : Navigate to the `action.d` directory of your Fail2Ban installation and create a file named `pushover.local`.

2. **Edit Configuration** : Insert the following configuration into `pushover.local`:

3. **Optional Notification Control** : If you prefer not to receive notifications for startup, shutdown, or unbanning events, comment out those lines by prefixing them with `#`.

```bash
#actionstart = /usr/bin/curl -s -F "token=<token>" -F "user=<user>" -F "title=[Fail2Ban] <name>" -F "message=Jail <name> has been started successfully." https://api.pushover.net/1/messages

```

### Updating `jail.local`

1. **Edit Configuration File** : Open your `jail.local` file and add the Pushover action to each jail where you want notifications. You can also add it under the `[DEFAULT]` section for global application.

2. **Action Compatibility** : Ensure that if you only include the Pushover action, you also add an additional action like `iptables-allports` to maintain functionality in banning IPs.

### Final Steps

1. **Restart Fail2Ban** : After configuring all necessary jails, restart Fail2Ban to apply changes. If using Docker, this may involve restarting the relevant container.

2. **Monitoring Bans** : Upon successful bans, you should see log entries similar to:

By following these steps, you will have successfully integrated Pushover with Fail2Ban for effective intrusion protection notifications.
