Deprecate IP-based authentication

This will need to be made explicit in a future version, so it's good to
get people to stop using it if possible.
Add Selector terminus for file_content/file_metadata

This terminus is now the default, and encapsulates the behavior that was
previously in the IndirectionHooks. That is, we dynamically select the
terminus to use for a file request based on the key. However, for the
puppet master, we instead explicitly always use the FileServer terminus,
so that *all* requests for files from the master will go through
the file server. This ensures that we will never accidentally
serve local files on the puppet master.
Reject file requests containing ..
Fail more gracefully when finding module files if no file is specified

Previously this would just complain about trying to call `nil.split`.
Always use the local file_bucket on master

This fixes an issue where the master could be made to issue arbitrary
HTTPS requests through carefully constructed URLs. Now the master will
always use the file_bucket, whereas other applications retain their
behavior of dynamically selecting the source (rest or file) based on the
particular request.
Use head method to determine if file is in file bucket

This call was using find, but wasn't doing anything with the result,
only checking whether the file existed. Using head here is more
semantic and saves the trouble of reading the file if it does
exist.
Fix whitespace inside parentheses
Add specs for selector terminuses of file_{content,metadata}
Validate CSR CN and provided certname before signing

This adds a few new checks when signing CSRs, to validate the CN. First,
it must conform to a small set of characters, which are the printable
ASCII characters, except for '/' (because we store these in files). This
prevents attacks such as a CN "foo^H^H^Hbar", which appears as "bar" to
"puppet cert list".

The other check is that the certname for the SSL::Host that we think
we're signing must match the CN. This prevents a CSR with the CN "foo"
from being submitted as a CSR for "bar", which would cause it to appear
as "bar" to "puppet cert list", but to issue a certificate for "foo".
Don't allow the creation of SSL objects with invalid certnames

This ensures we catch invalid certnames earlier in the process, such as
when an agent is starting or making a certificate request, rather than
at the very last step of signing the request. This should make for
better error messages to the user.
Use "inspect" when listing certificates

This fixes an issue of `puppet cert list` potentially not accurately
depicting the actual certname of the certificate/request. For instance,
"foo^H^H^Hbar" would simply appear as "bar".
Tighten permissions on classfile, resourcefile, lastrunfile, and lastrunreport.
Merge branch 'file-server-2.7.17' into security_fixes_2.7.18
Merge branch 'deprecate-ip-authentication-2.7.17' into security_fixes_2.7.18
Merge branch 'clean-permissions-2.7.17' into security_fixes_2.7.18
Reject directory traversal in store report processor
Merge branch 'store-report-processor' into security_fixes_2.7.18
Update CHANGELOG lib/puppet.rb conf/redhat/puppet.spec for 2.7.18
Merge pull request #912 from daniel-pittman/maint/2.7.x/tests-must-use-must-not-should-on-resources

tests must use must not should on resources
(#11868) Use `Installer` automation interface to query package state

Previously, Puppet recorded MSI packages it had installed in a YAML
file. However, if the file was deleted or the system modified, e.g.
Add/Remove Programs, then Puppet did not know the package state had
changed.

Also, if the name of the package did not change across versions, e.g.
VMware Tools, then puppet would report the package as insync even though
the installed version could be different than the one pointed to by the
source parameter.

Also, `msiexec.exe` returns non-zero exit codes when either the package
requests a reboot (194), the system requires a reboot (3010), e.g. due
to a locked file, or the system initiates a reboot (1641). This would
cause puppet to think the install failed, and it would try to reinstall
the packge the next time it ran (since the YAML file didn't get
updated).

This commit changes the msi package provider to use the `Installer`
Automation (COM) interface to query the state of the system[1]. It will
now accurately report on installed packages, even those it did not
install, including Puppet itself (#13444). If a package is removed via
Add/Remove Programs, Puppet will re-install it the next time it runs.

The MSI package provider will now warn in the various reboot scenarios,
but report the overall install/uninstall as successful (#14055).

When using the msi package resource, the resource title should match the
'ProductName' property in the MSI Property table, which is also the
value displayed in Add/Remove Programs, e.g.

    package { 'Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148':
      ensure => installed,
      ...
    }

In cases where the ProductName does not change across versions, e.g.
VMware Tools, you MUST use the PackageCode as the name of the resource
in order for puppet to accurately determine the state of the system:

    package { '{0E3AA38E-EAD3-4348-B5C5-051B6852CED6}':
      ensure => installed,
      ...
    }

You can obtain the PackageCode in ruby using:

    require 'win32ole'
    installer = WIN32OLE.new('WindowsInstaller.Installer')
    db = installer.OpenDatabase(path, 0)
    puts db.SummaryInformation.Property(9)

where <path> is the path to the MSI.

The msi provider does not automatically compare PackageCodes when
determining if the resource is insync, because the source MSI could be
on a network share, and we do not want to copy the potentially large
file just to see if changes need to be made.

The msi provider does not use the `Installer` interface to perform
install and uninstall, because I have not found a way to obtain useful
error codes when reboots are requested. Instead the methods
`InstallProduct` and `ConfigureProduct` raise exceptions with the
general 0x80020009 error, which means 'Exception occurred'. So for now
we continue to use msiexec.exe for install and uninstall, though the msi
provider may not uninstall multi-instance transforms correctly, since
the transform (MST) used to install the package needs to be respecified
during uninstall. This could be resolved by allowing uninstall_options
to be specified, or figuring out how to obtain useful error codes when
using the `Installer` interface.

[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa369432(v=vs.85).aspx