From ccf06b7c9cb205c214fe923ca0eb8b30f3f80302 Mon Sep 17 00:00:00 2001 From: ag-michael Date: Wed, 22 Jul 2020 06:55:31 +0000 Subject: [PATCH] Added documentation on how to configure gunicorn with systemd --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index cc87691..9877496 100644 --- a/README.md +++ b/README.md @@ -223,3 +223,55 @@ and modify `~/.misptaxii/remote-servers.yml` to resemble ``` now try polling again + + +## Configuring Gunicorn with Systemd + +Review, edit and save the following Systemd Unit definition at `/etc/systemd/system/misp-taxii-server.service` + +``` +# /etc/systemd/system/gunicorn.service + +[Unit] +Description=gunicorn open taxi server +After=network.target + +# Wait for apache2/MISP to start +After=apache2.service + +[Install] +WantedBy=multi-user.target + +[Service] + +User=misp +Group=misp + +# Prevent writes to /usr, /boot, and /etc +ProtectSystem=full + +# Execute pre and post scripts as root, otherwise it does it as User= +PermissionsStartOnly=true + +ExecStart=/usr/bin/gunicorn opentaxii.http:app --bind localhost:9000 --config python:opentaxii.http \ + --log-level=debug --log-file=/home/misp/integrations/log/opentaxi.log --reload --limit-request-line 0 +Type=simple + +KillSignal=SIGKILL + +# Set TimeZone +Environment="TZ=UTC" + +# Set MISP-Taxii-Server environment variables - Edit this as needed +Environment="OPENTAXII_CONFIG=/home/misp/integrations/MISP-Taxii-Server/config/config.yaml" +Environment="PYTHONPATH=." + +``` + +To enable and start the service: + +``` +systemctl enable misp-taxii-server +systemctl start misp-taxii-server +``` +