• Resolved Tani

    (@tanitan)


    I am running the free version of Wordfence on a few websites but the scans are not running every 72 hours as stated in the documentation. I can run scans manually and I have tried ticking ‘Start all scans remotely’.

    I have also been through this support document: https://docs.wordfence.com/en/My_scans_aren%27t_starting._What_would_cause_that%3F
    Going to http://www.example.com/wp-admin/admin-ajax.php returned 0, I have not password protected wp-admin and the servers are not blocked as far as I can tell.

    Under Tools > Diagnostics, Connecting back to this site, all the sites give the following error:
    wp_remote_post() test back to this server failed! Response was: cURL error 7: Failed to connect to (domain here) port 80: No route to host<br />

    Is something on the host server stopping the scans from starting automatically?

    • This topic was modified 8 years, 7 months ago by Tani.
Viewing 13 replies - 1 through 13 (of 13 total)
  • The way WordPress works by default, is that it’s internal “scheduling” process, called “WP-Cron” gets called during normal user visits. It will wake up when a user visit a page, and suddenly start doing various maintenance things, while that user waits to see their page. 🙂
    That works OK for things that complete in split seconds, but you sure would not want a user to get caught by suddenly running a long “WordFence Scan”, while they wait to see your page.

    To prevent that from happening, WordFence does not merely use Wp-Cron, but starts it’s various tasks by instead “calling back” to the server to create it’s own “visit”, where things like the file-scan can happen in peace and quiet, leaving your normal users to go about their own business.

    THAT then means that your site has to be able to call itself to accomplish various tasks. If it tries to “call home”, but the call cannot go through, tasks start failing.

    Your diagnostics output state directly, that this cannot happen because of an issue with your hosting setup.

    “Failed to connect to (domain here) port 80: No route to host“.

    Your site’s server cannot figure out how to find itself. It cannot translate your domain-name into a “route” (path through the networks) back to it’s own IP address. It is usually caused by a local configuration issue, which I have seen on some server/hosting setups.

    It for example can happen, if your server is behind a NAT (Network Address Translation) where it has a different IP-address internally from what it is known as on the global Internet).
    That can make it seem alive to the external world, so you get visitors from outside, but when you try to use the external IP address (what your domain-name translates to) to call the server from itself, it fails because the server does not know that this IP address is actually itself. It essentially knows only it’s internal address.

    There are various configuration changes that can fix that, including fixing routing, adding IP to interface directly, adding your host-domain-name to the local /etc/hosts file – but pointing to the loopback interface instead, …, …
    BUT, unless you have root access to your server all those methods are unavailable to you directly. If you are on a shared hosting setup, you can NEVER have root access. Your hosting company would have to fix their setup.

    On a VPS or Dedicated server, where you are in 100% control and have root-access, the simplest methods is usually to just add a line to the /etc/hosts file, pointing your domain/server name to loopback (127.0.0.1), since that affects only the local server. It usually fixes it, assuming that your web-server is listening on Loopback.

    Starting scans remotely should theoretically work around this by making the WordFence server(s) call your site instead. It is a workaround for the call-back problem, but for scans only. If that does not happen, I guess that is another problem.

    Hi @tanitan,

    Indeed, it appears the server hosting your site is unable to connect to itself in order to start the scan.

    According to the error message you’re getting, the problem seems to be caused by a network route configuration issue.
    Therefore, I suggest you get in touch with your hosting provider so they can look into the server’s configuration and adjust the routing parameters.

    Alternatively, you could try enabling the option at the bottom of the Diagnostics tab on the Wordfence Tools page titled Start all scans remotely

    Thread Starter Tani

    (@tanitan)

    Hi @wfyann,

    I already tried ticking “Start all scans remotely“ a few days ago but it didn’t help.

    Thread Starter Tani

    (@tanitan)

    Hi @crudhunter,

    Many thanks for the detailed response.

    I doubt I would have root access to the server so I’ll get in touch with the host provider tomorrow. Should ticking “Start all scans remotely“ get around the issue I’m having in theory? Obviously this option is not working for me but I was just wondering if it’s meant to.

    Yes, the start scans remotely should theoretically work around that problem, because the “call” then comes from WordFence’s server out on the internet, not from your server locally.
    Since users (and yourself) can find the site through the domain name, so should the WordFence servers. You should then be able to see the calls from the WordFence domain into your server in your site access-logs (they will not show in WordFence’s Live Traffic).

    Can’t say why the remote calls are not starting. Thats another issue, that will have to be debugged from the WordFence side. Especially, if your Diagnostics page is not complaining that it cannot call WordFence servers.

    All that said, WordFence uses “call backs” to do other things besides Scans, so if call-back for scans are failing (No Route to Host), SO ARE THESE OTHER THINGS. And since they are internal tasks, not obvious like a Scan, you don’t see these failures easily.

    So even if the “Start scans remotely” was working to get Scans started, you should still get the call-back thing fixed. As in, get your Diagnostics page to show clean, with everything green.

    Thread Starter Tani

    (@tanitan)

    Thanks again @crudhunter.

    I have asked the hosting company to add the domain to the hosts file so the site can contact itself. They just confirmed the change has been made but the Diagnostics page is still showing the error. Perhaps the change to the server file needs some time to take affect so I’ll check Wordfence again later.

    No, there should be no delay.

    Does your hosting account allow SSH access to the command-line on the server? You usually have this access, since you do not need root-level access.

    If so, then you can log in and confirm what is happening.

    Issue command

    telnet yourdomain 80

    Telnet is an old-style terminal connection, not normally run on port 80 (http).
    But on port 80, it simply creates a connection to the web-server after translating the domain to an IP address (if it can). The same name to IP-address translation WordFence would have to do, through WordPress.

    You should see something like

    Trying {your ip address}...
    Connected to yourdomain..
    Escape character is '^]'.

    If it manages to connect and does not time-out or fail, you can in fact now “talk” to your web-server, just like a browser or WordFence would.

    For example, if you type command

    GET /

    you are doing what a browser would do, calling for your home-page (except you are missing a lot of headers and cookies).. But your web-server should now spew out a goop of HTML code. Either with your actual home-page, or with complaints about bad access, redirect to https, or other things.

    Either way, if you can connect you should be OK. If you can “talk” to it, even better as a test. (It does not matter what response it gives you to “GET /”.

    Notice, that if they entered your host-name into the /etc/hosts file with your public IP address, that might not work, since that was your problem to begin with. That the server does not know it’s public address (which is what DNS returns already).
    You will see the translated IP address when you do the ‘telnet’ command, or you can simply say ‘cat /etc/hosts’ and check it’s contents.

    If your server is behind NAT, they will have to enter the host/domain name in /etc/hosts with it’s internal IP address, or maybe even with the loopback (127.0.0.1) address to force the server to know, that when someone calls your domainname from inside the server itself, it should NOT try to connect via the public address (the Internet), but just call itself.

    BUT.. Your hosting support folks should have confirmed all this before even reporting back to you.. They know the problem, and should test the solution before telling you it is fixed. Otherwise, they must have assigned you to the latest support trainee. 🙂

    If they cannot successfully do the telnet type test sitting on the server’s command line, then WordPress/WordFence will not be able to either.

    Thread Starter Tani

    (@tanitan)

    It’s a managed server so I don’t have SSH access but I’ve asked the host provider to check for me as per your instructions.

    Let us know, when they figure it out. 🙂

    It all depends on how they set up the server.
    For example, it also depends on priority of name resolution. If it ALWAYS checks DNS first, and /etc/hosts next, hen obviously /etc/hosts cannot be used to override the DNS result, like we are doing here. It would find your public address first, and look no further. But that is not too normal a setup.

    In either case, they should know how to make their server call itself. 🙂

    Thread Starter Tani

    (@tanitan)

    The hosting company got back to me earlier today to say they had fixed the issue and when I checked the sites, the Diagnostics page showed all green across the board. This afternoon all the sites I have Wordfence installed on automatically ran a quick scan so all is well now!

    Thanks very much for your help Caleb and clear explanations!

    Good to hear it is now working as expected. 🙂

    Life without the ability to “Call Home” sometimes.. Much less fun. 🙂

    Hi @tanitan,

    Thanks for letting us know!

    I’m glad your hosting provider managed to fix this issue.

    Just to wrap up regarding the “Start all scans remotely“ feature not working, it was most likely due to the host not being able to reach Wordfence servers.

    ********************************

    @crudhunter,

    Thanks for helping out!

    • This reply was modified 8 years, 7 months ago by wfyann. Reason: Additional info
    Thread Starter Tani

    (@tanitan)

    Hi @wfyann,

    Yes that seems to be the case. Thanks for the information and for the great plugin!

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Scans not starting automatically’ is closed to new replies.