-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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] x509.certificate_managed has DoS effect on salt master. #59169
Comments
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. |
See also #52167 |
The basic issue with this is: The Salt CA is asked to sign new certificates, for every managed certificate, on every highstate. This is aggravated by using a 4096 bit RSA key, which needs substantially more compute resources to use for signing than a 2048 bit, or using ECDSA. Following the logic: Lines 659 to 661 in 064729c
Similarly, among the first things Lines 503 to 505 in 064729c
The module Lines 1447 to 1452 in d5dec79
Lines 1093 to 1096 in d5dec79
Now, our kwargs might well have Lines 1650 to 1669 in d5dec79
Then we unwind. The basic issue here is that we're always issuing a new certificate by the CA on every highstate, and if they all hit the CA server at once, it gets overloaded. As I said above, that's made worse by using a more secure keysize like 4096. The key bug here is that the The solution is for |
I have experienced this issue myself, and after a log of digging around discovered the --batch-size parameter which can be passed to the salt command, or -batch: xx% in orchestrate .sls files. This should be recommended in the documentation for x509 module. It solved my issue "ca_server did not respond. Salt master must permit peers to call the sign_remote_certificate function." when x509.certificate_managed. |
Description
Using x509.certificate_managed to generate certificates works for a few hosts at a time, but not en-mass (and I only have 75 minions, so it's not exactly big scale). If I do a salt run on
'*'
or on larger groups of minions, salt-master stops responding to minions.If I remove the x509.certificate_managed state, it all goes back to normal and works fine. This happens even if the minions already have a valid certificate so it's not generating one, but just checking for expiry.
Setup
It's pretty much the setup documented at: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.x509.html
x509.conf looks like:
and /etc/salt/master.d/peer.conf:
Steps to Reproduce the behavior
My salt runs across all minions consistently take ~39s:
If I add in the
/etc/pki/{{ grains['fqdn'] }}.crt
state above, it all stops working:If I remove that one state, it all returns to normal and works fine again.
Expected behavior
Checking a certificate's validity/expiry should not add significant time/load to a salt run.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: