Loading

pfSense Integration for Elastic

Serverless Observability Serverless Security Stack 9.0.0

Version 1.25.0 (View all)
Subscription level
What's this?
Basic
Developed by
What's this?
Community
Ingestion method(s) Network Protocol

The pfSense integration enables you to collect and parse logs from pfSense and OPNsense firewalls. By ingesting these logs into the Elastic Stack, you can monitor network traffic, analyze security events, and gain comprehensive visibility into your network's health and security. This integration supports log collection over syslog, making it easy to centralize firewall data for analysis and visualization.

This integration facilitates:

  • Monitoring firewall accept/deny events.
  • Analyzing VPN, DHCP, and DNS activity.
  • Auditing system and authentication events.
  • Visualizing network traffic through pre-built dashboards.

This integration is compatible with recent versions of pfSense and OPNsense. It requires Elastic Stack version 8.11.0 or higher.

The pfSense integration works by collecting logs sent from pfSense or OPNsense devices via the syslog protocol. An Elastic Agent is set up on a host designated as a syslog receiver. The firewall is then configured to forward its logs to this agent. The agent processes and forwards the data to your Elastic deployment, where it is parsed, indexed, and made available for analysis in Kibana. The integration supports both UDP and TCP for log transport.

This integration collects several types of logs from pfSense and OPNsense, providing a broad view of network and system activity. The supported log types include:

  • Firewall: Logs detailing traffic allowed or blocked by firewall rules.
  • Unbound: DNS resolver logs.
  • DHCP Daemon: Logs related to DHCP lease assignments and requests.
  • OpenVPN: Virtual Private Network connection and status logs.
  • IPsec: IP security protocol logs for VPN tunnels.
  • HAProxy: High-availability and load balancer logs.
  • Squid: Web proxy access and system logs.
  • PHP-FPM: Logs related to user authentication events in the web interface.

Logs that do not match these types will be dropped by the integration's ingest pipeline.

  • A pfSense or OPNsense firewall with administrative access to configure log forwarding.
  • Network connectivity between the firewall and the Elastic Agent host.
  • An installed Elastic Agent to receive the syslog data.

Elastic Agent must be installed on a host that will receive the syslog data from your pfSense or OPNsense device. For detailed installation instructions, refer to the Elastic Agent installation guide. Only one Elastic Agent is needed per host.

  1. Log in to the pfSense web interface.
  2. Navigate to Status > System Logs, and then click the Settings tab.
  3. Scroll to the bottom and check the Enable Remote Logging box.
  4. In the Remote log servers field, enter the IP address and port of your Elastic Agent host (e.g., 192.168.1.10:9001).
  5. Under Remote Syslog Contents, you have two options:
    • Syslog format (Recommended): Check the box for Syslog format. This format provides the firewall hostname and proper timezone information in the logs.
    • BSD format: If you use the default BSD format, you must configure the Timezone Offset setting in the integration policy in Kibana to ensure timestamps are parsed correctly.
  6. Select the logs you wish to forward. To capture logs from packages like HAProxy or Squid, you must select the Everything option.
  7. Click Save.

For more details, refer to the official pfSense documentation.

  1. Log in to the OPNsense web interface.
  2. Navigate to System > Settings > Logging / Targets.
  3. Click the + (Add) icon to create a new logging target.
  4. Configure the settings as follows:
    • Transport: Choose the desired transport protocol (UDP, TCP).
    • Applications: Leave empty to send all logs, or select the specific applications you want to monitor.
    • Hostname: Enter the IP address of the Elastic Agent host.
    • Port: Enter the port number the agent is listening on.
    • Certificate: (For TLS only) Select the appropriate client certificate.
    • Description: Add a descriptive name, such as "Syslog to Elastic".
  5. Click Save.
  1. In Kibana, navigate to Management > Integrations.
  2. Search for "pfSense" and select the integration.
  3. Click Add pfSense.
  4. Configure the integration by selecting an input type and providing the necessary settings. The module is configured by default to use the UDP input on port 9001.

This input collects logs over a UDP socket.

Setting Description
Syslog Host The bind address for the UDP listener (e.g., 0.0.0.0 to listen on all interfaces).
Syslog Port The UDP port to listen on (e.g., 9001).
Internal Networks A list of your internal IP subnets. Supports CIDR notation and named ranges like private.
Timezone Offset If using BSD format logs, set the timezone offset (e.g., -05:00 or EST) to correctly parse timestamps. Defaults to the agent's local timezone.
Preserve original event If checked, a raw copy of the original log is stored in the event.original field.

This input collects logs over a TCP socket.

Setting Description
Syslog Host The bind address for the TCP listener (e.g., 0.0.0.0).
Syslog Port The TCP port to listen on (e.g., 9001).
Internal Networks A list of your internal IP subnets.
Timezone Offset If using BSD format logs, set the timezone offset to correctly parse timestamps.
SSL Configuration Configure SSL options for encrypted communication. See the SSL documentation for details.
Preserve original event If checked, a raw copy of the original log is stored in the event.original field.

After configuring the input, assign the integration to an agent policy and click Save and continue.

  1. First, verify on your pfSense or OPNsense device that logs are being actively sent to the configured Elastic Agent host.
  2. In Kibana, navigate to Discover.
  3. In the search bar, enter data_stream.dataset: "pfsense.log" and check for incoming documents.
  4. Verify that events are appearing with recent timestamps.
  5. Navigate to Dashboard and search for the pfSense dashboards to see if the visualizations are populated with data.

For help with Elastic ingest tools, check Common problems.

  • No data is being collected:
    • Verify network connectivity between the firewall and the Elastic Agent host.
    • Ensure there are no firewalls or network ACLs blocking the syslog port.
    • Confirm that the listening port in the integration policy matches the destination port on the firewall.
  • Incorrect Timestamps:
    • If using the default BSD log format from pfSense, ensure the Timezone Offset is correctly configured in the integration settings in Kibana. The recommended solution is to switch to the Syslog format on the pfSense device.

For more information on architectures that can be used for scaling this integration, check the Ingest Architectures documentation.

The log data stream collects and parses all supported log types from the pfSense or OPNsense firewall.

These inputs can be used with this integration:

<details> <summary>tcp</summary>

For more details about the TCP input settings, check the Filebeat documentation.

To collect logs via TCP, select Collect logs via TCP and configure the following parameters:

Required Settings:

  • Host
  • Port

Common Optional Settings:

  • Max Message Size - Maximum size of incoming messages
  • Max Connections - Maximum number of concurrent connections
  • Timeout - How long to wait for data before closing idle connections
  • Line Delimiter - Character(s) that separate log messages

To enable encrypted connections, configure the following SSL settings:

SSL Settings:

  • Enable SSL*- Toggle to enable SSL/TLS encryption
  • Certificate - Path to the SSL certificate file (.crt or .pem)
  • Certificate Key - Path to the private key file (.key)
  • Certificate Authorities - Path to CA certificate file for client certificate validation (optional)
  • Client Authentication - Require client certificates (none, optional, or required)
  • Supported Protocols - TLS versions to support (e.g., TLSv1.2, TLSv1.3)

Example SSL Configuration:

ssl.enabled: true
ssl.certificate: "/path/to/server.crt"
ssl.key: "/path/to/server.key"
ssl.certificate_authorities: ["/path/to/ca.crt"]
ssl.client_authentication: "optional"
		

</details> <details> <summary>udp</summary>

For more details about the UDP input settings, check the Filebeat documentation.

To collect logs via UDP, select Collect logs via UDP and configure the following parameters:

Required Settings:

  • Host
  • Port

Common Optional Settings:

  • Max Message Size - Maximum size of UDP packets to accept (default: 10KB, max: 64KB)
  • Read Buffer - UDP socket read buffer size for handling bursts of messages
  • Read Timeout - How long to wait for incoming packets before checking for shutdown

</details>

This integration includes one or more Kibana dashboards that visualizes the data collected by the integration. The screenshots below illustrate how the ingested data is displayed.