duosecurity / duo_log_sync

MIT License
37 stars 28 forks source link

Feature Request: Please daemonize the applictaion #29

Open guarismo opened 2 years ago

guarismo commented 2 years ago

How can I run thins in the background with a 'screen'? How can I register it as a service in Linux and use systemd?

leandrojmp commented 2 years ago

I run the duologsync utility as a service with systemd without any problems, you just need to create the systemd service file.

If you want an example, here is the one I'm currently using:

#/etc/systemd/system/duologsync.service
#
[Unit]
Description=Duo Log Sync
After=network-online.target
Requires=network-online.target

[Service]
Type=simple
User=duologsync
Group=duologsync
ExecStart=/var/opt/duo_log_sync/.venv/bin/duologsync /var/opt/duo_log_sync/config/config.yml
Restart=on-failure
RestartSec=5s
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

In my case I created the user and group duologsync and I'm running it from the /var/opt/duo_log_sync, using a .venv.

SysAdminforCoffee commented 1 year ago

If this could be added to the Readme that would be great.

@leandrojmp the user/group creation doesn't cause a permissions issue with Python?

leandrojmp commented 1 year ago

@SysAdminforCoffee I didn't had any issues, I was using it with a venv owned by the same user.

I'm not using this tool anymore, since I'm using Elasticsearch, I moved to the Elastic Agent Duo integration.