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

Howto create a Concatenation/Combined CA file using salt? #58571

Open
ghost opened this issue Sep 28, 2020 · 3 comments
Open

Howto create a Concatenation/Combined CA file using salt? #58571

ghost opened this issue Sep 28, 2020 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@ghost
Copy link

ghost commented Sep 28, 2020

I would like to have to following a bit more clean, I'm trying to create concatenated CA file using Salt.
To accomplish this I first have to collect all glusterfs.pem files from all my minions to the salt-master minions cache and then output all glusterfs.pem into a single CA file (glusterfs.ca) on the salt-master to later on enroll them again on all minions.
Actually my solution is working but its simply out of the salt context and looks crappy to me. I'm new to salt, I never worked with reactors or so and I was hoping to find some help (preferably with a example if possible) around here.

This is my current situation only using states:

glusterfs/init.sls (only runs on minions)

/etc/ssl/glusterfs.key:
  x509.private_key_managed:
    - order: 9
    - bits: 2048
    - name: /etc/ssl/glusterfs.key

/etc/ssl/glusterfs.pem:
  x509.certificate_managed:
    - order: 10
    - signing_private_key: /etc/ssl/glusterfs.key
    - CN: {{ grains.id }}
    - C: UA
    - ST: Unavailable
    - L: Unavailable
    - basicConstraints: "critical CA:true"
    - keyUsage: "critical cRLSign, keyCertSign"
    - subjectKeyIdentifier: hash
    - authorityKeyIdentifier: keyid,issuer:always
    - days_valid: 3650
    - days_remaining: 0

/etc/ssl/glusterfs.ca:
  file:
    - order: 11
    - managed
    - source: salt://glusterfs/glusterfs.ca

ca.sls (only runs on salt-master):

collect_glusterfs_certs:
  cmd.run:
    - order: 1
    - name: salt -C 'not salt' cp.push /etc/ssl/glusterfs.pem

concatenation_glusterfs_certs:
  cmd.run:
    - order: 2
    - onlyif: 'test ! -e /var/cache/salt/master/minions/{master*,worker*}/files/etc/ssl/glusterfs.pem && test ! -e /srv/salt/glusterfs/glusterfs.ca'
    - name: 'cat /var/cache/salt/master/minions/*/files/etc/ssl/glusterfs.pem > /srv/salt/glusterfs/glusterfs.ca'

So I basically first pull all glusterfs.pem to the local salt-master minion cache and afterwards create the concatenated glusterfs.ca file which I than later on deploy onto all minion I previously collected the glusterfs.pem file from ...
Is there maybe a better way to get this done? Currently I also have the problem that my very first enrolment fails as
/etc/ssl/glusterfs.pem might be not present at that moment.

Thanks in advance

@welcome
Copy link

welcome bot commented Sep 28, 2020

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.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

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.
If you have additional questions, email us at [email protected] or reach out directly to the Community Manager, Cassandra Faris via Slack. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@sagetherage sagetherage added Question The issue is more of a question rather than a bug or a feature request needs-triage labels Sep 28, 2020
@OrangeDog
Copy link
Contributor

I think it's broken: #58481

@sagetherage sagetherage assigned dwoz and unassigned DmitryKuzmenko Oct 1, 2020
@sagetherage sagetherage added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around and removed Question The issue is more of a question rather than a bug or a feature request needs-triage labels Nov 12, 2020
@sagetherage
Copy link
Contributor

Might be related and this bug may need more for the combination #58482

@sagetherage sagetherage added this to the Approved milestone Nov 12, 2020
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 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

4 participants