smicallef / spiderfoot

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
http://www.spiderfoot.net
MIT License
13.28k stars 2.29k forks source link

Running Spiderfoot as systemd service #1737

Closed Gill-Bates closed 2 years ago

Gill-Bates commented 2 years ago

I want to run Spiderfoot as a systemd service and using nginx as a ReverseProxy

When I run Spiderfoot from the Console, nginx works as expected:

python3 ./etc/spiderfoot/sf.py -l 127.0.0.1:5001

But when I run spiderfoot as a systemd service,

[Unit]
Description=Spiderfoot
After=multi-user.target network-online.target

[Service]
Type=simple
Restart=always
User=root
ExecStart=python3 ./etc/spiderfoot/sf.py -l 127.0.0.1:5001

[Install]
WantedBy=default.target

I get an error in my browser:

image

Any idea what going on here?

bcoles commented 2 years ago

What do the logs say?

Gill-Bates commented 2 years ago

Solved by adding WorkingDirectory=/etc/spiderfoot in my systemd-Configuration.

Working Solution:

[Unit]
Description=Spiderfoot
After=multi-user.target network-online.target

[Service]
Type=simple
Restart=always
User=www-data
WorkingDirectory=/etc/spiderfoot
ExecStart=python3 /etc/spiderfoot/sf.py -l 127.0.0.1:5001

[Install]
WantedBy=default.target