• Resolved Jim Reekes

    (@reekes)


    I have ver 5.3.7 of the plug in.

    I’m getting two security notice emails each day. They’re both sent at the same time and both have exactly the same content.

    This is also happening on a second site that I manage.

    I’ve reviewed every setting and option and cannot find a reason for getting notifications twice.

    Is this a bug? Is there away to prevent the duplicate email?

    https://www.ads-software.com/plugins/better-wp-security/

Viewing 10 replies - 1 through 10 (of 10 total)
  • @jim Reekes

    If this is about the Daily Security Digest email add the following line to your wp-config.php file:

    define(‘ITSEC_NOTIFY_USE_CRON’, true);

    dwinden

    Thread Starter Jim Reekes

    (@reekes)

    Thanks dwinden

    Did what you suggested, and I still get double email notices.

    Again, both are exactly the same message sent at the same time. Here’s the message (I just updated a plugin last night, explaining the file changes).

    Dear Site Admin,

    The following is a summary of security related activity on your site. For details please visit the security logs

    Lockouts: There have been no lockouts since the last email check.

    File changes detected: iThemes Security detected file changes on your system.

    This email was generated automatically by iThemes Security

    To change your email preferences please visit the plugin settings.

    @jim Reekes

    In that case we’ll need to add some debug info to the emails.

    To enable debug info add the following constant to the wp-config.php file like this:

    define('ITSEC_DEBUG', true );

    The debug info will be displayed at the bottom of the next emails.

    dwinden

    Thread Starter Jim Reekes

    (@reekes)

    After adding the ITSEC_DEBUG, I got the duplicate security emails the next day. But they did not have any debug info in them.

    I checked wp-config.php to see I had ITSEC_DEBUG and it was there, just no debug info in the emails.

    Then I noticed the permissions for wp-config.php were 640, and I was thinking it should be 444. So I changed it and waiting for the next day’s security notices.

    This morning I found just one security email, but still no debug info.

    I’ll update this tread if I find anything different in the next few days.

    @jim Reekes

    Ok, so both constants, ITSEC_NOTIFY_USE_CRON and ITSEC_DEBUG don’t seem to work …

    Any chance the defines are not at the proper position in the wp-config.php file ?

    Make sure they are positioned right after the WP_DEBUG defined line.

    dwinden

    Thread Starter Jim Reekes

    (@reekes)

    I added the two defines ITSEC_NOTIFY_USE_CRON and ITSEC_DEBUG at the end of wp-config.php, and that was below define(‘WP_DEBUG’, false);

    Basically, I have this at the end of wp-config.php:

    define(‘WP_DEBUG’, false);

    define(‘ITSEC_NOTIFY_USE_CRON’, true);
    define(‘ITSEC_DEBUG’, true);

    You didn’t mention if WP_DEBUG needs to also be true, but I suspect not. I found the code in iThemes Security that is checking for ITSEC_DEBUG but it’s not depending on WP_DEBUG.

    Besides, enabling WP_DEBUG creates a new problem. Looks like wp-settings.php is looking for a file advanced-cache.php which I don’t have. I don’t use any caching plugins (not anymore). I’m on CloudFlare, which triggers this warning. The warning causes problems for displaying the pages, so I commented out the line including this missing file from wp-settings.php.

    https://wpengine.com/support/debug-mode-warning/

    I’ll let it run tonight to see what security email notice I get.

    Thanks for baring with me!

    @jim Reekes

    Indeed WP_DEBUG does not need to be set to true.

    The ITSEC_ defines are actually not at the end of the wp-config.php file.
    It should look like this:

    ...
    define('WP_DEBUG', false);
    
    define('ITSEC_NOTIFY_USE_CRON', true);
    define('ITSEC_DEBUG', true);
    
    /* That's all, stop editing! Happy blogging. */
    
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    dwinden

    Thread Starter Jim Reekes

    (@reekes)

    Well the mysteries never end. Today I only got one email. So far so good. That’s progress right? I mean that was the goal.

    The one email had a line for debug info, which looks like a query to wp-cron.php

    Sadly, that only presents a blank page. I have no idea why the debug info isn’t working, but the good news is this time I didn’t get duplicate email.

    I’ll remove the debug flag and move on ??

    Thanks again for putting up with me!

    Thread Starter Jim Reekes

    (@reekes)

    The other mystery – the second site, which I never touched, also stopped sending duplicate email. That changed for no reason.

    This site is on a completely different environment (different host provider, server, install, PHP release, etc).

    I guess that good news too LOL

    @jim Reekes

    The one email had a line for debug info, which looks like a query to wp-cron.php

    Ok, so the ITSEC_DEBUG constant now seems to work.

    The debug line at the bottom of the email will only show you the URL that triggered that specific Daily Security Digest email. When 2 emails are send you will find that the debug info shows different URLs in the 2 emails. It basically tells you which HTTP request triggered each email. Removing the ITSEC_NOTIFY_USE_CRON constant (but keeping the ITSEC_DEBUG constant) in the wp-config.php file will demonstrate this.

    Anyway since you also set the ITSEC_NOTIFY_USE_CRON constant in the wp-config.php file the debug info confirms that sending of the Daily Security Digest email is now triggered by a WP Cron HTTP request (only).

    And that is exactly what you want because due to a bug the Daily Security Digest email is often (not always) triggered as a result of 2 different HTTP requests. This can also be observed in the web server logs.

    Since the issue seems to be resolved please mark this topic as ‘resolved’.

    dwinden

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Two (duplicate) emails each day’ is closed to new replies.