A php parser, viewer and summary report generator for incoming DMARC reports.
Ensure that all the files are in their own sub-folder.
Login as mysql root user to the MariaDB/MySQL server using the shell, run:
# mysql -u root -p
and type the password.
Once you have a MariaDB or MySQL prompt, create a new database, where dmarc
is a new database name (you can specify a different database name):
CREATE database dmarc;
Create a new user called dmarc_user
for the new database (you can specify a different user name):
GRANT all on dmarc.* to dmarc_user@localhost identified by 'new_user_password';
Remember to replace new_user_password
with a more secure one!
Note: If there is a need to use an existing database with other tables, you can specify the table prefix in the conf/conf.php
file.
Copy conf/conf.sample.php
to conf/conf.php
and configure it. Learn more by reading the comments in it.
There are two ways to do that: by using the web interface or by running the follow command:
php utils/database_admin.php init
In general, DmarcSrg is designed to automatically receive incoming DMARC reports, process them and send summary reports to the specified e-mail address, so a web interface as well as a web-server is optional. Most of the work is done by periodically running php scripts, which are located in the utils directory.
utils/check_config.php
- checks your configuration.utils/domains_admin.php
- allows to manipulate the list of domains in the database.utils/database_admin.php
- performs some administration functions with the database.utils/fetch_reports.php
- fetches DMARC reports from mailboxes and server local directories and saves them to the database.utils/mailbox_cleaner.php
- deletes old DMARC report email messages in mailboxes.utils/reportlog_cleaner.php
- deletes old log entries.utils/reports_cleaner.php
- deletes old reports from the database.utils/summary_report.php
- creates a summary report and sends it by email.utils/users_admin.php
- allows to manipulate the list of users in the database.You can find more detailed information about each script in the comments to it.
Note: Despite the fact that these scripts can only be run from the console, it is recommended to close access to the utils directory from the web server.
For example, if you want to get a summary report for the last week, you should run a command like this:
php /usr/local/share/dmarc-srg/utils/summary_report.php domain=example.com period=lastweek
If you receive an error message suggesting register_argc_argv is disabled, you can enable it like this:
php /usr/local/share/dmarc-srg/utils/summary_report.php domain=example.com period=lastweek
Use the public/ directory to access the web interface. You will see the basic Report List view, allowing you to navigate through the reports that have been parsed. Using the menu go to the Admin section and create tables in the database and check the accessibility of the mailboxes if necessary.
If Content Security Policy (CSP) is used on your web server, it is enough to add the following permissions:
That is, this rather strict policy will work well with the current web interface:
Content-Security-Policy: default-src 'none'; style-src 'self'; img-src 'self'; script-src 'self'; connect-src 'self'; media-src 'self'; form-action 'self'; base-uri 'none'; frame-ancestors 'none'
An IMAP connection is sequentially established to each mailbox, and the following actions are performed:
failed
folder of the current mailbox. If the folder does not exist, it will be created.Note: The total number of processed messages depends on the limit specified in the configuration file. The limitation is valid for each mail box separately.
Each directory specified in the configuration file is scanned for presence of files in it (not recursively). Each file in each directory is processed as follows:
failed
subdirectory of the directory in which the file is currently located. If the subdirectory does not exist, it will be created.Note: The total number of processed report files depends on the limit specified in the configuration file. The limitation is valid for each directory separately.
Uploading report files via the web interface is pretty standard. The upload result can be seen in a popup message and in the internal log. The number of simultaneously uploaded files and their size are limited only by the settings of your server (See upload_max_filesize
and post_max_size
in your php.ini
file).