saltstack / saltstack/salt

[Bug]: `x509.certificate_managed_wrapper` SSH wrapper swallows `file.managed` args for cert

Open
#69,954 0 comments 0 reactions 0 assignees View on GitHub

A pull request for this has already been merged.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

What happened?

The x509.certificate_managed_wrapper swallows arguments intended for file.managed of the managed certificate:

# /srv/salt/manage_cert.sls
{{
    salt["x509.certificate_managed_wrapper"](
        "/tmp/my_cert.pem",
        ca_server="ca_minion",
        signing_policy="my_signing_policy",
        private_key_managed={"name": "/tmp/my_cert.key", "new": true},
        certificate_managed={"subjectAltName": ["dns:foo.bar"], "mode": "0400",
    ) | yaml(false)
}}
$ salt-ssh myminion state.apply manage_cert
# [...]
$ salt-ssh myminion file.get_mode /tmp/my_cert.pem
myminion:
    0644
Type of salt install

Official deb

Major version

3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

ubuntu-24.04

salt --versions-report output
Current HEAD of 3008.x

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of x509.certificate_managed_wrapper and reproduce the issue with the supplied manage_cert.sls through salt-ssh. Trace how certificate_managed arguments reach file.managed, then add a regression test for the mode argument. Done means the generated certificate receives mode 0400 while the existing wrapper behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.