Doorman is an osquery fleet manager that allows administrators to remotely manage the osquery configurations retrieved by nodes. Administrators can dynamically configure the set of packs, queries, and/or file integrity monitoring target paths using tags. Doorman takes advantage of osquery's TLS configuration, logger, and distributed read/write endpoints, to give administrators visibility across a fleet of devices with minimal overhead and intrusiveness.
Doorman makes extensive use of tags. A node's configuration is dependent on the tags it shares with packs, queries, and/or file paths. As tags are added and/or removed, a node's configuration will change.
For example, it's possible to assign a set of packs and queries a
baseline tag. To ensure all nodes then receive this baseline configuration, you simply assign the
baseline tag to the nodes you wish to include.
Click on any node to view its recent activity, original enrollment date, time of its last check-in, and the set of packs and queries that are configured for it. This view provides an "at-a-glance" view on the current state of a node.
With Doorman, you can distribute ad-hoc queries to one, some, or all nodes. A distributed query's status in Doorman is tracked based on whether the node has picked up the query and/or returned its results.
If you're not acting on the information you collect, what's the point? Doorman allows fleet managers to configure custom rules to trigger alerts on specific events (for example, an unauthorized browser plugin is installed, or a removable USB storage device is inserted). Doorman allows building complex rule sets that can use arbitrary boolean logic and a variety of operators to test the results of a query. For example:
Doorman allows supports alerting via the following methods:
Doorman is intended to be configured to receive results from nodes via the osquery tls logging plugin. Results are saved in a Postgres database for easy access to recent events. Doorman also supports development of custom plugins to handle event data, allowing Doorman to send data elsewhere, such as to a separate file, rsyslog, Elasticsearch, etc.
Doorman exposes the following osquery tls endpoints:method url osquery configuration cli flag POST /enroll
To reach the Doorman management interface, point your browser at https://localhost:5000/manage/ (or the server it's running on).
Authenticating to Doorman can be handled several ways:
DOORMAN_AUTH_METHOD = None
DOORMAN_AUTH_METHOD = 'doorman'
DOORMAN_AUTH_METHOD = 'ldap'
DOORMAN_AUTH_METHOD = 'google'
None implies no authentication, resulting in an exposed manager web interface. If you deploy the api and web interface (the manager) separately, and the manager will only be accessible from a trusted network, this may be enough for you.
doorman utilizes username and password based authentication, managed by the backend database. Passwords are stored as bcrypt hashes with a work factor of 13 log_rounds. Doorman does not support user registration, or password reset capabilities from the web interface. This must be handled by the administrator using Doorman's manage.py script.
ldap authentication relies on an LDAP server to authenticate users. See the flask-ldap3-login documentation for the configuration values required by the plugin in order to successfully bind and authenticate to your LDAP server.
DOORMAN_OAUTH_CLIENT_ID = "client_id"
DOORMAN_OAUTH_CLIENT_SECRET = "client_secret"
Additionally, you should configure at least one of the following:
Both of the aforementioned keys accept a list argument of app domains or user email addresses that are authorized to authenticate to Doorman. WARNING: if these values are not configured, then anyone with a Google account will be able to authenticate to your instance of Doorman!
The callback URL by default is
SERVER_NAME is populated from the environment parameters passed from your upstream web proxy (i.e., nginx's server_name).
Doorman's default configuration can be overridden by setting the
DOORMAN_SETTINGS environment variable to a configuration file.
The following settings should be configured to get up and running:Setting Description
SECRET_KEYFlask's secret_key. This should be a cryptographically secure random value, unique to your environment.
SERVER_NAMEThe name and port number of the server. See Flask's Builtin Configuration Values for more details.
PREFERRED_URL_SCHEMEThe URL scheme that should be used for URL generation if no URL scheme is available. This defaults to
SQLALCHEMY_DATABASE_URIThe database URI that should be used for the connection. Example:
BROKER_URLThe Celery broker URL. Default:
CELERY_RESULT_BACKENDThe Celery result backend URL. Default:
DOORMAN_ENROLL_SECRETA list of valid enrollment keys to use. See osquery TLS remoting settings for more information. By default, this list is empty.
DOORMAN_EXPECTS_UNIQUE_HOST_IDIf osquery is deployed on endpoints to start with the
--host_identifier=uuidcli flag, set this value to
True. Default is
DOORMAN_CHECKIN_INTERVALTime (in seconds) nodes are expected to check-in for configurations or call the distributed read endpoint. Nodes that fail to check-in within this time will be highlighted in red on the main nodes page.
DOORMAN_ENROLL_DEFAULT_TAGSA default set of tags to apply to newly enrolled nodes. See also
DOORMAN_ENROLL_SECRET_TAG_DELIMITERA delimiter to separate the enroll secret from tag values (up to maximum of 10 tags) the node should inherit upon enrollment. Default is
None, i.e., a node will not inherit any tags when first enrolled. This provides a little more flexibility than
DOORMAN_ENROLL_DEFAULT_TAGS, allowing individual nodes to inherit different tags based on environment, asset class, etc. In the osquery configuration, you would supply an enroll secret in the format:
:is your tag delimiter.
DOORMAN_CAPTURE_NODE_INFOA list of tuples, containing a pair of osquery result column and label used to determine what information is captured about a node and presented on a node's information page. In order for this information to be captured, a node must execute a query which returns a result containing these columns. By default, the following information is captured: (i.e.,
select * from system_info;)
DOORMAN_EXTRA_SCHEMADoorman will validate queries against the expected set of tables from osquery. If you use any custom extensions, you'll need to add the corresponding schema here so you can use them in queries.
DOORMAN_MINIMUM_OSQUERY_LOG_LEVELThe minimum osquery status log level to retain. Default is
0, (all logs).
DOORMAN_AUTH_METHODThe authentication backend used to authenticate Doorman users (not osquery endpoints). May be one of:
None. See the [authentication] (#authentication) section above for more information.
AbstractAlerterPluginimplementations. This settings expects a dictionary of alerter names and tuples, where the first tuple item is the class name implemting
AbstractAlerterPluginto import, and the second value is a dictionary configuration passed to configure the Alerter class. Available Alerter plugins at time of this release are:
MAIL_DEFAULT_SENDERIf using the
doorman.plugins.alerters.emailer.EmailAlerteralerter above, specify the sender email address used by Doorman for the
SENTRY_DSNA Sentry project DSN (Data Source Name). See Sentry docs for more information.
Install PostgreSQL (9.4 or later).
a. Choose a directory to host the database. We'll use
~/doormandb for these examples.
initdb ~/doormandb to initialize the database.
pg_ctl -D ~/doormandb -l ~/doormandb/pg.log -o -p5432 start to start a Postgres instance.
If you reboot or otherwise, just run the pg_ctl ... start command above to resurrect the server.
Create the doorman database by running:
createdb -h localhost -p 5432 doorman
Install and start Redis:
Install the required Python dependencies under requirements/dev.txt.
Initialize the database by running:
python manage.py db upgrade
Generate a self-signed certificate for testing, or obtain one from Let's Encrypt.
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate.crt
Start the doormany celery workers:
celery worker -A doorman.worker:celery -l INFO
Start doorman by running:
python manage.py ssl
Launch osquery with the appropriate cli flags to configure it to use the TLS enrollment, configuration, logging, and distributed read/write API's. Below is an example osquery.flags to be used only for testing:
--pidfile=/tmp/osquery.pid --host_identifier=uuid --database_path=/tmp/osquery.db --config_plugin=tls --config_tls_endpoint=/config --config_tls_refresh=10 --config_tls_max_attempts=3 --enroll_tls_endpoint=/enroll --enroll_secret_env=ENROLL_SECRET --disable_distributed=false --distributed_plugin=tls --distributed_interval=10 --distributed_tls_max_attempts=3 --distributed_tls_read_endpoint=/distributed/read --distributed_tls_write_endpoint=/distributed/write --logger_plugin=tls --logger_tls_endpoint=/log --logger_tls_period=5 --tls_hostname=localhost:5000 --tls_server_certs=./certificate.crt --log_result_events=false --pack_delimiter=/ --utc --verbose --tls_dump=true
And then invoke
osqueryd as root by running:
root@localhost# ENROLL_SECRET=secret osqueryd --flagfile osquery.flags
Point your browser at https://localhost:5000/manage/ to get to the main administration page (visiting the root index from a browser will return an HTTP 204 No Content response).
First, build the Docker container:
$ docker build -t doorman .
Second, run the container, providing it with the credentials to access the Postgres database:
$ docker run \ -e DOORMAN_ENROLL_SECRET=foo \ -e DOORMAN_SECRET_KEY=secret-key \ -e POSTGRES_USER=doorman \ -e POSTGRES_PASSWORD=pass \ -e POSTGRES_ENV_POSTGRES_PORT=your-host-here \ -p host-port:5000 \ doorman
The container will contain everything needed for Doorman to function (i.e.
Redis, the Celery worker, and the API), managed by
Runit. You can edit the service configuration
to set additional options.
POSTGRES_ENV_POSTGRES_PORT environment variable is the same
variable that is expected when using the
--link argument to
docker run, so
linking a Postgres container to the Doorman container should work without
passing that environment variable.
If you want to secure your instance with authentication then you will need to configure Google auth (which is currently the only one supported with Heroku); see the next section.
In order to configure authentication with Google, you need to do the following steps:
Credentialssection on the left menu;
Create credentialsbutton and choose
OAuth client ID;
Web applicationfor an application type;
https://YOUR_DOMAIN/oauth2callback(put in the domain you have installed the app on, and check scheme). For Heroku it will be
APPNAME.herokuapps.comunless you use your own domain.
Createbutton; you will get
CLIENT_SECRETvalues to put in the config.
Credentialspage and open
OAuth consent screentab. Fill in required fields.
*_ALLOWED_USERSconfig option. If you want to specify several accounts, separate them with spaces.
To execute tests, simply run
python manage.py test.
Q. I started Doorman and it looks like it's running, but how do I actually use it?
A. Point your browser at https://localhost/manage/ (or whatever domain name/port number it's hosted on).
Q. When loading /manage/ in the browser for first time, I receved some error about lessc not being installed.
lesscshould have been installed during the
bower installstep above. If it did not install, you can install it by running
npm install -g lessor installing less via your operating system distribution's package manager.
Q. I try to run the
python manage.py db upgrade script, but I get an error along the lines of: type "JSONB" does not exist.
Verify you have postgresql 9.4 (or later) installed. Doorman uses the postgresql JSONB column type for storing osquery result data.
Doorman is written and maintained by Marcin Wielgoszewski, with contributions from the following individuals and companies: