crowdsec-mikrotik-bouncer
crowdsec-mikrotik-bouncer
Docker app from Darklesc's Repository
Overview
This repository aim to implement a CrowdSec bouncer for the router Mikrotik to block malicious IP to access your services. For this it leverages Mikrotik API to populate a dynamic Firewall Address List.
Requirements
Prerequisites:
Generate a bouncer API key following CrowdSec documentation https://doc.crowdsec.net/docs/cscli/cscli_bouncers_add/
cscli bouncers add Mikrotik-0
Activate API in mikrotik
IP -> Service -> Enable api and apply security
Procedure:
1 Get a bouncer API key from your CrowdSec with command cscli bouncers add mikrotik-bouncer
2 Copy the API key printed. You WON'T be able the get it again.
3 Paste this API key as the value for bouncer environment variable CROWDSEC_BOUNCER_API_KEY, instead of "MyApiKey"
4 Start bouncer with docker-compose up bouncer in the example directory
5 Create IP drop Filter Rules in input and forward Chain with the crowdsec Source Address List
6 Create IPv6 drop Filter Rules in input and forward Chain with the crowdsec Source Address List (if IPv6 used)
/ip/firewall/filter/
add action=drop src-address-list=crowdsec chain=input in-interface=your-wan-interface place-before=0 comment="crowdsec input drop rules"
add action=drop src-address-list=crowdsec chain=forward in-interface=your-wan-interface place-before=0 comment="crowdsec forward drop rules"
/ipv6/firewall/filter/
add action=drop src-address-list=crowdsec chain=input in-interface=your-wan-interface place-before=0 comment="crowdsec input drop rules"
add action=drop src-address-list=crowdsec chain=forward in-interface=your-wan-interface place-before=0 comment="crowdsec forward drop rules"
Generate a bouncer API key following CrowdSec documentation https://doc.crowdsec.net/docs/cscli/cscli_bouncers_add/
cscli bouncers add Mikrotik-0
Activate API in mikrotik
IP -> Service -> Enable api and apply security
Procedure:
1 Get a bouncer API key from your CrowdSec with command cscli bouncers add mikrotik-bouncer
2 Copy the API key printed. You WON'T be able the get it again.
3 Paste this API key as the value for bouncer environment variable CROWDSEC_BOUNCER_API_KEY, instead of "MyApiKey"
4 Start bouncer with docker-compose up bouncer in the example directory
5 Create IP drop Filter Rules in input and forward Chain with the crowdsec Source Address List
6 Create IPv6 drop Filter Rules in input and forward Chain with the crowdsec Source Address List (if IPv6 used)
/ip/firewall/filter/
add action=drop src-address-list=crowdsec chain=input in-interface=your-wan-interface place-before=0 comment="crowdsec input drop rules"
add action=drop src-address-list=crowdsec chain=forward in-interface=your-wan-interface place-before=0 comment="crowdsec forward drop rules"
/ipv6/firewall/filter/
add action=drop src-address-list=crowdsec chain=input in-interface=your-wan-interface place-before=0 comment="crowdsec input drop rules"
add action=drop src-address-list=crowdsec chain=forward in-interface=your-wan-interface place-before=0 comment="crowdsec forward drop rules"
Runtime arguments
- Network
bridge- Shell
sh- Privileged
- false
Template configuration
CROWDSEC BOUNCER API KEYVariable
- Target
- CROWDSEC_BOUNCER_API_KEY
- Default
- your-api-key
- Value
- your-api-key
CROWDSEC URLVariable
- Target
- CROWDSEC_URL
- Default
- http://crowdsec:8080/
- Value
- http://crowdsec:8080/
MIKROTIK HOSTVariable
- Target
- MIKROTIK_HOST
- Default
- your-ip-mikrotik:8728
- Value
- your-ip-mikrotik:8728
MIKROTIK USERVariable
- Target
- MIKROTIK_USER
- Default
- your-mirkotik-user
- Value
- your-mirkotik-user
MIKROTIK PASSVariable
- Target
- MIKROTIK_PASS
- Default
- your-mikrotik-pass
- Value
- your-mikrotik-pass
MIKROTIK IPV6Variable
- Target
- MIKROTIK_IPV6
- Default
- true
- Value
- true
MIKROTIK TLSVariable
- Target
- MIKROTIK_TLS
- Default
- true
- Value
- true
CROWDSEC ORIGINSVariable
- Target
- CROWDSEC_ORIGINS
- Default
- none
- Value
- none
LOG LEVELVariable
- Target
- LOG_LEVEL
- Default
- 1
- Value
- 1
Categories
Download Statistics
524
Total Downloads
Details
Repository
ghcr.io/funkolab/cs-mikrotik-bouncer:latestLast Updated2022-05-22
First Seen2024-12-09
Run crowdsec-mikrotik-bouncer on Unraid.
crowdsec-mikrotik-bouncer is listed in Community Apps for Unraid OS. Explore Unraid to build a flexible home server, NAS, or homelab.