Description
This check ensures that every Linode Cloud Firewall is attached to at least one device, such as a Linode or a NodeBalancer. A firewall only filters traffic for the resources it is assigned to, so a firewall with no devices provides no protection. Each firewall is evaluated separately.
Rationale
An unassigned firewall gives a false sense of security: its rules exist, but no traffic passes through it. Often the Linodes that were meant to be protected are left exposed to the internet. Unused firewalls also make the firewall list harder to review and maintain.
Impact
Attaching a firewall to a Linode immediately applies its rules and default policies to that Linode. Review the rules first so that required traffic (for example SSH, HTTP or HTTPS) is not blocked
Only inbound rules apply to NodeBalancers; outbound rules do not
If the firewall is not needed, deleting it is also a valid fix
Default Value
When a Cloud Firewall is created, attaching Linodes and NodeBalancers is optional, so a firewall can exist with no devices. Default firewalls for new Linodes can be set in Administration > Account Settings > Default Firewalls.
Pre-Requisites
A Cloud Manager user with read/write access to the firewall and to the Linodes or NodeBalancers being attached
For the CLI test plan: a Personal Access Token created by an unrestricted user with Firewalls: Read Only scope
Remediation
Test Plan
Console:
Sign in to Cloud Manager at https://cloud.linode.com.
In the sidebar, under Networking, click Firewalls and select the firewall.
Click the Linodes tab, then the NodeBalancers tab.
If both tabs are empty, the firewall is not assigned to any device.
Repeat for each firewall.
CLI:
Set the token:
export LINODE_TOKEN="<your-personal-access-token>"
List every firewall with the number of devices attached to it:
for
id in $(curl -s -H "Authorization: Bearer $LINODE_TOKEN"
"https://api.linode.com/v4/networking/firewalls?page_size=500"
| jq -r '.data[].id'); do
curl -s -H "Authorization:
Bearer $LINODE_TOKEN"
"https://api.linode.com/v4/networking/firewalls/$id/devices"
| jq --arg id "$id" '{firewall_id: $id, devices_count:
.results, devices: [.data[].entity.label]}'
done
A firewall passes if devices_count is 1 or more and fails if it is 0.
Implementation Steps
Console:
Sign in to Cloud Manager at https://cloud.linode.com.
In the sidebar, under Networking, click Firewalls and select the firewall that failed the check.
Review the rules on the Rules page and confirm they allow the traffic the device needs.
Click the Linodes tab (or the NodeBalancers tab).
Click Add Linodes to Firewall (or Add NodeBalancers to Firewall).
Select the Linode or NodeBalancer from the dropdown. If an interface dropdown is shown, select the interface to protect.
Click Add.
If the firewall is not needed, delete it instead of attaching it.
Repeat for each firewall that failed the check.
Backout Plan
Sign in to Cloud Manager at https://cloud.linode.com.
In the sidebar, under Networking, click Firewalls and select the firewall.
Click the Linodes tab (or the NodeBalancers tab).
Click Remove next to the device that was added.
Reference