SUSE Support

Here When You Need Us

Logging all inbound and outbound traffic with firewalld direct rules

This document (000020833) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15 SP4
SUSE Linux Enterprise Server for SAP Applica­tions 15 SP4
SUSE Linux Enterprise Server 15 SP3
SUSE Linux Enterprise Server for SAP Applica­tions 15 SP3

Situation

This document details how to enable the logging of all inbound and outbound traffic using firewalld direct rules.

Resolution

Pre-requisites
  • firewalld.service must be started.

Rule to log all incoming traffic setting log level to 4:

firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -p all -s 0.0.0.0/0 -j LOG --log-prefix "INPUT " --log-level 4

Rule to log all outgoing traffic setting log level to 4:

firewall-cmd --direct --add-rule ipv4 filter OUTPUT 0 -p all -s 192.168.1.10 -j LOG --log-prefix "OUTPUT " --log-level 4

With nftables as backend, direct rules are given a higher precedence than all other firewalld rules.

To check if the rules are applied:

firewall-cmd --direct --get-all-rules

To make the rules permanent:

firewall-cmd --runtime-to-permanent

To list all direct permanent rules:

firewall-cmd --direct --get-all-rules --permanent

Traffic logs are written in /var/log/firewall
 

Additional Information

Reference:
  • Firewalld direct rules man pages -  https://firewalld.org/documentation/man-pages/firewalld.direct.html  
  • Nftables backend man pages -  https://firewalld.org/2018/07/nftables-backend

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020833
  • Creation Date: 28-Oct-2022
  • Modified Date:01-Nov-2022
    • SUSE Linux Enterprise Server
    • SUSE Linux Enterprise Server for SAP Applications

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.