This patch implement a new rabbitmq exchange called migevent where
the scheduler publishes any event of interest. Workers can subscribe
to specific events using binding keys (standard rabbitmq topic
exchange). A simple mozdef-asset worker is implemented, and the base
for an agent verification worker is also present but not yet functional.
Similar to the work done on the api, instead of managing investigator's keys
with a gpg keyring on disk, pull the keys from the database and manage a
keyring in memory.
The addition here is the management of the scheduler's own investigator
identity, that's used during the upgrade protocol to kill old agents. That private
key is also stored in the database, with permissions that limit the access to the
column to the schedulers themselves.
This commit is a giant refactoring of the data model of MIG. Moving from
mongo to postgres introduced a number of constraints in order to fit action,
commands, agents and investigators into a relational database. The result is
a much cleaner, much easier to query, database backend that will let us
create reports much more easily.
Plus, postgresql json support is awesome!