Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How IMAP reports are reading #25

Open
nasirmgcc opened this issue Aug 21, 2022 · 12 comments
Open

How IMAP reports are reading #25

nasirmgcc opened this issue Aug 21, 2022 · 12 comments

Comments

@nasirmgcc
Copy link

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 "

@liuch
Copy link
Owner

liuch commented Aug 21, 2022

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).

@nasirmgcc
Copy link
Author

Thank you for reply

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

@liuch
Copy link
Owner

liuch commented Aug 21, 2022

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
Copy link
Owner

liuch commented Oct 2, 2022

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.

@nasirmgcc
Copy link
Author

@liuch i used as

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

@liuch
Copy link
Owner

liuch commented Oct 5, 2022

  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.

@nasirmgcc
Copy link
Author

my username is " nasirryk "

@liuch
Copy link
Owner

liuch commented Oct 7, 2022

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.

@nasirmgcc
Copy link
Author

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.

@Shnoulle
Copy link

Shnoulle commented Mar 2, 2023

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)

@liuch
Copy link
Owner

liuch commented Mar 3, 2023

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.

@nasirmgcc
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants