Re-work sunrpc module to make porting easier

Re-organise the sunrpc module so that the service check is in the
base (Plugin-derived) class but uses a service string defined only
in the subclasses. This allows the same checkenabled() to be used
for any policy that implements the needed runlevelByService() API.

This can serve as a prototype for a generic enabled-by-service
facility (mimicking existing files and packages checks) although
it currently needs considerable work to review and revise the
service and runlevel interfaces in the policy modules.

Related to Issue #77
Add logging to regex subsitution methods

Currently we don't log anything when applying file or command
output regex substitutions and any errors are silently discarded.

This could cause a user to think that passwords etc. have been
obscured when in fact they have not.

Log our intent to substitute at debug level and log any exception
at error level along with the path or glob, module and exception
text.

Fixes Issue #84
Work around non-writable directories in host file systems

Distributions that have moved to reduced capabilities and replaced
suid and sgid binaries with fscaps have tightened the permissions
on several standard system paths. For e.g.:

dr-xr-xr-x. 18 root root 4096 Nov 23 19:04 /
-rw-r--r--.  1 root root 1174 Dec 11 18:05 /etc/passwd
----------.  1 root root  742 Dec 11 18:05 /etc/shadow
dr-xr-x---.  8 root root 4096 Dec 12 19:06 /root

Processes that need to write to these paths on the host system
must possess cap_dac_override in order to work but in the archive
this creates problems when unpacking the archive without this
capability.

For files this is not a problem since the user only requires write
permissions to the containing directory to remove the file. For
directories it causes real problems for unprivileged users working
with sosreport archives.

This includes problems unpacking the archive (since directories
are created without write permissions causing subsequent file
creation beneath that path to fail) as well as problems cleaning
up archives as a typical 'rm -rf' fails to remove these paths.

These problems make it impossible to create archives that are both
failthful to the host system and easy to work with for typical
analysis users. Ultimately this may necessitate dropping permission
preservation in the archive and instead storing these (and other
information like ACLs and SELinux context) in files within the
archive instead).

Works around Issue #85
Add profiling to command and file substitution methods

Add profiling calls around the regex substitution methods.

Shows that substitution costs are considerable compared to copy:

copied: /root/anaconda-ks.cfg                                                       time: 0.002293
copied: /var/log/anaconda/anaconda.log                                              time: 0.002204
copied: /var/log/anaconda/syslog                                                    time: 0.002709
copied: /var/log/anaconda/anaconda.packaging.log                                    time: 0.002658
copied: /var/log/anaconda/ks-script-YGuewK.log                                      time: 0.002483
copied: /var/log/anaconda/anaconda.program.log                                      time: 0.002416
copied: /var/log/anaconda/anaconda.storage.log                                      time: 0.002263
copied: /var/log/anaconda/anaconda.xlog                                             time: 0.002299
copied: /var/log/anaconda/anaconda.ifcfg.log                                        time: 0.002461
copied: /var/log/anaconda/ks-script-kdAaa4.log                                      time: 0.002558
subst : /root/anaconda-ks.cfg                                                       time: 0.021056

I.e. subsituting one file is on average eight times more costly
than simple collection.
Do not allow duplicate destinations in TarFileArchive.add_file()

The logic to ensure we have a proper tar record for each directory
in the path of files collected with addCopySpec*() ends up
generating lots of duplicate calls to add_file(). Filter them out
by checking for the existence of the new destination in
tarfile.getnames().

This reduces peak resident memory consumption by 50-75% and cuts
run times by 50-66%.

Related to Issue #81
Teach pam module about multilib

The pam module collects a list of files in /lib/modules which may
be empty on 64-bit systems. Collect both possible paths.
Change collection of /lib/systemd

Since /lib/systemd contains binaries don't collect the whole thing.
Grab /lib/systemd/sysem and /lib/systemd/user as these contain
unit files and symlinks but just take a directory listing for
/lib/systemd itself and the other subdirectories.
Fix relative paths in reports

Fix the relative paths used by the legacy HTML reporting methods
and passed by sosreport to the new Report class.

Fixes Issue #88
Fix exception when unreadable files are collected

Files in /proc/, /sys/ and other kernel file systems may have read
permissions but not implement a read() syscall. Catch the
exception that occurs when accessing these files.

Fixes Issue #87
Fix sar plugin error message
Fix typo in sar module
Fix sar file collection and error reporting
Remove sar file root symlinks
Delete vestigial coloured output code

Colour output was removed from sos a long time ago. Kill off the
remaining opts variable, command line option and documentation
references for increased sanity.
Add output of ntptime to ntp module
Make Ubuntu/Debian depend on python-selinux (Closed GH:#93)

Signed-off-by: Adam Stokes <hackr@cypherbook.com>
Merge pull request #94 from battlemidget/feature

Make Ubuntu/Debian depend on python-selinux (Closed GH:#93)
Rename command output collection interfaces

The method names for collecting external output are ugly and
awkward to type. Rename them to be more consistent with the file
collection API and easier to remember and type.

This change touches virtually every plugin class but is a very
simple search/replace (plugin changes were done with sed).

Fixes Issue #92.
Separate archive classes from utilities module

This is the start of the archive reworking to address Issue #86.

In this commit the Archive class hierarchy is separated from the
generic code in the utilities module and moved into its own
'archive' module. This is taken from the changes committed to
Jesse's directory_archive branch.

The next step is to decide how we will handle the problems
discovered with the in-line tarfile generation (and similar
problems affecting Zip files) and whether to revert to building
an in-filesystem tree (as Jesse's current branch does) or whether
to fix the problems with in-lining post-processing hooks.
Fix import statement in archives_test.py