-
Notifications
You must be signed in to change notification settings - Fork 731
Migrate AAA table per-command authorization in db_migrator #3296
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
Merged
liuh-80
merged 14 commits into
sonic-net:master
from
liuh-80:dev/liuh/enable-per-command-authorization
May 15, 2024
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
50e8581
Enable per-command authorization in db_migrator
liuh-80 991150c
Move test case to new class
liuh-80 ceb6613
Fix code error
liuh-80 aac4f8e
Improve UT
liuh-80 316a9c6
Improve UT
liuh-80 316c179
Fix code
liuh-80 c1c277b
Enable test message to debug
liuh-80 752ae43
Improve debug information
liuh-80 5047096
Improve code and test case
liuh-80 61e9f3a
Add both accoutning and authorization
liuh-80 b35dc64
Add minrate method
liuh-80 66bb884
Merge remote-tracking branch 'origin' into dev/liuh/enable-per-comman…
liuh-80 6633383
Fix code by PR comments
liuh-80 f3afd81
Improve code
liuh-80 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -840,6 +840,18 @@ def migrate_aaa(self): | |
self.configDB.set_entry("AAA", "accounting", accounting_new) | ||
log.log_info('Migrate AAA accounting: {}'.format(accounting_new)) | ||
|
||
# setup per-command authorization | ||
tacplus_config = self.configDB.get_entry('TACPLUS', 'global') | ||
if 'passkey' in tacplus_config and '' != tacplus_config.get('passkey'): | ||
authorization = self.configDB.get_entry('AAA', 'authorization') | ||
if not authorization: | ||
authorization_new = aaa_new.get("authorization") | ||
self.configDB.set_entry("AAA", "authorization", authorization_new) | ||
log.log_info('Migrate AAA authorization: {}'.format(authorization_new)) | ||
else: | ||
# If no passkey, setup per-command authorization will block remote user command | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, disable authorization by delete entry. |
||
log.log_info('TACACS passkey does not exist, ignore setup per-command authorization.') | ||
|
||
def version_unknown(self): | ||
""" | ||
version_unknown tracks all SONiC versions that doesn't have a version | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide a table to analyze the old_config, new_config, actions for all the situations?
#Closed
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to your comments in #3284:
qiluo-msft 2 weeks ago
The old image's enablement does not matter. As long as the required passkey is there, and intention is to enable, then we should enable.
So, we only check the new config: