Giter VIP home page Giter VIP logo

cert-formula's Introduction

cert-formula

Travis CI Build Status Semantic Release

A SaltStack formula to deploy certificates.

See the full SaltStack Formulas installation and usage instructions.

If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section.

If you want to use this formula, please pay attention to the FORMULA file and/or git tag, which contains the currently released version. This formula is versioned according to Semantic Versioning.

See Formula Versioning Section for more details.

If you need (non-default) configuration, please refer to:

Commit message formatting is significant!!

Please see How to contribute for more details.

Meta-state (This is a state that includes other states).

Deploys or removes given certificates and keys.

This state will install the required packages to manage certificates.

This state will write the certificates and there matching keys, if any, are store on disk and integrated in the system.

This state will run the certs_update_cmd command to integrate the deployed certificates on supported systems.

A helper function to find certificate files that match certificate contents. Useful if a certificate file gets renamed to something you don't remember and have trouble finding a certificate you wish to remove.

Example

Example that finds all certificate files in /usr/local/share/ca-certificates matching the certificate contents found in the pillar data in cert:certlist:cert.filename:cert

salt-call cert_formula_helper.get_filenames_matching_content /usr/local/share/ca-certificates  pillar_key="cert:certlist:cert.filename:cert"

cert-formula's People

Contributors

aboe76 avatar ameneau avatar baby-gnu avatar dafyddj avatar daks avatar daschatten avatar gravyboat avatar itjamie avatar javierbertoli avatar kadogo avatar kpostrup avatar myii avatar noelmcloughlin avatar seerickcode avatar semantic-release-bot avatar stasjok avatar wwentland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cert-formula's Issues

Is this formula working on Debian to distribute root cert?

Hello,

At the moment I use this formula to distribute cert+private key to servers needing it (web servers...) and that works.
But I wonder if this formula works on Debian to distribute public certificates (like custom CA certificate).

The formula put the cert in /etc/ssl/certs/ and run 'update-ca-certificates', but the normal workflow in Debian is to put the certificate in /usr/local/share/ca-certificates and then run 'update-ca-certificates' (see #7).

I have done some tests and I pretty sure it doesn't work for this usage.

I'm not sure if distribution of root certs is in the scope of this formula, but I think it is, and if not I think it should :)

Has anyone tried this use? Am I missing something?

Add the ability to remove certs and keys

This formula doesn't offer a way to remove certificates and keys. I'll have a pull request to add in this functionality, however I was curious if there was any preference for doing this. I can do it one of two ways.

  1. Create an "absent" state, put the contents of init.sls into a "present" state and have init.sls include the "absent" state, then the "present" state
  2. Same as 1, except replacing init.sls with a "managed" state.

I would go with option 2, personally

Option to deploy CA certificates

It would be nice if there was an option to deploy new CA certificates.

On at least Debian based distros, CA certificates can be placed inside /usr/local/share/ca-certificates/ named with the .crt extension, and added to the global trusted CA /etc/ssl/certs/ca-certificates.crt using the following command:

update-ca-certificates

[BUG] No certs in pillar causes onchanges for update to fail

Your setup

Formula commit hash / release tag

Master @ ef33d4d

Versions reports (master & minion)

Salt Version:
Salt: 3003

Pillar / config used

None/Empty


Bug details

If the cert state is called (default) and there is no certs in the pillar cert-updated-system-cmd.run will fail because onchanges::sls::cert.deployed.files didn't render to anything (no state).

Steps to reproduce the bug

With no content in cert::certlist in pillar do:

salt-call --state-verbose=false state.sls cert

Result:

local:
----------
          ID: cert-updated-system-cmd.run
    Function: cmd.run
        Name: update-ca-certificates --fresh
      Result: False
     Comment: The following requisites were not found:
                                 onchanges:
                                     sls: cert.deployed.files
--cut---

Expected behaviour

No action, No error

Attempts to fix the bug

Fixed by adding nop state to head of deployed/files.sls. Patch inbound

Additional context

Perhaps related to #29

Support RedHat family with the use of `ca-trust`

Is your feature request related to a problem?

The Red Hat family OSes do not use ca-certificates to bundle certificates but ca-trust.

Certificates must be placed under another directory.

Describe the solution you'd like

Modify the configuration for Red Hat family OS to put certificates and keys under the directories used by ca-trust.

Describe alternatives you've considered

Additional context

State ID for deployed certificate file contains a double slash

When deploying on Debian, if you need to depends on the state ID which deploy the certificate, you need a watch (or equivalent) like this:

 - watch:
    - file: /usr/local/share/ca-certificates/<cert>.crt

but it fails because the generated state ID is /usr/local/share/ca-certificates//<cert>.crt (note the double slash) which is not intuitive.

(Ref #12)

Appending .crt extension to certificate files

The formula adds the .key extension to key files, but not the .crt extension to cert files. Putting the cert files in the /usr/local/share/ca-certificates/ on Debian family systems and running the update-ca-certificates command will not pick up the certificate without the .crt extension.

This will break backwards compatibility with previous versions of the formula that install certificates, but will be less confusing in the long run to append the .crt extension to certificates being installed.

Allow certificate from Pillar data

Currently the cert-formula requires certificates to reside in a salt:// location.

I have a use-case where I want to have both the certificate and key in Pillar data. I think thge formula should support this option as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.