domainaware / parsedmarc

A Python package and CLI for parsing aggregate and forensic DMARC reports
https://domainaware.github.io/parsedmarc/
Apache License 2.0
986 stars 214 forks source link

Systemd unit not running script - 8.x.x #312

Closed sableeyed closed 2 years ago

sableeyed commented 2 years ago

Hello, not sure if I have messed anything up permissions wise, but I used the documentation on https://domainaware.github.io/parsedmarc/ and from Linuxbabe.

When running the script as a systemd service, the status just returns INFO:cli.py:667:Starting parsedmarc and does nothing else after that.

Screen Shot 2022-04-27 at 9 21 26 AM

I was previously running the script with just sudo parsedmarc -c /etc/parsedmarc.ini. Since the systemd file is set to run as parsedmarc:parsedmarc, I tried a sudo -u parsedmarc /usr/local/bin/parsedmarc -c /etc/parsedmarc.ini and this did indeed return permission errors.

I have since fixed the permission errors, so running the script manually as the parsedmarc user works, but the systemd unit does nothing.

Here's the systemd file and the file permissions.

Screen Shot 2022-04-27 at 9 23 42 AM Screen Shot 2022-04-27 at 9 24 27 AM

And journalctl returns no errors for recent executions.

Screen Shot 2022-04-27 at 9 26 09 AM

And after stopping the service and running the script manually as parsedmarc, providing full file paths, everything works

Screen Shot 2022-04-27 at 9 31 03 AM

Here is the config file with sensitive info edited out.

[general]
save_aggregate = True
save_forensic = False
debug = True

[mailbox]
watch = True
delete = False

[elasticsearch]
hosts = http://user:secret@localhost
ssl = False

[gmail_api]
credentials_file = /path/to/credentials.json
scopes = https://www.googleapis.com/auth/gmail.modify,https://www.googleapis.com/auth/gmail.labels
include_spam_trash = True
sableeyed commented 2 years ago

After a lot of testing, this is not an issue with parsedmarc itself. In fact if you run parsedmarc with --verbose --debug you will get a good idea of the issue. In this case permissions on .token more specifically, the folder it was contained in.