Notification service#

This section provides instructions for activating the email notification service.

Launching the service with poetry#

From the directory used to install Vulnerability-Lookup:

poetry run flask --app website.app notify_users

Launching the service with systemd#

Create the file /etc/systemd/system/vulnerability-lookup-notify.service:

[Unit]
Description=Vulnerability-Lookup notification service
After=vulnerability-lookup-web.service
Requires=vulnerability-lookup-web.service

[Service]
Type=simple
User=<system user used to install Vulnerability-Lookup>
Group=<group of the user used to install Vulnerability-Lookup>
WorkingDirectory=<path to the cloned repository>
Environment="VULNERABILITYLOOKUP_HOME=<path to the cloned repository>"
ExecStart=<path to poetry> run python -m flask \
    --app website.app notify_users
StandardOutput=append:/var/log/vulnerability-lookup_notify_message.log
StandardError=append:/var/log/vulnerability-lookup_notify_error.log
Restart=on-failure
RestartSec=15s

[Install]
WantedBy=multi-user.target

Note

Use Requires only if the web service is managed by systemd on the same host, otherwise just use After to ensure the web service starts before the notification service when both are enabled on the same host.

Then reload and enable the service:

sudo systemctl daemon-reload
sudo systemctl enable vulnerability-lookup-notify.service
sudo systemctl start vulnerability-lookup-notify.service
systemctl status vulnerability-lookup-notify.service

To follow the service logs live:

sudo journalctl -u vulnerability-lookup-notify.service -f

Error logs:

tail -f logs/vulnerability-lookup_notify_error.log

Messages:

tail -f logs/vulnerability-lookup_notify_message.log