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

firewall: automation: Explore UI possibilities (POC) #8367

Open
25 of 28 tasks
Monviech opened this issue Feb 21, 2025 · 7 comments · May be fixed by #8377
Open
25 of 28 tasks

firewall: automation: Explore UI possibilities (POC) #8367

Monviech opened this issue Feb 21, 2025 · 7 comments · May be fixed by #8377
Assignees

Comments

@Monviech
Copy link
Member

Monviech commented Feb 21, 2025

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

Since the legacy firewall UI pages are at some point, well, um, legacy, there has to be a replacement at some point. The most valid replacement right now is "Firewall: Automation: Filter", which uses the modern mvc framework to generate and display its rules.

The only issue with that, is the User Experience. 10 or 20 firewall rules should not be an issue, but if the view scales up to 100 or 1000 elements even, there could be usability issues.

Describe the solution you like

Brainstorm the possibilites of improving UX in that view to prepare for the future:

Prime directives:

  • The consistent sequence of rules in the view at all times
  • Do not stray too far from what the framework established
    • (There is some hacky stuff in the FilterController to inject the legacy internal rules into searchRuleAction to show them in the bootgrid. Though the actual API output has not been altered, these rules can be added to the output via type in the request.)

General UX:

  • Move the current code to the reusable grid structure to expose all options

  • Ensure firewall rules cannot be sorted (would destroy consistent sequence)

  • Create custom formatters to replicate the old legacy firewall view as first step

  • Custom commands to change the sequence of a rule relative to the other rules, this needs some controller magic

  • Show change message when custom command was used.

  • Analyze the basic needs of a firewall rule, and selectively hide more fields in advanced view or auto collapsed headers inside the main form. For maintainability, having all fields in the same general form is the best.

  • Restrict size of bootgrid dropdown like here:

  • Create AutoNumberField that automatically increases by 10, and not 1. This will help in larger rulesets where you want to set rules between other rules later on. If the sequence is always unbroken, youd need to move a rule up like 500 times or so after creation at the bottom of the ruleset. Increase allowed sequence to 99.999.

  • Maybe increment by 100 per default and increase max sequence to 999.999 to leave more space inbetween rules.

  • When cloning, the auto number field does not automatically take a new sequence. Add a button that will fill in the next free sequence.

  • Collect all fields that are marked as advanced, and if one of them is not null/empty, display a symbol in in the icons of the rule, and also show in a tooltip which option it is. Additionally trigger the advanced mode automatically.

  • The custom move up and down commands can also work while categories or search is used.

  • Implement a "move rule before other rule" button. Auto calculate the sequence so no micro management of it needs to happen.

  • Show Alias shortcut in grid

  • Show selectpicker with all interface names/ interface groups with possibility or multi selection, request handler to filter the grid based on interface selection. This selectpicker should be in the action bar, at the left side. To populate it, we need an API endpoint that collects all interfaces currently used in rules (also the automatic ones).

  • Change default pagination to e.g. 14 as default, 7 seems too low.

  • Solution for automatic rules visibility, maybe just another grid that uses a search endpoint to list them.

    • This one will be a bit trickier, thoughts:
    • Write a wrapper and pass them through configd.
    • Resolve real interface names in the wrapper script.
    • Normalize the legacy data structure to resemble the automation model structure
    • Create merged data that combines legacy and automation rules for use with UIModelGrid
    • Use this merged data in searchRuleAction(), this fixes pagination issues etc...
    • Do not show rowtoggle and command buttons for internal rules
    • Show firewall rule search button with #ref for internal rules
  • Solution for diagnostics per rule (hits etc... like the old Inspect button), maybe they can be collected from an endpoint and injected as additional columns via formatter.

  • Categories work, new ones can be added in "/ui/firewall/category".

Describe alternatives you considered

Rebuilding the current legacy firewall view as closely as possible with no further additions.

Additional context

This is a POC, nothing that is written here or investigated will be a guarantee.

@Monviech Monviech self-assigned this Feb 21, 2025
Monviech added a commit that referenced this issue Feb 21, 2025
…uence to auto number field and require uniqueness, split view from filter.volt to filter_rule.volt to test things without causing regressions in other controllers using the same view, construct form with almost same layout as old firewall form hiding most options under advanced that are not needed for creating basic rules, for #8367
Monviech added a commit that referenced this issue Feb 21, 2025
…stination and interface. Append icon column to grid. For #8367
Monviech added a commit that referenced this issue Feb 22, 2025
Monviech added a commit that referenced this issue Feb 22, 2025
…es with each other. Change position of the source and destination inversions in form. Replace Port and Sequence labels in Grid view to safe space. Ensure sequence is always ascending and cannot be sortet. For #8367
Monviech added a commit that referenced this issue Feb 23, 2025
…the sequence. Animate sequence change. Display Change message on sequence change. For #8367
@Monviech Monviech linked a pull request Feb 25, 2025 that will close this issue
@mimugmail
Copy link
Member

I'm not sure if it's the correct move, to switch a feature which is intended to act as an api endpoint to a UX / UI rewrite of the old rules. In complex setups you need some kind of scripting and automation like with ansible to add rules. There is no need to have a nice look at those rules on the end system, as they are managed by some other instance like ansible or puppet.
This will break make existing setups.

It would be smarter to rewrite the old ones from scratch of clone the automation base.

@AdSchellevis
Copy link
Member

@mimugmail Eventually you would like to have only a single view on the rules, but adding an api layer on top of the legacy rules will have a higher regression risk and duplicates the things we already have. Which means its more practical to extend the existing api parts so they can serve the ui (in the same way all other mvc components do)

@mimugmail
Copy link
Member

@AdSchellevis the main problem is, that rewriting rules and taking automation as the base, make current external implementations and use-cases of automation useless. If I understand correctly, you want to enrich automations with (GUI) features so it can take over service at some point in favor of legacy rules.

But when you already rely on automation rules, where it's totally clear that no human will ever add/remove/edit rules, this will break every logic. To me, the current state is perfect. You have interface rules which everyone can edit (like end customers), then you have automation rules on top of it, so an admin oder MSP can overrule things, but as a last resort end user can still overrule with floating. No automation tool can kill existing rules, no user can break automation.

Imagine a corporate network with 1000 users and above, maybe there is a small network team inside which want to do daily tasks, but still, the network is managed by a MSP, so they can have preference while still IT stuff don't need for tickets to be done. :)

@AdSchellevis
Copy link
Member

@mimugmail the api part should be backwards compatible, there's already a ui on top of it, but very limited.

It wasn't intended to act as an acl barrier to be honest. In most cases it doesn't make sense to have 2 components performing the same task, the current construct was always intended to replace the existing one (even by the customer paying for it at the time). Deprecating the legacy component will likely take quite some time and might be kept alive for quite time.

@mimugmail
Copy link
Member

Ok, my concern is that currently the ansible playbooks create rules with sequence numbers via automation.
If you add UI magic to automation and let the users allow to create rules there, and if I saw correctly, you add autoincrement to sequence numbers .. it feels like breaking things.

Maybe I'm wrong ... but from outside, reading the only the topic itself "firewall", "automation" and "explore UI possibilities" is the wrong approach.

@AdSchellevis
Copy link
Member

It starts with a poc, but the existing api calls and their meaning is certainly a valid concern (and something we're investigating).

The acl boundary is just less of a concern, I do understand people might use the split approach, but that's less a design choice from our end. The intention to use this as our main firewall was always the case (see also the original ticket opnsense/plugins#1720)

@Monviech
Copy link
Member Author

The unique constraint has been removed from the sequence field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants