(#18931) Add setting to control how remote metadata is copied

WTF, this is wrong, this needs to be a file parameter

Previously, when puppet applied a file resource with a remote source,
e.g. `source => 'puppet:///...', it would always copy the owner, group,
and mode values from the remote file to the local file, even if those
properties were not being managed.

This affected both newly created files (#5240) and modifying existing
ones (#18931). This behavior goes against puppet's principle of only
managing properties of the resource that are specified in the manifest.

The behavior has security implications on Unix, as there are no guarantees
that the uid/gid on the remote system refer to the same accounts on the
local system. It also has security implications on Windows, due to
puppet breaking filesystem inheritance. However, this behavior has
existed since at least 0.25.0.

This commit adds a setting `source_permissions` whose values are
`always`, `creates`, or `never`, where `always` corresponds to the
existing behavior, and is the default. The `creates` value will cause
puppet to only copy owner, group, and mode from the remote site when
creating the file resource (file, directory, or link), but not when
managing an existing file. The `never` value will cause puppet to never
copy owner, group, and mode from the remote side.

Note that if you specify an owner, group, and/or mode property in the
manifest, then that will always managed and take precedence over the
remote values.
(#18931) Make non-root puppet not set group on files.

Previously there was code so that non-root puppet would not
atttempt to set owner on files (makes sense).  The same logic
applies to group, so this patch simply extends that same code
so that non-root puppet doesn't attempt to set group on files.
(#18931) Convert source_permissions from Puppet setting to file param
(#7244) Consolidate autosign setting

Previous implementation split out a new autosign_command setting for the
custom policy executable, which required a confusing autosign=false
setting.

This commit removes the autosign_command setting and instead uses the
autosign setting for all modes (true/false, autosign.conf or custom
policy executable).  Internally we refactor to distinguish between
autosign.conf or an executable by the executable bit.

We are removing the mode of the autosign setting, because it was
stripping all executables of their executable bit.  This only removes
the guarantee that group and other do not have write permissions.
However, these are the default permissions for a regular file on most
systems, so nothing should be lost.
(Maint) Introduce partial implementation of an In-Memory file

Quite often in tests we want to work with a "file", but not actually
deal with the file system. We usually do that by mocking out all sorts
of things on File and FileUtils and Dir and various other places. Now
that we have Puppet::FileSystem::File (and maybe at some point in the
future we'll have Puppet::FileSystem::Store to represent the actual
storage system, what we normally call the filesystem itself) we can
create different kinds of files.

This adds Puppet::FileSystem::MemoryFile, which, so far, only partially
implements the methods on Puppet::FileSystem::File and addes 3 methods
to Puppet::FileSystem::File to allow us to easily create a view onto the
filesystem: overlay, remember, forget.
(#7244) Fix up tests after refactors of the Autosign system

The refactoring of the Autosign system changed its interaction with the
filesyste. This fixes up the tests to work with the new interactions and
hopefully be more robust to future changes.
(#19514)(PP-773) Rename hashed_node_data and cliencert for $trusted

This renames hashed_node_data to trusted_node_data, and
the element 'clientcert' to 'certname'.

This also fixes the issues regarding immutability reported in PP-773.
It is now not possible to alter the trusted data. (A freeze was missing
when the data was created). As extra precaution, the data is frozen when
set as trusted data in the node.

There is now also a warning if an attempt is made to modify the trusted
data by manipulating a node.
(#18931) Refactor slightly for readability

Minor cleanup:
* be consistent about accessing resource member sans @
* refactor copy_source_values for readability
* mark two methods private
Merge pull request #2083 from zaphod42/jpartlow-feature/7244/refactor-autosign-setting

(#7244) Consolidate autosign setting
(#18931) Replace 'puppetmaster' with 'puppet master'
(#18931) Rename source_permissions param values

After some discussion with Nick, this patch renames the three
values of the source_permissions:
* always -> use
* creates -> use_when_creating
* never -> ignore

The concern with the previous names is that 'always' and 'never'
might mislead a user to think that this overrode managed values
for owner/group/mode, when in fact the source_permissions param
only refers to behavior for *unmanaged* values.  So 'use'/'ignore'
don't carry that absolute implication while still describing the
behavior.  'use_when_creating' is a little long and awkward, but
also expected to be the least used option.
(#7243) Add dns_alt_names with hostname to autosign test

Lack of hostname as a dns_alt_name was producing master certs which
could not be looked up by bare hostname (as used by Beaker) in the
Jenkins environment.
Merge branch 'feature/7243/fix-autosign-command-acceptance-subjectaltnames'

* feature/7243/fix-autosign-command-acceptance-subjectaltnames:
  (#7243) Add dns_alt_names with hostname to autosign test
(#18931) Convert the mode to a string for consistency.

In commit 3e592777 file modes were converted from an integer
to an octal string, but missed this one location.  For those of
us who don't convert octal to decimal immediately, this was
confusing.  This patch uses strings for mode consistently,
at least within this file.
(#19514) Correct error message matching for Ruby 1.8.7

In Ruby 1.8.7, the error message for an attempt of mutating
a frozen hash refers to 'hash' using lower case whereas later versions
use capital 'H'. This caused two tests to fail (twice).
(#18931) Extend tests for local

Add tests to verify that local trumps source_permissions across the board.
Add verification that the mode is copied for local sources.
Define Puppet cert attribute OIDs

This commit defines an initial set of OIDs for private use within Puppet. The
defined OIDs are focused toward identifying node information that is
embedded in a node certificate.
Merge pull request #2085 from adrienthebo/feature/puppet-custom-oids

Define Puppet cert attribute OIDs
Merge pull request #2084 from hlindberg/issues/issue-19514

(#19514)(PP-773) Rename hashed_node_data and cliencert for $trusted
(Maint) Add memory terminii for CR and Key

These are sometimes useful in tests when we don't want to deal with
saving the certificates to disk, but will want to allow them to be saved
somewhere.