Send pfSense Logs to Wazuh

This guide covers forwarding pfSense logs to Wazuh using syslog-ng. First, Wazuh must be configured to receive remote syslog messages from pfSense.

Configure Wazuh to Receive Syslog

SSH into the server running Wazuh.

Allow UDP port 514 through the firewall:

Terminal
sudo ufw allow 514/udp

Edit the Wazuh configuration file:

Terminal
sudo nano /var/ossec/etc/ossec.conf

Inside the <ossec_config> block, add the following:
Replace PFSenseIP with the IP address of your pfSense device.
Replace WazuhServerIP with the IP address of your Wazuh server.

ossec.conf
<remote>
  <connection>syslog</connection>
  <port>514</port>
  <protocol>udp</protocol>
  <allowed-ips>PFSenseIP</allowed-ips>
  <local_ip>WazuhServerIP</local_ip>
</remote>

Save and exit:
In nano, press CTRL+O, then Enter to save. Press CTRL+X to exit.


Restart the Wazuh manager:

Terminal
sudo systemctl restart wazuh-manager

Install syslog-ng on pfSense

  1. Log in to the pfSense Web Configurator.
  2. Click the 'System' dropdown.
  3. Select 'Package Manager'.
  4. Search for 'syslog-ng'.
  5. Click '+ Install'.
  6. Click 'Confirm'.

Enable syslog-ng

  1. Click the 'Services' dropdown.
  2. Select 'Syslog-ng'.
  3. Check the box next to 'Enable'.
  4. Set 'Interface Selection' to 'Loopback'.
  5. Click 'Save'.

Configure pfSense Remote Logging

  1. Click the 'Status' dropdown.
  2. Select 'System Logs'.
  3. Click the 'Settings' tab.
  4. Set 'Log Message Format' to 'syslog'.
  5. Check the box next to 'Enable Remote Logging'.
  6. Set 'Remote Log Servers' to:
127.0.0.1:5140
  1. Next to 'Remote Syslog Contents', select the log types you want forwarded to Wazuh.
  2. Click 'Save'.

Port 5140 is the local pfSense syslog-ng listener. Wazuh will receive logs on UDP port 514.

Confirm Logs Are Reaching syslog-ng

  1. Click the 'Services' dropdown.
  2. Select 'Syslog-ng'.
  3. Click the 'Log Viewer' tab.
  4. If logs are appearing here, pfSense is successfully sending logs to syslog-ng.

Create the Wazuh Destination in syslog-ng

  1. Click the 'Advanced' tab.
  2. Click '+ Add'.
  3. Enter an object name, such as 'WazuhDestination'.
  4. Set 'Object Type' to 'Destination'.
  5. In 'Object Parameters', enter the following:
{ network("WazuhServerIP" transport(udp) port(514) localip(PFSenseIP)); };

Replace WazuhServerIP with the IP address of your Wazuh server. Replace PFSenseIP with the IP address of your pfSense device.

  1. Add a relevant description.
  2. Click 'Save'.

Create the syslog-ng Log Rule

  1. Click '+ Add'.
  2. Enter an object name, such as 'SendToWazuh'.
  3. Set 'Object Type' to 'Log'.
  4. In 'Object Parameters', enter the following:
{ source(_DEFAULT); destination(WazuhDestination); };
  1. Add a relevant description.
  2. Click 'Save'.

Verify Logs in Wazuh

It may take a minute for new logs to appear in the Wazuh Web Interface.

You can also verify traffic is reaching the Wazuh server by running:

Terminal
sudo tcpdump -ni any port 514

If packets are visible, pfSense is sending logs to Wazuh.

Recommended Starting Point

Start by forwarding only firewall logs. Once you confirm logs are arriving correctly, you can add DHCP, DNS, VPN, and other pfSense log categories.


Loading...