abuseipdb action calls an external API with curl). So no dedicated Fail2ban integration is needed: add an action file to Fail2ban that POSTs the ban event to Flashduty’s standard alert event integration with curl, and send a recovery event on unban to close the alert.
In Flashduty On-call
You can get the push URL in either of the two ways below. In both cases choose Standard Alert Event as the integration type, not Fail2ban.
Dedicated integration
- In the Flashduty console, go to Channels and open a channel
- Go to Settings → Integrations → Dedicated integrations and click Add an integration
- Select Standard Alert Event and click Save
- Open the generated integration card and copy the Push URL, in the form
https://api.flashcat.cloud/event/push/alert/standard?integration_key=<integration_key>
Shared integration
- In the Flashduty console, go to Integration Center → Alert Events
- Select Standard Alert Event and enter an integration name
- Configure the default route and choose a channel; you can add more rules under Routes after creating it
- Click Save and copy the generated Push URL
Configure in Fail2ban
Run these steps on the host where Fail2ban runs, as root.
1
Create the action file
Create
/etc/fail2ban/action.d/flashduty.conf:<name>, <ip>, <failures> and <bantime> are tags Fail2ban substitutes when it runs the action (see Action Tags in jail.conf(5)): <name> is the jail name, <ip> the banned IP, <failures> the number of failures that caused the ban, and <bantime> the ban duration in seconds. flashduty_url is a custom parameter in [Init] that you pass from the jail.2
Enable it in a jail
Edit To notify for every jail, put these two
/etc/fail2ban/jail.local and add the flashduty action to each jail you want notifications for, passing the Flashduty push URL as flashduty_url. action can span several lines; keep the default ban action on the first line:action lines in the [DEFAULT] section.3
Reload and verify
banip bans an IP manually and unbanip unbans it. After the first command an alert titled Fail2ban sshd banned / 192.0.2.10 should appear in Flashduty, and the second command should close it. If nothing arrives, run the same curl command by hand on the host against the push URL; the response carries an error code. Fail2ban’s own errors are in /var/log/fail2ban.log.Field mapping
Recovery and deduplication
- Fail2ban runs
actionunbanwhen the ban time expires, and Flashduty closes the alert with the samealert_key. - With a permanent ban (
bantime = -1) the IP is never unbanned, so the alert does not close by itself. Enable auto-resolve timeout on the channel that receives this integration, or close the alert manually once handled. - A repeat ban of the same IP in the same jail updates the same alert instead of creating a duplicate.
norestored = 1stops Fail2ban from notifying for bans restored from its database after a restart, which would otherwise produce a burst of duplicate alerts.
Troubleshooting
- Flashduty receives nothing: confirm
fail2ban-client reloadwas run; call the push URL withcurlfrom the same host to check the response and that api.flashcat.cloud is reachable InvalidParameteris returned: the push URL is missingintegration_key, or the JSON was broken by quoting; make sure there are no stray line breaks in[Definition]- The alert does not recover: confirm
actionunbanexists and itsalert_keymatches the ban; permanent bans need auto-resolve timeout - Too many notifications: enable
flashdutyonly on jails that need a human response (for examplerecidiveor jails with a highmaxretry); ordinary mistyped-password bans do not need to notify