UniFi

Total Time Required

20 minutes

Difficulty

Easy

Required Knowledge

Crowdsec, UniFi

Drawing

Prerequisites

This stack monitors...

  • Syslog data from UniFi controller

  • Crowdsec blocklists

  • Crowdsec whitelists

... And changes

  • UniFi firewall

UniFi changes

Service account

You will need to generate a service account for the UniFi bouncer to log into and use

  1. Untick "Admin Permissions"

  2. Create a new user and fill out the below

    First name

    Crowdsec

    Last name

    Bouncer

    Admin

    True

    Restrict to local access

    True

    Username

    <randomly generated>

    Password

    <randomly generated>

    Use a predifined role

    False

    Unifi

    Full managemen

    OTHER ROLES

    None

  3. Save your username and password to your text editor

  4. Click on Create

circle-exclamation

Forward Logs

  1. Set Syslog to SIEM server or external

  2. Set the server address to the IP of the machine that will run this stack

  3. Click on Apply Changes

Enable Firewall zones

  1. Enable Firewall zones

circle-exclamation

Deploy Compose stack

Fill out the below env file and deploy your stack

https://github.com/trentnbauer/HomelabPublic/blob/main/docker-compose/crowdsec-unifi.yml

Confirm the bouncer has logged into the account

  1. Review the list and find Crowdsec Bouncer - the last activity should state "now"

If not, review the bouncer and engine container logs

Host Firewall

Allow your syslog port through the firewall (by default 514)

Enroll the engine

  1. Locate the UniFi in the enrollment list

  2. Enrol the engine

  3. Wait 5 minutes

Check UniFi firewall rules exit

  1. You will have a stack of "cs-unifi-bouncer" rules

Last updated