Forge Home

secret

It is going to encrypt and decrypt a plain_text

6,066 downloads

6,066 latest version

3.8 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.0 (latest)
released Feb 16th 2018

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'fsbsilva-secret', '0.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add fsbsilva-secret
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install fsbsilva-secret --version 0.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

fsbsilva/secret — version 0.1.0 Feb 16th 2018

Secret for Puppet face and puppet_x

Table of Contents

  1. Description
  2. Setup - The basics of getting started with secret
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

It is a simple module to decrypt and encrypt a plain_text in order to be re-used within many custom function modules. It will be an addon for your solution.

If you are developing a solution to install a software that needs to have a secret information, you can create a function where it can read a particular facter, hiera or file that contains a secret_key in order to protect that information.

Setup

Beginning with secret

$ sudo puppet module install fsbsilva-secret

Usage

In order to perform subcommand secret, we implement 3 actions :

1 ) encrypt That action is going to use a default secret_key and iv, whether you do not have one.

Example: puppet secret ecrypt "password123"

OR

puppet secret encrypt --secretkey '41254157g5o9s7h8m3e612awpmon!5jk' --iv_base 'nxWo3eFMpPxxY+sbade4eg==' password123

2 ) decrypt That action is going to use a default secret_key and iv whether you do not have one.

Example: puppet secret decrypt 't5LmQf9tEKCqVR0AkqNWGw=='

OR

puppet secret decrypt --secretkey '41254157g5o9s7h8m3e612awpmon!5jk' --iv_base 'nxWo3eFMpPxxY+sbade4eg==' 't5LmQf9tEKCqVR0AkqNWGw=='

3 ) random_iv That action is going to generate a iv_base64 if you do not have one.

Example: puppet secret random_iv

Development

There are many ways to store a secret_key and iv_base64. You can use the default values from this module or you can store this in a hiera, facter or even into a file. It is up to you!

Basically, you need create your lib/puppet/function like this:

require 'puppet_x/secret/encrypt'

Puppet::Functions.create_function(:decrypt_password) do
  dispatch :check_for_process do
    param 'String', :encrypted_passwd
    param 'String', :secretkey
    param 'String', :iv_base64
  end

  def check_for_process(encrypted_passwd, secretkey, iv_base64)
    puts PuppetX::Secret::Encrypt.decrypt(encrypted_passwd, secretkey, iv_base64)
  end
end
`