Skip to content

Commit 499e47e

Browse files
committed
Fix Pillar payload signature error
1 parent 4a24de9 commit 499e47e

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

changelog/62318.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed `Pillar payload signature failed to validate` error on master failover

salt/channel/client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,12 @@ def crypted_transfer_decode_dictentry(
218218

219219
# Validate the master's signature.
220220
if not self.verify_signature(signed_msg["data"], signed_msg["sig"]):
221-
raise salt.crypt.AuthenticationError(
222-
"Pillar payload signature failed to validate."
223-
)
221+
# Try to reauth on error
222+
yield self.auth.authenticate()
223+
if not self.verify_signature(signed_msg["data"], signed_msg["sig"]):
224+
raise salt.crypt.AuthenticationError(
225+
"Pillar payload signature failed to validate."
226+
)
224227

225228
# Make sure the signed key matches the key we used to decrypt the data.
226229
data = salt.payload.loads(signed_msg["data"])

tests/pytests/unit/transport/test_zeromq.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,13 @@ def mocksend(msg, timeout=60, tries=3):
958958

959959
client.transport.send = mocksend
960960

961+
# Minion should try to authenticate on bad signature
962+
@salt.ext.tornado.gen.coroutine
963+
def mockauthenticate():
964+
pass
965+
966+
client.auth.authenticate = MagicMock(wraps=mockauthenticate)
967+
961968
# Note the 'ver' value in 'load' does not represent the the 'version' sent
962969
# in the top level of the transport's message.
963970
load = {
@@ -977,6 +984,7 @@ def mocksend(msg, timeout=60, tries=3):
977984
dictkey="pillar",
978985
)
979986
assert "Pillar payload signature failed to validate." == excinfo.value.message
987+
client.auth.authenticate.assert_called_once()
980988

981989

982990
async def test_req_chan_decode_data_dict_entry_v2_bad_key(

0 commit comments

Comments
 (0)