Forge Home


Shared functions for hardening modules


53,007 latest version

4.1 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.2 (latest)
  • 0.1.1
  • 0.1.0
released May 16th 2014

Start using this module

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

Add this module to your Puppetfile:

mod 'hardening-hardening_stdlib', '0.1.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add hardening-hardening_stdlib
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install hardening-hardening_stdlib --version 0.1.2

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.



hardening/hardening_stdlib — version 0.1.2 May 16th 2014

Hardening Stdlib (puppet)


Shared functions for hardening modules.


  • Puppet; nothing else



Try to set a hardening parameter. The user still has the option to override it, which will result in a warning.


merge_hardening( $original, $hardening, [ $name_of_parameter ] )

The $name_of_parameter is optional, but highly recommended to know which parameter results in a Warning.

For simple values:

# Only defined by hardening:
# $original_option = undef
# $hardening_option = "off"
# $merged_option = "off"
$merged_option = merge_hardening( $original_option, $hardening_option, "param <name>" )

# User override:
# $original_option = "on"
# $hardening_option = "off"
# $merged_option = "on" (emits a warning)
$merged_option = merge_hardening( $original_option, $hardening_option, "param <name>" )

For maps:

# Only defined by hardening:
# $original_option = { a: "on" }
# $hardening_option = { b: "off" }
# $merged_option = { a: "on", b: "off" }
$merged_option = merge_hardening( $original_option, $hardening_option, "map <name>" )

# User override:
# $original_option = { a: "on", b: "on" }
# $hardening_option = { b: "off" }
# $merged_option = { a: "on", b: "on" } (emits a warning)
$merged_option = merge_hardening( $original_option, $hardening_option, "map <name>" )


Taken from stdlib 4.2. You don't need to require this version of stdlib, but still get access to this function. See: stdlib v4.2 getparam description

Contributors + Kudos


License and Author

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.