Sucuri / sucuri-wordpress-plugin

WordPress Plugin - Auditing, Malware Scanner and Security Hardening
GNU General Public License v2.0
49 stars 30 forks source link

HTML output on CLI #23

Closed szepeviktor closed 5 years ago

szepeviktor commented 8 years ago

Hello!

I run WP-cron by PHP-CLI.

Usually this (notification-admin.html.tpl) is the output

<div id="sucuriscan-alert-282" class="error sucuriscan-alert sucuriscan-alert-error">
    <a href="javascript:void(0)" class="close" onclick="sucuriscan_alert_close('282')">&times;</a>
    <p><b>Sucuri:</b> The file hashes could not be stored.</p>
</div>

I think SucuriScanAPI::sendHashes($signatures) fails thus I have an API connection problem. Are there retries for API communication?

Please advise. How can it be debugged/logged?

szepeviktor commented 8 years ago

It happens on independent servers.

remcotolsma commented 7 years ago

I'm having the same issue with WordPress cron on SiteGround hosting, this issue is also mentioned in:

https://github.com/Sucuri/sucuri-wordpress-plugin/blob/master/sucuri.php#L3725-L3736 https://github.com/Sucuri/sucuri-wordpress-plugin/blob/master/sucuri.php#L6182-L6205

dcid commented 7 years ago

That happens when your server can't reach wordpress.sucuri.net. Can you test if it is accessible from your end?

szepeviktor commented 7 years ago

@dcid Thank you.

Please advise on what to monitor? ping? HTTP/GET or POST?

szepeviktor commented 7 years ago

E.g. https://wordpress.sucuri.net/api/ which should return

{"status":0,"action":false,"messages":["Action not set"],"request_time":1479417376,"verbose":0,"output":{}}
szepeviktor commented 7 years ago

A nice cron job to check the API

#!/bin/bash
#
# Check Sucuri WordPress API
#

wget -q -O- --post-data="e=invalid@example.com&s=localhost&a=register_site" "https://wordpress.sucuri.net/api/" \
    | grep -q -x '{"status":0,"action":"register_site","messages":\["Invalid email\. Not accepted\."\],"request_time":[0-9]\+,"verbose":0,"output":{}}' \
    || echo "Communication to Sucuri WordPress API failed" 1>&2
szepeviktor commented 7 years ago

@dcid Please consider trying out UpCloud See https://github.com/szepeviktor/wordpress-speedtest

szepeviktor commented 7 years ago

Although the above cron job runs OK every hour, My custom reporting fails https://github.com/szepeviktor/wordpress-fail2ban/blob/master/mu-plugin/wp-fail2ban-mu-instant.php#L196-L201

<div id="sucuriscan-alert-951" class="error sucuriscan-alert sucuriscan-alert-error">
    <a href="javascript:void(0)" class="close" onclick="sucuriscan_alert_close('951')">&times;</a>
    <p><b>Sucuri:</b> The file hashes could not be stored.</p>
</div>
ntorga-godaddy commented 5 years ago

@szepeviktor Could you please confirm the issue still happens with the last version of the plugin?

szepeviktor commented 5 years ago

@ntorgagd I am sorry, I do not use your plugin.

ntorga-godaddy commented 5 years ago

@szepeviktor Thanks for getting back to me.

I was not successful in reproducing this issue using multiple versions of PHP on CLI mode and I am also unable to find similar recent cases on WordPress support tickets, therefore this issue will be closed for now.

Please, feel free to report any issues you may encounter with the plugin or suggest improvements.