liuch / dmarc-srg

A php parser, viewer and summary report generator for incoming DMARC reports.
GNU General Public License v3.0
218 stars 32 forks source link

How can I clear all reports currently fetched? #64

Closed greinick closed 1 year ago

greinick commented 1 year ago

Hi, Thanks for the nice work on such a useful interface!

I managed to import some reports from mail and now I'm looking for a command (syntax) for cleaning up the current state.

But I can't find the right command or syntax.

Thanks for some suggestions and feedback.

/G

liuch commented 1 year ago

Hi, Thanks for the kind words. If you want to remove all data from the database, you can run the following two commands one after the other: php utils/database_admin.php drop and php utils/database_admin.php init. This can also be done via the web interface.

Perhaps I misunderstood you, so please clarify your question.

greinick commented 1 year ago

Hi, you got me right. So I dropped and reinitialised the database, the webinterface shows no reports.

I checked the admin panel and the Database is there, the imap account is accessible. 19 Messages.

But now when I try to import the messages into the database:

_php utils/summaryreport.php domain=mydomain.com period=lastndays:2 or period=lastweek I get an error from the console:

Error: Domain "mydomain.com" does not exist.

This did not happen with the first run ....

Any hints?

liuch commented 1 year ago

Hm, summary_report is for generating summary reports not for importing incoming reports. Use utils/fetch_reports.php for that.

About the error: Clearing the database removes all data, including the list of allowed domains, that is stored in the "domains" table of your database. The first domain is added automatically when you process the first incoming report (via fetch_reports.php), so if you haven't processed any incoming reports there is no records in the "domains" table and the tool throw this error. You can add your domain via web interface.

greinick commented 1 year ago

hm :-/ I do have sort of strange behaviour....

I dropped the Database, checked that the entries (domain & report) are empty.

The imap inbox contains 28 e-mails, I initialised the db and _run php utils/fetchreports.php

Now in the webinterface I see 83 emails processed .... What is that number?

liuch commented 1 year ago

Most likely this is the result of processing reports from several sources. It is possible if you have configured fetching reports from multiple mailboxes or from the server directories. You can specify the source type by passing it as a parameter of the script (see comments in fetch_reports.php) script and you can see from which source type each report was fetched in the logs (web interface).

liuch commented 1 year ago

The imap inbox contains 28 e-mails, I initialised the db and run php utils/fetch_reports.php Now in the webinterface I see 83 emails processed .... What is that number?

Did you mean the number in the block at the top right? That is the number of emails mentioned in the reports you have gotten from your mail box.

May I close the issue?

greinick commented 1 year ago

Oh, I forgot to give feedback. Yes everything is clear now, the issue could be closed. Thanks for your help!