Having run this app for a while now I figured this was long overdue...tested on Ubuntu 14-16:
git clone https://github.com/stamparm/maltrail.git
sudo mv maltrail /opt/
add to /etc/passwd:
maltrail:x:10000:10000::/opt/maltrail:/bin/false
add to /etc/group:
maltrail:x:10000:maltrail
edit your /opt/maltrail/maltrail.conf (interface, creds, etc...)
sudo chown -R maltrail:maltrail /opt/maltrail
create the two files below:
/lib/systemd/system/maltrail-server.service:
[Unit]
Description=Maltrail server
[Service]
User=maltrail
Group=maltrail
WorkingDirectory=/opt/maltrail
ExecStart=/usr/bin/nohup /usr/bin/python /opt/maltrail/server.py & disowm
[Install]
WantedBy=multi-user.target
/lib/systemd/system/maltrail-sensor.service:
[Unit]
Description=Maltrail sensor
[Service]
WorkingDirectory=/opt/maltrail
ExecStart=/usr/bin/python /opt/maltrail/sensor.py
[Install]
WantedBy=multi-user.target
then run:
sudo systemctl enable maltrail-server
sudo systemctl enable maltrail-sensor
lastly run:
sudo systemctl start maltrail-server
sudo systemctl start maltrail-sensor
updating:
sudo systemctl stop maltrail-server
sudo systemctl stop maltrail-sensor
cd /opt/maltrail
sudo cp maltrail.conf maltrail.conf.mine
sudo rm maltrail.conf
sudo git pull
copy local changes from maltrail.conf.mine to the new maltrail.conf
sudo chown -R maltrail:maltrail /opt/maltrail
sudo systemctl start maltrail-server
sudo systemctl start maltrail-sensor
Hello,
ReplyDeleteYou've a duplicate entry for '/lib/systemd/system/maltrail-sensor.service:' in the text. The fist entry should be '/lib/systemd/system/maltrail-server.service:'
Thanks for the tutorial anyway ;-)
Hello Digitalx00
ReplyDeleteI want to thank you for the informative article.
It save my time and my service
Thanks for the article
ReplyDelete