dmarc-srg icon indicating copy to clipboard operation
dmarc-srg copied to clipboard

How IMAP reports are reading

Open nasirmgcc opened this issue 3 years ago • 12 comments

Hi, Can you tell me how the imap will take automatically reports from the " Mailbox " and post into database, i have to run some Cronjobs or what is the procedure to run " util/fetch_reports.php "

nasirmgcc avatar Aug 21 '22 07:08 nasirmgcc

Hi, If you want to get reports automatically, you have to use cron on your server. Currently, you can automatically take reports from your mailboxes or directories on the server. See comments in utils/fetch_reports.php for details.

Here is my cron rule:

0 */6 * * * www-data cd /usr/local/share/dmarc-srg/www && php utils/fetch_reports.php > /dev/null

It gets reports from the all configured sources 4 times a day (every 6 hour).

liuch avatar Aug 21 '22 11:08 liuch

Thank you for reply

This will work on the Shared Server like JustHost ? with Cron job?

nasirmgcc avatar Aug 21 '22 11:08 nasirmgcc

Why not? I don't use JustHost, but it definitely works on the cheapest droplet of DigitalOcean. The main thing is that there must be access to cron and php. The hoster may also block some mail ports to avoid using the service by spammers, but this is usually solved by emailing the support, and these are unlikely to be imap ports.

liuch avatar Aug 21 '22 11:08 liuch

From #31. To know what you're failing, I need to know what exactly you're trying to do. How did you add a job for cron. What exact command did you execute? What files did you edit for this? And of course, in my example, the command is specified with paths that you may not have. Consider this.

liuch avatar Oct 02 '22 19:10 liuch

@liuch i used as

www-data cd /home4/nasirryk/public_html/dmarc.xpertsgroup.net && /usr/local/bin/php utils/fetch_reports.php > /dev/null

nasirmgcc avatar Oct 03 '22 04:10 nasirmgcc

  1. Does this command work in console: cd /home4/nasirryk/public_html/dmarc.xpertsgroup.net && /usr/local/bin/php utils/fetch_reports.php
  2. Do you have a user www-data on your server?
  3. Does the command above work under user www-data?
  4. How exactly did you add that command in the cron list?

My first example is not a command but a line in one of the OS config files.

liuch avatar Oct 05 '22 19:10 liuch

my username is " nasirryk "

nasirmgcc avatar Oct 06 '22 04:10 nasirmgcc

In the cron job, you need to specify a user under which you are going to run the script. This is usually the system user under which your web server is running, it is usually www-data. I highly recommend that you figure out how to run commands on your OS on a schedule. In the previous post, I indicated which command to execute in order to get incoming reports. I personally use cron. How you set it up is up to you.

liuch avatar Oct 07 '22 15:10 liuch

is it possible to run the CRON job without " user " to run commands, can we create the URL to execute will be more easy to manage.

nasirmgcc avatar Mar 02 '23 04:03 nasirmgcc

is it possible to run the CRON job without " user " to run commands,

No …

can we create the URL to execute will be more easy to manage.

then action is done as www-data user … (and about an url to call : need some security check)

Shnoulle avatar Mar 02 '23 08:03 Shnoulle

You can use the nobody user in your /etc/crontab and run your own script there, but... why? Running commands from a URL can cause security issues. If you started looking for ways to bypass the OS security mechanisms, most likely you are doing something wrong.

liuch avatar Mar 03 '23 20:03 liuch

I am looking to execute CRONJob by access simple page like : https://dmarc.mysite.com/import-mails.cronjob.php because on shared server difficult to run commands

nasirmgcc avatar Mar 05 '23 05:03 nasirmgcc