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

[BUG] Unable to sign_in to master: Invalid master key #66239

Closed
steverweber opened this issue Mar 15, 2024 · 4 comments
Closed

[BUG] Unable to sign_in to master: Invalid master key #66239

steverweber opened this issue Mar 15, 2024 · 4 comments
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@steverweber
Copy link
Contributor

steverweber commented Mar 15, 2024

Master: 3004.1
Minion: 3007.0
the keys are the "same" however the payload pub_key has has a newline char at the end causing fail...

related code:

/salt/crypt.py
            with salt.utils.files.fopen(m_pub_fn) as fp_:
                local_master_pub = clean_key(fp_.read())
            if payload["pub_key"] != local_master_pub:

Adding  clean_key(payload["pub_key"]) works around it.
            with salt.utils.files.fopen(m_pub_fn) as fp_:
                local_master_pub = clean_key(fp_.read())
            payload["pub_key"] = clean_key(payload["pub_key"])
            if payload["pub_key"] != local_master_pub:

other kinda related bug is if you have pki files in two places havent tested latest master code.. I think the salt-master should perhaps fail in this case. Seen strangeness where the master.pub key would flip flop because i had different ones in the paths.

/etc/salt/pki/master
/var/lib/salt/pki/master
@steverweber steverweber added Bug broken, incorrect, or confusing behavior needs-triage labels Mar 15, 2024
@steverweber
Copy link
Contributor Author

related #66219

@steverweber
Copy link
Contributor Author

a hacky fix on the master end is to remove the EOL char from the file... here is what worked for me... but not a solution...

# on salt master remove the EOL char from master.pub
cp -p /var/lib/salt/pki/master/master.pub /var/lib/salt/pki/master/master.pub_backup
<<eof python3 > /var/lib/salt/pki/master/master.pub_noeol
print(''.join(open('/var/lib/salt/pki/master/master.pub_backup').readlines()).strip(), end='')
eof
cp -p /var/lib/salt/pki/master/master.pub_noeol /var/lib/salt/pki/master/master.pub
systemctl restart salt-master.service

@whytewolf
Copy link
Collaborator

for the record. even though this wasn't your problem. a master at a lower version than minion is not supported.

it may work, but it is not something we have ever or will ever support.

@steverweber
Copy link
Contributor Author

agreed after updating the salt master all is well.
There is plenty of warnings on the minion to update the master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants