agent: Run our own session DBus daemon for use by cockpit-agent

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: Run cockpitd as a session service not a system service

Fixes #494

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Put the self-signed cert in /etc/cockpit/ws-certs.d

Give it a name so it comes last in the ordering.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: The /var/lib/cockpit directory is wheel owned

This allows wheel users to add and remove machines from the
dashboard.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: Ignore SIGPIPE, it's not useful in daemons

systemd used to do this for us when spawning cockpitd, but
lets do this in our own daemon now.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
common: Remove useles CockpitLogLevel define

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Log cockpit-agent output to journal

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Kill the session dbus-daemon when cockpit-agent dies

This helps clean up after ourselves. All the various session DBus
services that were started will be exited cleanly.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Don't exit if dbus-daemon session bus we started exits

cockpit-agent is in control of the lifetime of the dbus session
bus for its session, not the other way around.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Stop the agent mainloop when we get a SIGTERM

This correctly shuts down the agent in the presence of a SIGTERM,
including letting us unregister cleanly from polkit and so on.

Note that we only wait for one SIGTERM, if we receive a second one
a little later, that one will actually terminate the process.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
common: Don't leak zombies for processes owned by CockpitPipe

If CockpitPipe is disposed, we don't want the child to become a
zombies. Keep an active child watch (which will end up calling
waitpid), if we are finalized before the process exits.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: Proper errors when can't write out the machines file

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: Fix race starting up realmd proxy

There's a race where method calls are invoked before the realmd
proxy is ready.

Since we're going to replace this code anyway, lets use this
work-around for now.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
daemon: More verbose errors from realmd proxy operations

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Add proper names to the local session pipe

So that it showns up as 'localhost' in debug messages.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
test: Make certain tests run as root for the time being

More work needs to be done to make cockpitd function fully
as non-root. This work will be done as a follow up.

This change makes several tests run as root login, and disables
a handful of tests.

Closes #571
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
Signed-off-by: Marius Vollmer <marius.vollmer@redhat.com>
 * Ignore one jornal message in TestStorage.testHidden