salt: x509 Certs Generation Fails
Description of Issue
When using x509.managed_certs with a specified minions
attribute the globbing fails to match the minion correctly. It displays an error like:
hostname.net is not permitted to use signing policy signing-policy-name
Solution
https://github.com/oliverisaac/salt/commit/bd5b20ab705f619fbde2b0a734d5e0fd8b060856
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 25 (15 by maintainers)
@oliverisaac We’re facing same issue here, is there a PR ready to merge for this. @garethgreenaway Any chances to see this fix in
3000.1
?I’m running into the same problem as described in this issue in my Salt
2019.2.2
setup. @oliverisaac’s patch seems to work perfectly!I can’t easily describe our exact setup because it’s a nesting of a nesting of config/formulas. In short, we are using salt as the CA authority for our db clusters. When we try to generate the cert, we specify that the signing_policy is, for example:
mysql-prod-*
. Then, when our minion needs a cert, that signing_policy is globbed against the minion’s hostname. However, this happens on the salt master. So when the globbing happens, match.glob is called with a specific hostname.If you look at the code in my commit linked above ( https://github.com/oliverisaac/salt/commit/bd5b20ab705f619fbde2b0a734d5e0fd8b060856#diff-889b4ad7294d8f45dfd1c3a87b9ba427L286-R314 ) you’ll see that if you call
match.glob("mysql-*", minion_id="mysql-prod-01")
while running on a minion with a non-matching hostname (e.g.salt01
) then the function will fail.Lines 302 and 307 both copy
__opts__
into the local variableopts
but then that localopts
isn’t passed onto the finalmatchers
function. Instead the original__opts__
is passed.