Code Monkey home page Code Monkey logo

conjur-puppet's Introduction

conjur

Version

Table of Contents

Table of contents generated with markdown-toc

Description

This is the official Puppet module for Conjur, a robust identity and access management platform. This module simplifies the operations involved in establishing a Conjur host identity and allows authorized Puppet nodes to fetch secrets from Conjur.

You can find our official distributable releases on Puppet Forge under cyberark/conjur.

Certification level

Certification Level

This repo is a Certified project. It is officially approved to work with Conjur Open Source and Conjur Enterprise as documented. For more detailed information on our certification levels, see our community guidelines.

Setup

Setup requirements

This module requires that you have:

  • Puppet v6 or equivalent EE version
  • Conjur endpoint available to both the Puppet server and the Puppet nodes using this module. Supported versions:
    • Conjur Open Source v1+
    • Conjur Enterprise (formerly DAP) v10+

Deprecations

Puppet v5

Puppet v5 is not supported in v3+ of this module. If you are still using this version, please use the v2 branch of this project or a release version <3.0.0.

Conjur Enterprise v4

Conjur Enterprise v4 is not supported in v3+ of this module. If you are still using this version, please use the v2 branch of this project or a release version <3.0.0.

Use of Host Factory Tokens

Establishment of identity using host factory tokens directly through this module is no longer supported. Host factory tokens can still be used to create host identities, but these identities need to be established outside of the module itself. If you are still using the creation of identities with host factory tokens via this module, please use the v2 branch of this project or a release version <3.0.0.

Installation

To install this module, run the following command on the Puppet server:

puppet module install cyberark-conjur

To install a specific version of this module (e.g. v1.2.3), run the following command on the Puppet server:

puppet module install cyberark-conjur --version 1.2.3

Using conjur-puppet with Conjur Open Source

Are you using this project with Conjur Open Source? Then we strongly recommend choosing the version of this project to use from the latest Conjur OSS suite release. Conjur maintainers perform additional testing on the suite release versions to ensure compatibility. When possible, upgrade your Conjur version to match the latest suite release; when using integrations, choose the latest suite release that matches your Conjur version. For any questions, please contact us on Discourse.

Conjur module basics

This module provides a conjur::secret Deferred function that can be used to retrieve secrets from Conjur. Given a Conjur variable identifier and optional identity parameters, conjur::secret uses the node’s Conjur identity to resolve and return the variable’s value as a Sensitive variable.

Using a pre-provisioned identity:

$dbpass = Deferred(conjur::secret, ['production/postgres/password'])

Using a manifest-provided identity:

$sslcert = @("EOT")
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
|-EOT

$dbpass = Deferred(conjur::secret, ['production/postgres/password', {
  appliance_url => "https://my.conjur.org",
  account => "myaccount",
  authn_login => "host/myhost",
  authn_api_key => Sensitive("2z9mndg1950gcx1mcrs6w18bwnp028dqkmc34vj8gh2p500ny1qk8n"),
  ssl_certificate => $sslcert
}])

Example usage

node 'server-123' {
  $db_password = Deferred(conjur::secret, ['inventory/db-password'])

  # Example of writing a secret to a file
  file { '/tmp/creds.txt':
    ensure => file,
    mode => '0600',
    content => $db_password,
  }

  # Example of using a secret in a templated file
  file { '/tmp/creds.ini':
    ensure => file,
    mode => '0600',
    content => Deferred('inline_epp', [
      'password=<%= $db_password.unwrap %>',
      { 'db_password' => $db_password }
    ]),
  }
}

Deferred functions

This module requires the use of Puppet v6+ Deferred functions to ensure that the credential retrieval is fully handled on the agent. Failure to use Deferred around the method will result in an error:

# GOOD: Function `conjur::secret` is wrapped in `Deferred` call
Deferred(conjur::secret, ['production/postgres/password'])
# BAD: This will not work!
conjur::secret('production/postgres/password')

Since the resolution of variables is done also on the agent after the catalog is compiled, anything that requires the value of the variable during the compilation step (e.g. template compilation) must also be wrapped in a Deferred invocation.

It is also important to note that you should make sure that you invoke the conjur::secret function using the proper Deferred syntax:

# GOOD: Passing the parameters as an array
Deferred(conjur::secret, ['production/postgres/password'])
# BAD: This will not work!
Deferred(conjur::secret('production/postgres/password'))

You can read more about Puppet's Deferred functions here.

Sensitive type

conjur::secret returns values wrapped in a Sensitive data type. In some contexts, such as string interpolation, it might cause surprising results (interpolating to Sensitive [value redacted]). This is intentional, as it makes it more difficult to accidentally mishandle secrets.

To use a Sensitive value as a string, you need to explicitly request it using the unwrap function. If you are setting other Puppet variables to the value of this secret or if you are creating composite Puppet variables from it, you should ensure that the resulting value is also wrapped in a Sensitive type. In particular, you should not pass unwrapped variables as parameters to Puppet methods if you can avoid it. Many Puppet resource functions support Sensitive data type and handle it correctly.

$dbpass = Deferred(conjur::secret, ['production/postgres/password'])

# Use Sensitive data type to handle anything sensitive
$db_yaml = Sensitive(Deferred('inline_epp', [
  'password: <%= $db_password.unwrap %>',
  { 'db_password' => $dbpass }
]))

file { '/etc/someservice/db.yaml':
  ensure  => file,
  mode    => '0600',
  content => $db_yaml, # This correctly handles both Sensitive and String
}

Note: We only enforce that the API key from the Conjur configuration is marked Sensitive, but if any other data in the function parameters is also considered sensitive by your organization you may also wrap the whole Deferred invocation in the Sensitive type to prevent accidental disclosure of the sensitive information to the logs. Note that if you do this, you will need to unwrap the output twice.

Usage

This module provides the conjur::secret function described above and the conjur class, which can be configured to establish Conjur host identity on the node running Puppet.

Methods to establish Conjur host identity

Conjur requires an application identity for any applications, machines, or processes that need to interact with Conjur.

Please note that before getting started configuring your Puppet environment, you'll need to load a policy in Conjur to define the application identities that you will be using to authenticate to Conjur. To learn more about creating hosts, please see the Conjur documentation.

In the sections below, we'll outline the different methods of providing this module with your Conjur configuration and credentials. In those sections we'll refer often to the following Conjur configuration variables:

  • appliance_url: The URL of the Conjur or Conjur Enterprise instance you are connecting to. If using Conjur Enterprise, this may be the URL of a load balancer for the cluster's Conjur Enterprise follower instances.
  • account - the account name for the Conjur / Conjur Enterprise instance you are connecting to.
  • authn_login: The identity you are using to authenticate to the Conjur / Conjur Enterprise instance. For hosts / application identities, the fully qualified path should be prefixed by host/, eg host/production/my-app-host.
  • authn_api_key: The API key of the identity you are using to authenticate to the Conjur / Conjur Enterprise instance.
  • ssl_certificate: The raw PEM-encoded x509 CA certificate chain for the Conjur Enterprise instance you are connecting to, provided as a string (including newlines) or using the Puppet file resource type. This value may be obtained by running the command:
    $ openssl s_client -showcerts -servername [DAP_INSTANCE_DNS_NAME] \
      -connect [DAP_INSTANCE_DNS_NAME]:443 < /dev/null 2> /dev/null \
      | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
    -----BEGIN CERTIFICATE-----
    ...
    -----END CERTIFICATE-----
  • version (optional): Conjur API version, defaults to 5.

Note that not all variables are required for each method of configuration.

Conjur host identity with API key

The simplest way to get started with a Conjur application identity is to create a host in Conjur and then provide its Conjur credentials to this module. There are a few ways to provide the Conjur Puppet module with these credentials and they are outlined in the following sections.

Updating the Puppet manifest

When you update the Puppet manifest to include the Conjur host identity and API key, you are configuring the Puppet server with the Conjur identity information.

In this example, after you have created a Conjur host named redis001, you can add its host identity information and its API key to your Deferred invocation as an optional hash like this:

$sslcert = @("EOT")
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
|-EOT

$dbpass = Deferred(conjur::secret, ['production/postgres/password', {
  appliance_url => "https://my.conjur.org",
  account => "default",
  authn_login => "host/redis001",
  authn_api_key => Sensitive("2z9mndg1950gcx1mcrs6w18bwnp028dqkmc34vj8gh2p500ny1qk8n"),
  ssl_certificate => $sslcert
}])
Using Hiera

You can also add the Conjur identity configuration to Hiera, which provides the Conjur identity information to the Puppet server. You then would use that information to populate the host identity information:

---
lookup_options:
  '^conjur::authn_api_key':
    convert_to: 'Sensitive'

conjur::account: 'default'
conjur::appliance_url: 'https://my.conjur.org'
conjur::authn_login: 'host/myhost'
conjur::authn_api_key: '<REPLACE_ME>'
conjur::ssl_certificate: |
  -----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----

Then in your manifest, you can fetch the secret like this:

$sslkey = Deferred(conjur::secret, ["domains/%{hiera('domain')}/ssl-cert", {
  appliance_url => lookup('conjur::appliance_url'),
  account => lookup('conjur::account'),
  authn_login => lookup('conjur::authn_login'),
  authn_api_key => lookup('conjur::authn_api_key'),
  ssl_certificate => lookup('conjur::ssl_certificate')
}])

file { '/abslute/path/to/cert.pem':
  ensure    => file,
  content   => $sslkey,
}
Using Conjur identity files (Linux agents only)

To configure Linux agents with a Conjur host identity, you can add the Conjur host and API key to Conjur identity files /etc/conjur.conf and /etc/conjur.identity.

Using the same redis001 host as above, you would create a conjur.conf file that contains:

---
account: myorg
plugins: []
appliance_url: https://conjur.mycompany.com
cert_file: "/absolute/path/to/conjur-ca.pem" # Read from the Puppet agent
# Alternative for providing the SSL cert
# ssl_certificate: |
#  -----BEGIN CERTIFICATE-----
#  ...
#  -----END CERTIFICATE-----
Value Name Description
account `Conjur account specified during Conjur setup.
appliance_url `Conjur API endpoint.
cert_file `Path to a file containing the public Conjur SSL cert on the agent. This value must be an absolute path and not a relative one.
ssl_certificate Raw public Conjur SSL cert. Overwritten by the contents read from cert_file` when it is present.
version Conjur API version. Defaults to 5.

Note: use either SslCertificate or CertFile but not both as cert_file overrides the value of ssl_certificate setting.

You will also need a conjur.identity file that contains:

machine conjur.mycompany.com
    login host/redis001
    password f9yykd2r0dajz398rh32xz2fxp1tws1qq2baw4112n4am9x3ncqbk3

NOTE: The conjur.conf and conjur.identity files contain sensitive Conjur connection information. Care must be taken to ensure that the permissions for these files are set to 600 to disallow any access to these files by unauthorized (non-root) users on a Linux Puppet agent node.

The Conjur Puppet Module automatically checks for these files on your node and uses them if they are available.

To then fetch your credential, you would use the default form of conjur::secret:

$dbpass = Deferred(conjur::secret, ['production/postgres/password'])
Using Windows Registry / Windows Credential Manager (Windows agents only)

To configure Windows agents with a Conjur host identity, you set up the Conjur configuration in the Windows Registry and in the Windows Credential Manager. The Registry contains the connection general information and the Credential Manager is used to store the sensitive authentication credentials.

Connection settings for Conjur are stored in the Windows Registry under the key HKLM\Software\CyberArk\Conjur. This is equivalent to /etc/conjur.conf on Linux. The values available to set are:

Value Name Value Type Description
Account REG_SZ Conjur account specified during Conjur setup.
ApplianceUrl REG_SZ Conjur API endpoint.
CertFile REG_SZ Path to a file containing the public Conjur SSL cert on the agent. This value must be an absolute path and not a relative one.
SslCertificate REG_SZ Raw public Conjur SSL cert. Overwritten by the contents read from CertFile when it is present.
Version REG_DWORD Conjur API version. Defaults to 5.

These may be set using Powershell:

> reg ADD HKLM\Software\CyberArk\Conjur /v ApplianceUrl /t REG_SZ /d https://conjur.mycompany.com
> reg ADD HKLM\Software\CyberArk\Conjur /v Version /t REG_DWORD /d 5
> reg ADD HKLM\Software\CyberArk\Conjur /v Account /t REG_SZ /d myorg
> reg ADD HKLM\Software\CyberArk\Conjur /v SslCertificate /t REG_SZ /d "-----BEGIN CERTIFICATE-----..."

Or using a .reg registry file (SslCertificate value cannot be set this way - you must set this value via command line):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\CyberArk\Conjur]
"ApplianceUrl"="https://conjur.mycompany.com"
"Version"=dword:00000005
"Account"="myorg"

NOTE: It is important from a security perspective to ensure that unauthorized, non-administrator users do not have write access to Conjur connection settings in the Windows Registry. Disabling write access for unauthorized users to these settings will help to prevent potential malicious redirection of sensitive Puppet agent messages. Read-only access for non-administrator users to Conjur connection information can be confirmed via regedit on the Windows Desktop, or by running the following command from a PowerShell to confirm that only the ReadKey flag is set:

PS C:\> Get-Acl -Path HKLM:SOFTWARE\CyberArk\Conjur | fl * | Out-String -stream | Select-String "BUIL
TIN\\Users"

AccessToString          : BUILTIN\Users Allow  ReadKey

Credentials for Conjur are stored in the Windows Credential Manager. The credential Target is the Conjur appliance URL (e.g. https://conjur.mycompany.com). The username is the host ID, with a host/ prefix (e.g. host/redis001, as in previous examples) and the credential password is the host's API key. This is equivalent to /etc/conjur.identity on Linux.

This may be set using Powershell:

> cmdkey /generic:https://conjur.mycompany.com /user:host/redis001 /pass
Enter the password for 'host/my-host' to connect to 'https://conjur.net/authn': #
{Prompt for API Key}

CMDKEY: Credential added successfully.

To then fetch your credential, you would use the default form of conjur::secret:

$dbpass = Deferred(conjur::secret, ['production/postgres/password'])

Troubleshooting

For a complete guide on troubleshooting, please see TROUBLESHOOTING.md.

Reference

For a complete reference, please see REFERENCE.md.

Limitations

See metadata.json for supported platforms.

At current, the Conjur Puppet module encrypts and decrypts the Conjur access token using the Puppet server’s private/public key pair. This is known to be incompatible with using multiple compile masters.

Contributing

We welcome contributions of all kinds to this repository. For instructions on how to get started and descriptions of our development workflows, please see our contributing guide.

Support

Please note, that this is a "Partner Supported" module, which means that technical customer support for this module is solely provided by CyberArk.

Puppet does not provide support for any Partner Supported modules. For technical support please visit the Conjur channnel at CyberArk Commons.

conjur-puppet's People

Contributors

andytinkham avatar apotterri avatar boazmichaely avatar bradleyboutcher avatar diverdane avatar dividedmind avatar doodlesbykumbi avatar dustinmm80 avatar garymoon avatar gl-johnson avatar hughsaunders avatar izgeri avatar jakequilty avatar john-odonnell avatar jtuttle avatar juniortaeza avatar kstutsman-conjur avatar micahlee avatar orenbm avatar rpothier avatar sgnn7 avatar

Stargazers

 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

conjur-puppet's Issues

Unit tests exist for WinCred interface

The Fiddle interface for WinCred should include unit tests to verifying the intended interaction and error cases.

This depends first on having Windows executors on Jenkins.

Add changelog format verification

Is your feature request related to a problem? Please describe.

We're standardizing CHANGELOG formats and this repo should do the same

Describe the solution you would like

Builds check validity of CHANGELOG according to keep-a-changelog format

conjur::secret provides credentials for Windows servers

As a Windows admin, I want to utilized the module to deliver credentials to Windows systems, so that I can easily automate Windows as well as Linux systems.

GIVEN a Puppet master, Conjur, a Windows node with an identity and permission to retrieve a credential
WHEN when a manifest utilizes conjur::secret to pull a credential from Conjur
THEN credential are placed on the node

Dev Notes
This story only covers updating the current functionality to support Windows. Updating the module to support Deferred Types is encapsulated in another issue.

Fix v6 server-side use of missing APIs

When running the e2e smoketest with Puppet v6 server, we get 500 errors.

Running e2e and monitoring the server container logs, error can be seen here:

2020-06-25 20:02:55,317 ERROR [p.r.core] Internal Server Error: org.jruby.exceptions.NotImplementedError: (NotImplementedError) NotImplementedError
        at RUBY.create_session(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/http/external_client.rb:77)
        at RUBY.initialize(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/ssl/state_machine.rb:376)
        at RUBY.certificate(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/ssl/host.rb:126)
        at RUBY.localhost(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/ssl/host.rb:28)
        at RUBY.decrypt(/etc/puppetlabs/code/environments/production/modules/conjur/lib/puppet/functions/conjur/decrypt.rb:11)

in this block of code: https://github.com/cyberark/conjur-puppet/blob/v2.0.3/lib/puppet/functions/conjur/decrypt.rb#L11

Relevant block:

  def decrypt pkcs7
    host = Puppet::SSL::Host.localhost
    key = host.key.content
    certificate = host.certificate.content
    decryptor = OpenSSL::PKCS7.new pkcs7
    sensitive.new decryptor.decrypt key, certificate
  end

Support for Puppet 6 with Windows nodes has been manually tested

Manual tests to run through:

Puppet 5 tests

  • Conjur identity via host factory, configured in Hiera, Windows Server 2019
  • Conjur identity via host factory, configuration hardcoded in manifest, Windows Server 2016
  • Conjur identity via host / API key, configuration in Windows Registry / WinCred, Windows Server 2012 R2
  • Conjur identity via host / API key, configuration in Windows Registry / WinCred, Windows 2016
  • Conjur identity via host / API key, configuration in Hiera, Windows Server 2012 R2
  • Conjur identity via host / API key, configuration hardcoded in manifest, Windows Server 2019

Puppet 6 tests

  • Conjur identity via host factory, configuration hardcoded in manifest, Windows 2012 R2
  • Conjur identity via host / API key, configuration in Windows Registry / WinCred, Windows 2019
  • Conjur identity via host / API key, configuration in Hiera, Windows 2016

In all tests, we are validating that if the server manifest includes conjur configuration and invokes lookup plugin, that it correctly sends the secret values back to the agent, i.e. we need to verify that the server can authenticate to Conjur and retrieve secrets / pass the values to agent.

Agent (facter?) doesn't find credentials in WinCred

Initial run on new Winserver 2008 R2 VM - new host identity correctly created w/ host factory:

C:\Users\Administrator>puppet agent -t -v
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Enumerate credentials in WinCred failed. Error code: 1168
Info: Caching catalog for win-2re6mq9ddem.localdomain
Info: Applying configuration version '1565020354'
Notice: /Stage[main]/Conjur::Identity::Wincred/Credential[conjur-master:30443]/ensure: created (corrective)
Notice: Applied catalog in 0.14 seconds

image

Second run - identity not found, seems to be updating the existing credential:

C:\Users\Administrator>puppet agent -t -v
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Conjur identity not found on system
Info: Caching catalog for win-2re6mq9ddem.localdomain
Info: Applying configuration version '1565020487'
Notice: /Stage[main]/Conjur::Identity::Wincred/Credential[conjur-master:30443]/value: changed [redacted] to [redacted]
Notice: Applied catalog in 0.03 seconds

Test code in: https://github.com/jodyhuntatx/dap-demo-env/tree/master/PUPPET_demo

Puppet 6 compatibility

The metadata file pin this module to <5, Puppet is now in version 6, can this be updated?

Puppet integration can run on windows

Link to Aha

https://cyberark.aha.io/features/AAM-85
https://cyberark.aha.io/features/AAM-86
Child of puppet 6 updates #20

Feature Overview

Utilize the current puppet module to deliver credentials to Windows systems, so that I can easily automate Windows as well as Linux systems.

Resources

Story breakdown

Design and Planning

  • Feature spec exists - parent of conjurinc/appliance#816
  • High-level Feature Doc for Windows Conjur Settings - parent of conjurinc/appliance#817
  • [SPIKE] POC for WinCred API from Ruby - parent of conjurinc/appliance#818
  • Feature spec approved

Infrastructure

  • Jenkins creates on demand single use windows agents - parent of conjurinc/ops#223

Development

  • Can't add a conjur
    host with / - parent of #17
  • conjur class establishes identity for Windows servers - parent of #21
  • conjur::secret provides credentials for Windows servers - parent of #22

Testing

  • Tests on Master Branch are broken - parent of #19
  • Integration CI tests are executed in Linux and Windows environments - parent of #27
  • Unit tests exist for WinCred interface - parent of #28

Documentation

  • README is updated

Demo

  • Demo exists for Puppet on Windows
  • Video demonstration of Puppet for Windows exists

Release

  • Version is bumped
  • Updated Puppet Module has been published to PuppetForge

Add code coverage to conjur-puppet

Add code coverage to this project.

Acceptance Criteria:

  • Code coverage should be measured across all tests defined in this repository every time a build is run in any branch.
  • Coverage report should include:
    • Line Coverage (including highlighting which lines are covered and which are not - not just giving a percentage)
    • Conditional Coverage
    • Optionally, other kinds of coverage such as Package, Class, File, or Method coverage
  • Coverage report should be created in or converted to Cobertura format as part of build to allow for ingestion into coverage aggregation tools
  • Coverage report should be archived in the Jenkins build using the cobertura command as shown at https://github.com/cyberark/conjur-api-ruby/blob/072d21e01e46382ee4d577e180c1269f8ff9f36e/Jenkinsfile#L27
  • Coverage report should be uploaded to Code Climate with each build

Add windows tests for build pipeline

Is your feature request related to a problem? Please describe.

We don't have automated tests for Windows platforms so we should add those in to ensure we don't push a broken build.

Describe the solution you would like

AC:

  • Automated builds also test the windows platform

Manually verify that the Conjur Puppet plugin does not work in Windows with Puppet v6

Overview

We haven't validated that the certificate bug in #44 impacts both Windows and Linux users with Puppet v6. In this card, we'd like to:

  • Validate that the bug #44 also impacts Windows environments when used with Puppet v6
  • Document the workflow used to validate the bug in Windows, so that others who are also working in Windows will have some reference notes to get started

Definition of Done

Test environment:

  • Windows Server 2012 or 2016
  • Puppet v6 (clients and server)
  • Conjur or DAP (either way is fine - just document what you used) configured with a single Conjur host identity for the Puppet master server and nodes
  • The latest release of our Puppet integration

Using this environment, validate that you can run through a scenario like the smoketest example - ie that you can configure Puppet with a Conjur host and API key and successfully use Puppet to retrieve a secret value.

If you cannot, document the errors that you see along the way and any suggestions / ideas you have for how to address them (if any).

AC:

  • There are notes on this issue about the errors encountered when running through the scenario outlined above
  • There are notes on this issue about how the test environment was created, so that others may try to follow the same instructions and try to reproduce

Remove references to Conjur v4

Is your feature request related to a problem? Please describe.

Conjur v4 API is no longer supported so its existence is code is not needed anymore.

Describe the solution you would like

AC

  • This plugin has no logic/code that is referring to Conjur v4 API

standardised CHANGELOG exists, and is validated via pipeline

If the repo has a changelog that doesn't meet the standard, do try to change earlier entries to match the standard.
If the repo doesn't have a changelog use this as a starter:

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

Acceptance criteria

Run code quality metrics in CI

Code quality metrics, such as test coverage, should be gathered by CI run. We should also configure CodeClimate for this repository while we're at it.

Add information on how the tokens and configuration is handled to the documentation

ok, so here is how:

  • there is a custom fact which runs on the node. if the node is preconfigured with Conjur settings, it sends that data to the master and they're used as defaults.
  • if additionally the host has a Conjur identity pre-configured (e.g.. API key in /etc/conjur.identity), it uses that to authenticate to Conjur. it gets back the standard 8-minute Conjur bearer token. that already limits the exposure, but facts are meant to be for public metadata about the host, not for secrets. so before sticking the token into the fact, it encrypts it using puppet master's public TLS key.
  • the master, when instantiating conjur class, looks at the fact and takes all defaults from there. If there is an encrypted token there as well, it decrypts it using its own private key and uses that to authenticate with Conjur whenever it wants to fetch a secret.

Module supports a variety of common Operating Systems

As an administrator, I want the module to support a variety of operating systems, so that I am confident it will work for the operating systems within my environment.

GIVEN this module
WHEN the test suite is run
THEN module functionality is validated on the below operating systems 1

1 Supported operating systems:

  • Windows
  • Red Hat 7
  • CentOS 7
  • Ubuntu 18.04 LTS
  • Debian 9

Conjur passwords are updated in test suite

There are a couple of example Conjur containers that are spun up that use CONJUR_ADMIN_PASSWORD with value admin. These should be updated to use something more complex, like ADmin123!!!!

AC:

  • examples/puppetmaster/docker-compose.yml is updated to use a more complex Conjur admin password
  • examples/docker-compose.yml is updated to use a more complex admin password
  • All examples still work as expected with the updates

Puppet CA chain retrieval doesn't rely on internal Puppet API methods

On Puppet 6, the Conjur module reports the error:

undefined method `ssl_configuration' for #<Puppet::SSL::Validator::DefaultValidator:0x00000000069b2778>

This comes from

Puppet::SSL::Validator.default_validator.ssl_configuration.ca_chain_file
where we use the internal Puppet API to retrieve the Puppet CA chain.

This instance method existed in Puppet 5 but was removed in Puppet 6.

Conjur Puppet integration supports Puppet 6

Puppet 6 Support

In this epic (which will be completed in several stages, with milestones defined for each stage) we update this Conjur integration to include support for Puppet v6.

Project Scope

In Scope

  • Deprecating support for Conjur Enterprise v4. (anticipated but not yet confirmed)
  • Conjur credentials provided to integration using host factory or hardcoded API token.
  • Support matrix:
    • OS: Windows (Server 2012 and Server 2016) and Linux.
    • Puppet: v5 and v6.
  • New deferred flow: Puppet master passes deferred function to node, which executes secret fetch.
  • Updating docs to reflect Puppet v6 and deferred function support.
  • Improved development environment creation, particularly for Windows.
  • Automated tests across the support matrix above.
  • Enhanced stability in production enterprise environments.

Out of Scope

  • Support for alternate methods of providing integration with Conjur identity.
  • Conjur credentials provided via conjurize (we anticipated deprecating this workflow).
  • Conjur Enterprise v4 support.
  • PDK for test automation.

Project Value Overview

  • Puppet 6 Support – This new major version of the Conjur Puppet module adds support for Puppet v6 across both Linux and Windows nodes. Additionally, Puppet v5 remains fully supported.
  • Deferred Secret Retrieval – Leveraging the new deferred function feature in Puppet 6, the Conjur module can now delegate secret retrieval to the node itself. Previously, secrets were always retrieved by the Puppet master and provided to each node via the requested catalog. This follows Puppet’s recommend best practices for secret store integrations, as it removes the Puppet master as an unnecessary intermediary.
  • **Conjur Enterprise v4 Support Deprecated **– Official support for Conjur EE v4 using the Conjur Puppet module v2 is now deprecated. Support for module v2 and Conjur v4 will be officially removed in [TBD by PM]. Also, the new module v3 will not provide any support for Conjur EE v4. All customers on Conjur EE v4 are strongly recommended to upgrade to the most recent release of CyberArk’s Dynamic Access Provider.
  • “Conjurize” Support Removed – The “conjurize” method of providing Conjur credentials to a Puppet node has been removed from module v3. Please update your integration to use of the supported methods: API key identity or host factory tokens.

Release Plan

Milestone 1: Windows Puppet v6 Preview

  • Scope: Windows Only, Puppet v6 only, non-deferred retrieval only.
  • Release Stage: Community

Milestone 2: Linux Puppet v6 Preview

  • Scope: Linux and Windows, Puppet v6 only, non-deferred retrieval only.
  • Release Stage: Community

Milestone 3: Deferred Secret Retrieval Preview

  • Scope: Linux + Windows, Puppet v6, non-deferred + deferred secret retrieval.
  • Release Stage: Community

Milestone 4: Certified Release

  • Scope: Complete support matrix, Puppet v5 + v6
  • Release Stage: Certified (aka GA)

Implementation Plan

Milestone 1

  • Puppet CA chain retrieval doesn't rely on internal Puppet API methods (bug) - #44
  • Manually verify that the Conjur Puppet plugin does not work in Windows with Puppet v6 - #84
  • Manually verify that the Conjur Puppet plugin works in Windows with Puppet v5 - #86
  • Agent (facter?) doesn't find credentials in WinCred - #47
  • There has been a security review of Puppet v6 support for Windows - #87

Milestone 2

  • TBA

Milestone 3

  • TBA

Milestone 4

  • TBA

Use Puppet Dev Kit (PDK) for this plugin

Describe the solution you would like

Given that Puppet now has a development kit (PDK) that is used for module creation/testing/automation, it would be good to investigate our ability to move to this standard tooling if possible.

AC:

  • Use of Puppet Dev Kit is investigated if it can be used in this repo
  • Investigate if our fork of rspec-puppet is warranted if we switch

Module supports using the Deferred Type to execute lookups on the remote node

As a Puppet operator, I want to be able to leverage Puppet's new Deferred Type, so that I can use the remote node's identity to retrieve secrets from Conjur, without having those secrets transferred to the master.

GIVEN a Puppet master and an un-configured node which is enrolled in Conjur and have permission to access a credential
WHEN the module is run against the node
THEN credential are placed on the node
AND that credential does not flow through the master

Developer Notes
Overview and example of how this can be done in the upcoming Puppet 6 release: https://gist.github.com/turbodog/06d3fecef403bfefd9c8174ede4d9174

Manually verify that the Conjur Puppet plugin works in Windows with Puppet v5

Overview

We don't have automated tests for this Puppet integration with Windows, so we should manually verify that it works with Puppet v5.

In this card, we'd like to:

  • Validate that this integration works in a Windows environment (using Windows server 2012 or 2016) when used with Puppet v5
  • Document the process to get a test environment working, so that other developers can also create a Windows development environment

Definition of Done

Test environment:

  • Windows Server 2012 or 2016
  • Puppet v5 (clients and server)
  • Conjur or DAP (either way is fine - just document what you used) configured with a single Conjur host identity for the Puppet master server and nodes
  • The latest release of our Puppet integration

Using this environment, validate that you can run through a scenario like the smoketest example - ie that you can configure Puppet with a Conjur host and API key and successfully use Puppet to retrieve a secret value.

If you cannot, document the errors that you see along the way and any suggestions / ideas you have for how to address them (if any).

AC:

  • There are notes on this issue about how the test environment was created, so that others may try to follow the same instructions and try to reproduce
  • There are notes on this issue about any errors encountered when running through the scenario outlined above

Spaces are encoded correctly in variable IDs

Summary

Variable IDs are not encoded at all so in case a user has a variable with spaces in it, we are not able to retrieve it.

We should use an encoding method that encodes spaces into "%20" as required
by the Conjur v5 server. We also encode slashes into "%2F" as required.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a Conjur variable with a space in its ID, and populate it.
  2. Retrieve it with Puppet

Expected Results

Secret is retrieved

Actual Results (including error logs, if applicable)

404 error

There is documentation on how to configure this integration to use deferred functions

In #13 we propose modifying this integration to use Puppet deferred functions by default, but it is also possible to configure the existing integration (without modification) to retrieve credentials on agents using an API key and the deferred function.

In this card, we can add instructions for how to accomplish this manually to the project README.

AC:

  • README has instructions on how to retrieve credentials on agents using an API key and the deferred function

Puppet module has been released to Puppet Forge

The most recent work, adding Windows support to the Puppet module needs to be published to Puppet Forge to ensure users can use our work.

Tasks:

  • Update module metadata:
    • OS versions: >= 5.0
  • Version is bumped to 2.0.1

`conjur` class establishes identity for Windows servers

As a Windows admin, I want to utilized the module to enroll a Windows node in Conjur, so that I can automate the enrollment of Windows servers just like I can do for Linux servers.

GIVEN a Puppet master, a un-configured Windows node, Conjur, and a manifest which utilizes the host factory token or the host API key
WHEN I run the manifest
THEN the node is enrolled into the correct Conjur layer (when using the host factory token)
AND the node has credentials which can be used to connect to Conjur

Can't use a Conjur host with a "/"

Blocked by #19.

Current Behavior
When enrolling a host with a / in the id using a host factory token, for example:

...
authn_login        => 'host/staging/foo-1',
host_factory_token => Sensitive('3zt94bb200p69nanj64v9sdn1e15rjqqt12kf68x1d6gb7z33vfskx'),
...

the module attempts to create a host with the name staging.

Expected Behavior
The module will create a Conjur host name staging/foo-1 using the provided Host Factory token.

The difference between Puppet open source and Puppet Enterprise is understood

In order to understand whether our automated test suite / our manual tests need to test against Puppet Enterprise, we need to better understand the difference between Puppet OSS and Puppet Enterprise as it relates to our integration and the functionality it requires.

In this spike, we will research the difference between the two products and document in this card any info that is or may be relevant. This effort should be timeboxed to no more than a couple of hours.

AC:

  • This card has notes on the differences between Puppet open source and Puppet Enterprise and what differences may be relevant to our integration. In particular, if possible this issue should result in a recommendation about whether or not we will need to (manually or automatically) add tests that work with Puppet enterprise.

What is the license?

What license are you sharing this code under? Can you add a LICENSE file to the repo to make it explicit?

Manual test multiple API keys can serve different roles

We want to verify that a customer can work with API key per role and that each API key is served to the right node based on its role

This will be done for Puppet 5 on Linux. Further versions and OS might be tested on future issues

DoD

  • Puppet can get secrets for nodes and use the relevant API key based on their role

Out-of-date docker-compose files

Is your feature request related to a problem? Please describe.

Current docker-compose files are quite a bit out of date with other repos that we maintain. Update them to the currently-known best standard.

Describe the solution you would like

AC:

  • Update docker-compose files to modern standards
    • TBD

rename to cyberark-conjur

The module name is conjur-conjur right now. But to be consistent with source and our other integrations it should be cyberark-conjur.

Steps to success:
0. Wait until we have Puppet Forge 'cyberark' user creds

  1. Rename conjur-conjur -> cyberark-conjur in this project.
  2. Re-publish latest release to cyberark-conjur on the Forge.
  3. If possible, put a deprecation notice on the conjur-conjur forge page.
  4. Talk to Puppet about being re-certified.

Review technical debt in repo and make plan for nearterm enhancements

Review this repo and document items in the following categories with links to filed issues.

Improvements to release process

  • Unknown

Repo documentation improvements

  • N/A at this time. Repo docs are pretty decent.

Test suite improvements (in particular, tests to add to alert us early to breakages)

  • We don't test the plugin on Windows targets (#69)
  • Code coverage checks are missing (#53)
  • No changelog format verification (#68)

Repo standard maintenance tasks

  • Cleanup v4 API (#66)
  • Outdated compose files (#67)

Enhancement requests to consider

  • Upgrade to Puppet 6/PDK - we support EOLd puppet right now. Lots of ancillary issues. (#20, #64, #13)
  • OpenAPI spec use (#65)

Bugs

  • Agent doesn't find credentials in WinCred (#47) - Unconfirmed
  • Unknown other ones

Jenkins builds fail for conjur-puppet master branch for Conjur V5

Summary

The Jenkins builds for the conjur-puppet master branch are failing in the Conjur V5 test scenarios:
https://jenkins.conjur.net/job/cyberark--conjur-puppet/job/master/

This is a recent breakage, starting at 3/15, and failures are consistent.

Failures appear to revolve around line 36 in manifests/init.pp:

Evaluation Error: Error while evaluating a Method call, Unauthorized (file: /src/conjur/manifests/init.pp, line: 36, column: 35) on node f9dbff1fc804.ec2.internal�[0m

and later:

13:45:48  �[1;33mWarning: Unknown variable: 'api_key'. (file: /src/conjur/manifests/init.pp, line: 36, column: 50)�[0m
13:45:48  �[1;33mWarning: Unknown variable: 'authn_account'. (file: /src/conjur/manifests/init.pp, line: 36, column: 60)�[0m
13:45:48  �[1;31mError: Evaluation Error: Error while evaluating a Method call, 'conjur::token' parameter 'login' expects a String value, got Undef (file: /src/conjur/manifests/init.pp, line: 36, column: 35) on node d2dc3441b013.ec2.internal�[0m

Steps to Reproduce

Run the Jenkins tests for cyberark/conjur-puppet

Expected Results

Consistently passing Jenkins tests.

Actual Results (including error logs, if applicable)

Failures in the Conjur V5 test scenario.

Additional Information

There were many changes made recently to cyberark/conjur yesterday, so perhaps conjur-puppet needs changes to sync up?

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.