• Resolved lgirao

    (@lgirao)


    I updated AIOS to the latest version 5.2.1 and am experiencing a weird error. Accessing the site with the plugin activated I was getting “critical error” and access logs show an AIOS firewall error stating:

    AIOS firewall error: RecursiveDirectoryIterator::__construct: Failed to open directory: Permission denied

    Looking for insight into this error as I haven’t found much.

    We did change our domain recently. Does this have anything to do with it?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support damien7

    (@damien7)

    Hi Igirao,

    It looks like the directory where the firewall’s rules are located is being denied permission.

    Are you able to ensure that the following directory has permissions set to 755: plugins\all-in-one-wp-security-and-firewall\classes\firewall\rule\rules

    Thread Starter lgirao

    (@lgirao)

    I’ll have to check permissions but they haven’t changed and everything has been working.

    This was added to the top of the wp-config.php file without my knowledge. How does this get added? Can it be done via an update?:

    // Begin AIOWPSEC Firewall
    if (file_exists(‘/nas/content/live/mysite/aios-bootstrap.php’)) {
    include_once(‘/nas/content/live/mysite/aios-bootstrap.php’);
    }
    // End AIOWPSEC Firewall

    • This reply was modified 1 year, 8 months ago by lgirao.
    Plugin Support damien7

    (@damien7)

    Hi,

    That’s part of the firewall setup. Essentially, when the firewall is setup, it attempts to set itself up before WordPress loads to give greater protect. The code in wp-config is one of the places. Another place is in your .htaccess file or .user.ini file (depending on the server type).

    The .htaccess / .user.ini is the most important, if the code is in those files, you can remove the code from the wp-config if you don’t like it there.

    Alternatively, if you want to undo all the file changes that the firewall setup has made, you can go to WP Security > Firewall > Advanced settings and press the Downgrade firewall. button. You can set it back up in that same location if you wish too.

    Thread Starter lgirao

    (@lgirao)

    Ok, thank you for the information.

    I removed it from wp-config.php and everything is back to working as before.

    Plugin Support damien7

    (@damien7)

    Thank you for letting me know; I’m glad everything is back working as before.

    @damien7 Can I suggest using a relative path at the beginning of the wp-config.php lines since they should always be in the same folder? When managing staging and production environments, the direct paths can cause issues that are hard to diagnose here.

    <?php
    // Begin AIOWPSEC Firewall
    if (file_exists('./aios-bootstrap.php')) {
    	include_once('./aios-bootstrap.php');
    }
    // End AIOWPSEC Firewall
    Thread Starter lgirao

    (@lgirao)

    @upcodestudios this would be a great fix.

    I am experiencing this error again. The site is able to run, but for every action the error logs state:
    AIOS firewall error: RecursiveDirectoryIterator::__construct(/nas/content/live/mySite-dev/wp-content/plugins/all-in-one-wp-security-and-firewall/classes/firewall/rule/rules/): Failed to open directory: Permission denied, referer: https://mySite-prod.com/

    What is interesting is my prod environment is trying to open a folder in my dev environment. So my guess is a global variable was set up when the plugin was worked on in development to establish that path? And now in production, it cannot get to this folder.

    Any insight on what to do moving forward? Should I reset all the settings?

    Plugin Support damien7

    (@damien7)

    Hi Igirao,

    Thanks for bringing this to my attention. I suspect the firewall is using old paths from your dev environment.

    Can you try downgrading the firewall by going to WP Security > Firewall > Advanced settings?and press the?Downgrade firewall. button.

    Is the error resolved when the firewall is in the downgraded state?

    If so, will you try then clicking the Set up firewall button and see if the error is also now resolved in that state?

    If this fixes your issue, then I would suggest downgrading the firewall when you need to move environments. I’ll also investigate to see if we can handle these situations better.

    Thread Starter lgirao

    (@lgirao)

    Hi damien7,

    After letting this rest for a night, I came back this morning to no error messages. I had not reactivated the plugin in Prod yet, so after clicking through a few things in staging with no errors, I reactivated it in Prod. For safety measures, I did as you instructed and downgraded the firewall. I performed a WP migration from Prod to staging (database only) and am not seeing any errors.

    Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Firewall Error AIOS firewall error: RecursiveDirectoryIterator::__construct’ is closed to new replies.