How UFW App Profiles Simplify Linux Firewall Rules

Uncomplicated Firewall (UFW) serves as a user-friendly frontend for iptables and nftables in Linux, designed to make network packet filtering straightforward. One of its most effective features is the application profile system, which abstracts complex network configurations by associating human-readable software names with their necessary ports and protocols. This article explains how UFW application profiles operate, where they are stored, and how administrators leverage them to manage firewall access without memorizing specific network ports.

What Are UFW Application Profiles?

UFW application profiles are simple text files located in the /etc/ufw/applications.d/ directory. When software packages such as OpenSSH, Apache, or Nginx are installed on a Debian or Ubuntu system, they automatically register a profile within this directory.

Each profile acts as a metadata dictionary containing:

For example, a profile for OpenSSH specifies port 22/tcp, while a profile for "Nginx Full" covers both HTTP (port 80/tcp) and HTTPS (port 443/tcp).

Viewing Available Profiles

Administrators can view all registered application profiles on a system by running:

sudo ufw app list

This output displays standard services that have provided profiles, such as OpenSSH, Nginx HTTP, or Postfix. To inspect the exact ports and protocols tied to a specific profile, use the app info command:

sudo ufw app info 'Nginx Full'

The system will return the ports managed by the profile, ensuring administrators understand exactly what network traffic will be permitted before applying any changes.

Applying Firewall Rules by Name

Instead of entering manual commands to open port 80 and port 443 individually, administrators can enable access using the profile name:

sudo ufw allow 'Nginx Full'

If traffic needs to be restricted exclusively to secure connections later on, switching rules is equally simple:

sudo ufw delete allow 'Nginx Full'
sudo ufw allow 'Nginx HTTPS'

UFW handles the underlying port mapping and firewall state adjustments automatically.

Creating Custom Application Profiles

Administrators can also create custom profiles for internal tools, microservices, or custom-configured daemons. By placing a custom configuration file into /etc/ufw/applications.d/, teams can enforce consistency across an infrastructure.

A custom file, such as /etc/ufw/applications.d/custom-api, uses an INI-style syntax:

[CustomAPI]
title=Internal REST API
description=Allows incoming traffic to internal microservice
ports=8080/tcp|8443/tcp

After creating the file, running sudo ufw app update CustomAPI registers the profile, allowing it to be used immediately in standard ufw allow or ufw deny statements.

Key Benefits of UFW App Profiles