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

[HLD] Dynamic ACL rule high-level design doc #952

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bingwang-ms
Copy link
Contributor

This PR is a high-level design doc for dynamic ACL rules.
We propose a design to add TTL to ACL rules, and the rules are cleared after TTL expired.

bingwang-ms and others added 3 commits February 24, 2022 13:11
Signed-off-by: bingwang <wang.bing@microsoft.com>
Signed-off-by: bingwang <wang.bing@microsoft.com>
Signed-off-by: bingwang <bingwang@microsoft.com>
@bingwang-ms bingwang-ms requested a review from Blueve March 1, 2022 06:01

1. Test case 1 Verify dynamic ACL rule is created as expected
2. Test case 2 Verify dynamic ACL rule can be refreshed
3. Test case 3 Verify expired dynamic ACL rule can be removed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add more tests for negative operations:

  1. Convert static ACL rule to dynamic ACL rule is not allowed
  2. dynamic ACL should be removed from config_db after reboot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second one dynamic ACL should be removed from config_db after reboot makes sense to me. I'll add a test case to verify dynamic ACL is cleared after config reload or reboot.
But why do we need the first verification Convert static ACL rule to dynamic ACL rule is not allowed?

Copy link
Contributor

@Blueve Blueve Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case someone change existing static rules to dynamic rules.
For dynamic ACL, the basic principle should be JIT change. The state of switch shouldn't be changed after dynamic ACL expired.

Consider below use case:

  1. Someone pushed a dynamic rule that have exact same name with existing static rule
  2. The rule will be removed after it expired, the switch no longer have that static rule anymore

We should prevent override static rule by pushing dynamic rule. Otherwise the dynamic rule will have side-effect after it expired.

#### Unit Test cases

1. Enhance unit test for `acl-loader` to verify ACL rule with TTL is created as expected; verify `ACL_TTL_TABLE` entry is created as expected.
2. Add unit test for `acl_ttl_checker` to verify expired ACL entries are cleared.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test to ensure acl_ttl_checker can only remove is_dynamic: true entry from config db.

3. Test case 3 Verify expired dynamic ACL rule can be removed

## Open questions
1. memory leak issue detection and validation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What could cause memory leak in current context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is supposed to be no memory leak in this context. The question here is as a reminder that we are lack of verification of memory leak issues for daemon process.

@yxieca yxieca force-pushed the master branch 2 times, most recently from 8498931 to 8837dc2 Compare April 15, 2022 16:51

#### acl_ttl_checker

A helper script will be added to `swss` container. The checker is started after `orchagent` and check the TTL of dynamic ACL rules every 10 seconds by default. It will walk through all entries in `ACL_TTL_TABLE` and delete the corresponding `ACL_RULE` from `config_db` if
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why cannot incorporate into the orchagent?

### Work flow
#### Add dynamic ACL rule
<p align=center>
<img src="img/dynamic_acl_creation.png" alt="Figure 1. Create dynamic ACL rule workflow">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to have orchagent update the state_db for ACL_TTL_TABLE and update the timestamp and ttl. Let's not have acl-loader directly update the state_DB

</p>

#### Remove ACL rule when TTL expires
<p align=center>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if user does a 'config save" during the time acl rule is active? A future config reload can re-install the rule.

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.

None yet

4 participants