-
Notifications
You must be signed in to change notification settings - Fork 86
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
TACACSPLUS_PASSKEY_ENCRYPTION support Part - II #81
Open
nmoray
wants to merge
18
commits into
sonic-net:master
Choose a base branch
from
nmoray:tacacs_pass_encrypt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8b909b8
TACACSPLUS_PASSKEY_ENCRYPTION support
nmoray 48e7d1d
code cleanup
nmoray c877edb
Added syslogs
nmoray b37ddcd
Removed debug prints
nmoray 945f4f2
Fixed AUT issues
nmoray 5b61c0c
Fixed build issues
nmoray 7cb53e6
Fixed build issues
nmoray 43641de
fixed build issues
nmoray 66b57b5
Added a check for passkey before appending into server configs
nmoray c6c8e0a
Fixed build issues
nmoray 977a268
TACACSPLUS_PASSKEY_ENCRYPTION support
nmoray a7d01d6
Merge branch 'tacacs_pass_encrypt' of https://github.com/nmoray/sonic…
nmoray 0a1b098
Fixed AUT issue
nmoray 7b14786
Fixed build issues
nmoray 911e2c0
Addressed comments
nmoray bb5e5ee
Incorporated security cipher class into the existing implemenatation
nmoray d745364
Added a logic to remove the cipher pass file file encryption is disabled
nmoray 1d85eb6
Updated class name
nmoray 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 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 |
---|---|---|
|
@@ -17,6 +17,7 @@ from sonic_py_common.general import check_output_pipe | |
from swsscommon.swsscommon import ConfigDBConnector, DBConnector, Table | ||
from swsscommon import swsscommon | ||
from sonic_installer import bootloader | ||
from sonic_py_common.security_cipher import master_key_mgr | ||
|
||
# FILE | ||
PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" | ||
|
@@ -75,7 +76,6 @@ DEFAULT_FIPS_RESTART_SERVICES = ['ssh', 'telemetry.service', 'restapi'] | |
CFG_DB = "CONFIG_DB" | ||
STATE_DB = "STATE_DB" | ||
|
||
|
||
def signal_handler(sig, frame): | ||
if sig == signal.SIGHUP: | ||
syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGHUP' is caught and ignoring..") | ||
|
@@ -500,6 +500,17 @@ class AaaCfg(object): | |
server = tacplus_global.copy() | ||
server['ip'] = addr | ||
server.update(self.tacplus_servers[addr]) | ||
if 'key_encrypt' in server: | ||
secure_cipher = master_key_mgr() | ||
if server['key_encrypt'] == 'True': | ||
output, errs = secure_cipher.decrypt_passkey("TACPLUS", server['passkey']) | ||
if not errs: | ||
server['passkey'] = output | ||
else: | ||
syslog.syslog(syslog.LOG_ERR, "{}: decrypt_passkey failed.".format(addr)) | ||
else: | ||
# Delete the cipher_pass file if exist | ||
secure_cipher.del_cipher_pass() | ||
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. this will delete the whole file, probably not what we want. it should be enough just to remove the TACACS entry, or set the passkey to "" |
||
servers_conf.append(server) | ||
servers_conf = sorted(servers_conf, key=lambda t: int(t['priority']), reverse=True) | ||
|
||
|
Oops, something went wrong.
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.
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.
this value depends on how 'key_encrypt' was set. It can also be 'true' instead of 'True' (it's actually more correct to use 'true'). there's an is_true() function you can use if you don't want to worry about which format you might get.