Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: Add interactive firewall rule editor plugin #294

Merged
merged 7 commits into from
Nov 29, 2022

Conversation

Dorthu
Copy link
Member

@Dorthu Dorthu commented Mar 31, 2022

📝 Description

This change adds an interactive rule editor for Linode firewalls. This is necessary as it allows users to modify their firewall from the CLI without needing to manually specify every rule on update.

✔️ How to Test

The editor can be accessed by running the following command:

linode-cli firewall-editor {firewall_id}

📷 Preview

Primary View

29BD737B-592E-4E0B-9A7E-A4222B2891FE

Adding a Rule

ADD0B541-7B7B-47FE-BCD1-7164114BF91F

Removing a Rule

75125E92-DE31-449F-B34E-8520DD71760D_4_5005_c

Swapping Rules

D5D9B0B8-0B02-485A-88D6-E1612DF87BBF_4_5005_c

📖 Notes

After discussing with the firewall team, it seems like automated
inserting of individual firewall rules isn't a great idea; the rules are
applied immediately as changes are made, and since these rules are
applied in order, with the first matching rule being acted on, it's easy
to accidentally set up an insecure configuration. To make matters
worse, there is no good way to identify a single rule from the response;
labels are not required and don't have to be unique, and no other
reasonable choice for an identifier is present. As such, automated
systems that manage firewall rules should, for that reason, regenerate
the entire ruleset for each update; for applications that want to modify
the existing rules, they should follow a fetch-update-publish model.

Resolves #293

This relates to #293

After discussing with the firewall team, it seems like automated
inserting of individual firewall rules isn't a great idea; the rules are
applied immediately as changes are made, and since these rules are
applied in order, with the first matching rule being acted on, it's easy
to accidentally set up an insecure configuration.  To make matters
worse, there is no good way to identify a single rule from the response;
labels are not required and don't have to be unique, and no other
reasonable choice for an identifier is present.  As such, automated
systems that manage firewall rules should, for that reason, regenerate
the entire ruleset for each update; for applications that want to modify
the existing rules, they should follow a fetch-update-publish model.

This PR is an attempt at the latter for the CLI; a plugin that allows
interactive editing of firewall rules.  This is by no means perfect -
there are still several TODOs in the code, and it could generally be
cleaner - but it should serve as an example of what we might want.o

The interface looks this like:

```
Firewall: example       Status: enabled
Inbound Policy: DROP      Outbound Policy: DROP

Inbound Rules:
 ind | label | protocol | action | ports | addresses
-----+-------+----------+--------+-------+-------------------
 0   |       | TCP      | ACCEPT | 80    | 192.168.12.34/32
 1   |       | TCP      | ACCEPT |       | 12.34.56.0/24

Outbound Rules:
 ind | label | protocol | action | ports | addresses
-----+-------+----------+--------+-------+---------------
 2   | test  | UDP      | ACCEPT |       | 12.34.56.0/24

Global: Toggle [I]nbound or [O]utbound Policy
Rules: [A]dd, [R]emove, or [S]wap
[W]rtie settings or [Q]uit
Saving..
Rules updated successfully!
```

Feedback appreciated
@lgarber-akamai lgarber-akamai changed the title Proposal: Interactive firewall rule editor new: Add interactive firewall rule editor plugin Nov 21, 2022
@lgarber-akamai lgarber-akamai merged commit fc434b8 into master Nov 29, 2022
@lgarber-akamai lgarber-akamai deleted the feature/interactive-firewall-plugin branch January 3, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants