mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Simply check against cleaned key from disk.
This commit is contained in:
parent
4e72e2f0a5
commit
0f4c022fda
1 changed files with 1 additions and 9 deletions
|
@ -371,15 +371,7 @@ class ReqServerChannel:
|
|||
elif os.path.isfile(pubfn):
|
||||
# The key has been accepted, check it
|
||||
with salt.utils.files.fopen(pubfn, "r") as pubfn_handle:
|
||||
keyFromDisk = pubfn_handle.read()
|
||||
|
||||
# if the keyFromDisk has a final newline it is a oldstyle key
|
||||
# if we clean it, it will not match. Only clean the key if it
|
||||
# is a new style key.
|
||||
if keyFromDisk[-1:] != "\n":
|
||||
keyFromDisk = salt.crypt.clean_key(keyFromDisk)
|
||||
|
||||
if keyFromDisk != load["pub"]:
|
||||
if salt.crypt.clean_key(pubfn_handle.read()) != salt.crypt.clean_key(load["pub"])
|
||||
log.error(
|
||||
"Authentication attempt from %s failed, the public "
|
||||
"keys did not match. This may be an attempt to compromise "
|
||||
|
|
Loading…
Add table
Reference in a new issue