• Resolved LeinardoSmith

    (@leinardosmith)


    When attempting to connect to Wordfence Central I get the following error:

    
    HTTP 500 received from Wordfence Central: {"errors":[{"status":500,"title":"The server encountered an error processing your request.","detail":null}]}
    

    This happens on the “Passing public key to Wordfence Central” step.

    After a bit more diagnosing, I found the part of the plugin where the error happens:
    In the file: /wp-content/plugins/wordfence/lib/wordfenceClass.php
    This request: $request = new wfCentralAPIRequest('/site/' . wfConfig::get('wordfenceCentralSiteID')...

    Returns the following:

    
    [09-Nov-2021 21:51:37 UTC] array (
      'headers' => 
      Requests_Utility_CaseInsensitiveDictionary::__set_state(array(
         'data' => 
        array (
          'content-type' => 'application/json',
          'date' => 'Tue, 09 Nov 2021 21:51:37 GMT',
          'server' => 'nginx',
          'cache-control' => 'no-cache, private',
          'set-cookie' => 'wordfence_central_api_session=aaaaa; expires=Tue, 09-Nov-2021 23:51:37 GMT; Max-Age=7200; path=/; httponly',
          'strict-transport-security' => 'max-age=31536000; includeSubDomains',
          'x-cache' => 'Error from cloudfront',
          'via' => '1.1 8d0bf2975485a7f0e4b8d82ddd378293.cloudfront.net (CloudFront)',
          'x-amz-cf-pop' => 'IAD50-C2',
          'x-amz-cf-id' => 'aaaaa==',
        ),
      )),
      'body' => '{"errors":[{"status":500,"title":"The server encountered an error processing your request.","detail":null}]}',
      'response' => 
      array (
        'code' => 500,
        'message' => 'Internal Server Error',
      ),
      'cookies' => 
      array (
        0 => 
        WP_Http_Cookie::__set_state(array(
           'name' => 'wordfence_central_api_session',
           'value' => 'aaaaa',
           'expires' => 1636501897,
           'path' => '/',
           'domain' => 'www.wordfence.com',
           'host_only' => true,
        )),
      ),
      'filename' => NULL,
      'http_response' => 
      WP_HTTP_Requests_Response::__set_state(array(
         'response' => 
        Requests_Response::__set_state(array(
           'body' => '{"errors":[{"status":500,"title":"The server encountered an error processing your request.","detail":null}]}',
           'raw' => 'HTTP/1.1 500 Internal Server Error
    Content-Type: application/json
    Transfer-Encoding: chunked
    Connection: close
    Date: Tue, 09 Nov 2021 21:51:37 GMT
    Server: nginx
    Cache-Control: no-cache, private
    Set-Cookie: wordfence_central_api_session=aaaaa; expires=Tue, 09-Nov-2021 23:51:37 GMT; Max-Age=7200; path=/; httponly
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Cache: Error from cloudfront
    Via: 1.1 8d0bf2975485a7f0e4b8d82ddd378293.cloudfront.net (CloudFront)
    X-Amz-Cf-Pop: IAD50-C2
    X-Amz-Cf-Id: aaaaa==
    
    {"errors":[{"status":500,"title":"The server encountered an error processing your request.","detail":null}]}',
           'headers' => 
          Requests_Response_Headers::__set_state(array(
             'data' => 
            array (
              'content-type' => 
              array (
                0 => 'application/json',
              ),
              'date' => 
              array (
                0 => 'Tue, 09 Nov 2021 21:51:37 GMT',
              ),
              'server' => 
              array (
                0 => 'nginx',
              ),
              'cache-control' => 
              array (
                0 => 'no-cache, private',
              ),
              'set-cookie' => 
              array (
                0 => 'wordfence_central_api_session=aaaaa; expires=Tue, 09-Nov-2021 23:51:37 GMT; Max-Age=7200; path=/; httponly',
              ),
              'strict-transport-security' => 
              array (
                0 => 'max-age=31536000; includeSubDomains',
              ),
              'x-cache' => 
              array (
                0 => 'Error from cloudfront',
              ),
              'via' => 
              array (
                0 => '1.1 8d0bf2975485a7f0e4b8d82ddd378293.cloudfront.net (CloudFront)',
              ),
              'x-amz-cf-pop' => 
              array (
                0 => 'IAD50-C2',
              ),
              'x-amz-cf-id' => 
              array (
                0 => 'aaaaa==',
              ),
            ),
          )),
           'status_code' => 500,
           'protocol_version' => 1.1,
           'success' => false,
           'redirects' => 0,
           'url' => 'https://www.wordfence.com/api/wf/site/aaaaa',
           'history' => 
          array (
          ),
           'cookies' => 
          Requests_Cookie_Jar::__set_state(array(
             'cookies' => 
            array (
              'wordfence_central_api_session' => 
              Requests_Cookie::__set_state(array(
                 'name' => 'wordfence_central_api_session',
                 'value' => 'aaaaa',
                 'attributes' => 
                Requests_Utility_CaseInsensitiveDictionary::__set_state(array(
                   'data' => 
                  array (
                    'expires' => 1636501897,
                    'max-age' => 1636501897,
                    'path' => '/',
                    'httponly' => true,
                    'domain' => 'www.wordfence.com',
                  ),
                )),
                 'flags' => 
                array (
                  'creation' => 1636494697,
                  'last-access' => 1636494697,
                  'persistent' => false,
                  'host-only' => true,
                ),
                 'reference_time' => 1636494697,
              )),
            ),
          )),
        )),
         'filename' => NULL,
         'data' => NULL,
         'headers' => NULL,
         'status' => NULL,
      )),
    )
    

    Please let me know if you need any more information to diagnose.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    If your site is listed under the Connection Issues tab then use the trash icon to remove it.

    In the plugin, expand the Other Tests section on the Wordfence Tools >> Diagnostics page and press the button to clear all Wordfence Central connection data. You will need to have at least Wordfence version 7.4.11 installed to see this option.

    Now try to connect to Wordfence Central from the Wordfence Central Status widget on the Wordfence plugin Dashboard page.

    Let me know if that fixes it.

    Thread Starter LeinardoSmith

    (@leinardosmith)

    @wfphil I have done this already. The issue persists.

    Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    Thank you for the update.

    I would like to have a look at your Wordfence diagnostics report. Please go to the top of the “Diagnostics” tab on the Wordfence “Tools” page. There will be a “SEND REPORT BY EMAIL” button to send the diagnostics report. Enter wftest [at] wordfence [dot] com as the email and leinardosmith as the forum username please.

    Once you have emailed me the diagnostics report can you reply here to let me know that it has been sent. This is important in the unlikely event that your installation of WordPress is having an issue with sending mail.

    @wfphil I have submitted the diagnostics.

    Thread Starter LeinardoSmith

    (@leinardosmith)

    Sorry for the confusion, I have multiple accounts. The infodweaver above is my company account.

    Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    Thank you for the report.

    It appears that you may have uninstalled Wordfence as the readme.txt file for the plugin is not found when I try to load the URL for it.

    Is that correct that you have uninstalled Wordfence?

    Thread Starter LeinardoSmith

    (@leinardosmith)

    @wfphil No I have not uninstalled Wordfence.

    Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    Thank you for the update.

    My apologies, I think I may have been looking at the wrong report. I am going to check something with the team.

    Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    Thank you for the update.

    Can you try to add the same site to Wordfence Central again for the diagnostics report that you sent and let me know when this has been done and we can check something here.

    Thread Starter LeinardoSmith

    (@leinardosmith)

    @wfphil Apologies for the delay, I have attempted to re-add the same site to Wordfence Central. Same error occurred:

    HTTP 500 received from Wordfence Central: {"errors":[{"status":500,"title":"The server encountered an error processing your request.","detail":null}]}

    Let me know if you need anything else to diagnose this issue.

    Plugin Support wfpeter

    (@wfpeter)

    Hi @leinardosmith, Phil is unavailable at the moment so I’m going to try to continue helping with this.

    One of our Central team have found that the 500 error is originating from your site not sending a JSON blob which should contain the public key. We don’t have the full request, just the exception thrown at our server. It could either be an empty request body, or malformed JSON.

    This test script has been created to upload to your site to debug what the request body looks like: https://gist.github.com/barmat/cba9ec7a8215da37538de806499a404d

    It’ll output the request body along with some other debugging data. Please let us know exactly what the output of that is so we can try troubleshooting the request data for you.

    Thanks,

    Peter.

    Thread Starter LeinardoSmith

    (@leinardosmith)

    Hello @wfpeter

    I have uploaded the test script and the output is as follows:

    wfCentralAPIResponse Object
    (
        [response:wfCentralAPIResponse:private] => Array
            (
                [headers] => Requests_Utility_CaseInsensitiveDictionary Object
                    (
                        [data:protected] => Array
                            (
                                [server] => nginx/1.14.0 (Ubuntu)
                                [date] => Thu, 02 Dec 2021 17:40:21 GMT
                                [content-type] => text/html; charset=UTF-8
                                [content-length] => 817
                                [vary] => Accept-Encoding
                                [content-encoding] => gzip
                            )
    
                    )
    
                [body] => array(35) {
      ["HTTPS"]=>
      string(2) "on"
      ["HTTP_HOST"]=>
      string(24) "training.amerex-fire.com"
      ["HTTP_X_REAL_IP"]=>
      string(11) "45.33.98.17"
      ["HTTP_X_FORWARDED_FOR"]=>
      string(11) "45.33.98.17"
      ["HTTP_X_FORWARDED_PROTO"]=>
      string(5) "https"
      ["HTTP_CONNECTION"]=>
      string(5) "close"
      ["CONTENT_LENGTH"]=>
      string(2) "56"
      ["HTTP_USER_AGENT"]=>
      string(49) "WordPress/5.5.3; https://training.amerex-fire.com"
      ["HTTP_ACCEPT"]=>
      string(3) "*/*"
      ["HTTP_ACCEPT_ENCODING"]=>
      string(13) "deflate, gzip"
      ["HTTP_REFERER"]=>
      string(86) "https://training.amerex-fire.com/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["CONTENT_TYPE"]=>
      string(16) "application/json"
      ["PATH"]=>
      string(70) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
      ["SERVER_SIGNATURE"]=>
      string(86) "
    Apache/2.4.29 (Ubuntu) Server at training.amerex-fire.com Port 443
    
    "
      ["SERVER_SOFTWARE"]=>
      string(22) "Apache/2.4.29 (Ubuntu)"
      ["SERVER_NAME"]=>
      string(24) "training.amerex-fire.com"
      ["SERVER_ADDR"]=>
      string(3) "::1"
      ["SERVER_PORT"]=>
      string(3) "443"
      ["REMOTE_ADDR"]=>
      string(3) "::1"
      ["DOCUMENT_ROOT"]=>
      string(46) "/var/www/training.amerex-fire.com/public_html/"
      ["REQUEST_SCHEME"]=>
      string(5) "https"
      ["CONTEXT_PREFIX"]=>
      string(0) ""
      ["CONTEXT_DOCUMENT_ROOT"]=>
      string(46) "/var/www/training.amerex-fire.com/public_html/"
      ["SERVER_ADMIN"]=>
      string(18) "[no address given]"
      ["SCRIPT_FILENAME"]=>
      string(56) "/var/www/training.amerex-fire.com/public_html/wftest.php"
      ["REMOTE_PORT"]=>
      string(5) "51744"
      ["GATEWAY_INTERFACE"]=>
      string(7) "CGI/1.1"
      ["SERVER_PROTOCOL"]=>
      string(8) "HTTP/1.0"
      ["REQUEST_METHOD"]=>
      string(4) "POST"
      ["QUERY_STRING"]=>
      string(42) "/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["REQUEST_URI"]=>
      string(54) "/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["SCRIPT_NAME"]=>
      string(11) "/wftest.php"
      ["PHP_SELF"]=>
      string(11) "/wftest.php"
      ["REQUEST_TIME_FLOAT"]=>
      float(1638466821.067)
      ["REQUEST_TIME"]=>
      int(1638466821)
    }
    c2lnbmF0dXJlPU5HRXlaR1JtTVRRNFl6VmhPV00wTWpFMU1XRTFNamxsT0dOaVpHTmpNRFklM0Q=
                [response] => Array
                    (
                        [code] => 200
                        [message] => OK
                    )
    
                [cookies] => Array
                    (
                    )
    
                [filename] => 
                [http_response] => WP_HTTP_Requests_Response Object
                    (
                        [response:protected] => Requests_Response Object
                            (
                                [body] => array(35) {
      ["HTTPS"]=>
      string(2) "on"
      ["HTTP_HOST"]=>
      string(24) "training.amerex-fire.com"
      ["HTTP_X_REAL_IP"]=>
      string(11) "45.33.98.17"
      ["HTTP_X_FORWARDED_FOR"]=>
      string(11) "45.33.98.17"
      ["HTTP_X_FORWARDED_PROTO"]=>
      string(5) "https"
      ["HTTP_CONNECTION"]=>
      string(5) "close"
      ["CONTENT_LENGTH"]=>
      string(2) "56"
      ["HTTP_USER_AGENT"]=>
      string(49) "WordPress/5.5.3; https://training.amerex-fire.com"
      ["HTTP_ACCEPT"]=>
      string(3) "*/*"
      ["HTTP_ACCEPT_ENCODING"]=>
      string(13) "deflate, gzip"
      ["HTTP_REFERER"]=>
      string(86) "https://training.amerex-fire.com/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["CONTENT_TYPE"]=>
      string(16) "application/json"
      ["PATH"]=>
      string(70) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
      ["SERVER_SIGNATURE"]=>
      string(86) "
    Apache/2.4.29 (Ubuntu) Server at training.amerex-fire.com Port 443
    
    "
      ["SERVER_SOFTWARE"]=>
      string(22) "Apache/2.4.29 (Ubuntu)"
      ["SERVER_NAME"]=>
      string(24) "training.amerex-fire.com"
      ["SERVER_ADDR"]=>
      string(3) "::1"
      ["SERVER_PORT"]=>
      string(3) "443"
      ["REMOTE_ADDR"]=>
      string(3) "::1"
      ["DOCUMENT_ROOT"]=>
      string(46) "/var/www/training.amerex-fire.com/public_html/"
      ["REQUEST_SCHEME"]=>
      string(5) "https"
      ["CONTEXT_PREFIX"]=>
      string(0) ""
      ["CONTEXT_DOCUMENT_ROOT"]=>
      string(46) "/var/www/training.amerex-fire.com/public_html/"
      ["SERVER_ADMIN"]=>
      string(18) "[no address given]"
      ["SCRIPT_FILENAME"]=>
      string(56) "/var/www/training.amerex-fire.com/public_html/wftest.php"
      ["REMOTE_PORT"]=>
      string(5) "51744"
      ["GATEWAY_INTERFACE"]=>
      string(7) "CGI/1.1"
      ["SERVER_PROTOCOL"]=>
      string(8) "HTTP/1.0"
      ["REQUEST_METHOD"]=>
      string(4) "POST"
      ["QUERY_STRING"]=>
      string(42) "/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["REQUEST_URI"]=>
      string(54) "/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["SCRIPT_NAME"]=>
      string(11) "/wftest.php"
      ["PHP_SELF"]=>
      string(11) "/wftest.php"
      ["REQUEST_TIME_FLOAT"]=>
      float(1638466821.067)
      ["REQUEST_TIME"]=>
      int(1638466821)
    }
    c2lnbmF0dXJlPU5HRXlaR1JtTVRRNFl6VmhPV00wTWpFMU1XRTFNamxsT0dOaVpHTmpNRFklM0Q=
                                [raw] => HTTP/1.1 200 OK
    Server: nginx/1.14.0 (Ubuntu)
    Date: Thu, 02 Dec 2021 17:40:21 GMT
    Content-Type: text/html; charset=UTF-8
    Content-Length: 817
    Connection: close
    Vary: Accept-Encoding
    Content-Encoding: gzip
    
    array(35) {
      ["HTTPS"]=>
      string(2) "on"
      ["HTTP_HOST"]=>
      string(24) "training.amerex-fire.com"
      ["HTTP_X_REAL_IP"]=>
      string(11) "45.33.98.17"
      ["HTTP_X_FORWARDED_FOR"]=>
      string(11) "45.33.98.17"
      ["HTTP_X_FORWARDED_PROTO"]=>
      string(5) "https"
      ["HTTP_CONNECTION"]=>
      string(5) "close"
      ["CONTENT_LENGTH"]=>
      string(2) "56"
      ["HTTP_USER_AGENT"]=>
      string(49) "WordPress/5.5.3; https://training.amerex-fire.com"
      ["HTTP_ACCEPT"]=>
      string(3) "*/*"
      ["HTTP_ACCEPT_ENCODING"]=>
      string(13) "deflate, gzip"
      ["HTTP_REFERER"]=>
      string(86) "https://training.amerex-fire.com/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["CONTENT_TYPE"]=>
      string(16) "application/json"
      ["PATH"]=>
      string(70) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
      ["SERVER_SIGNATURE"]=>
      string(86) "
    Apache/2.4.29 (Ubuntu) Server at training.amerex-fire.com Port 443
    
    "
      ["SERVER_SOFTWARE"]=>
      string(22) "Apache/2.4.29 (Ubuntu)"
      ["SERVER_NAME"]=>
      string(24) "training.amerex-fire.com"
      ["SERVER_ADDR"]=>
      string(3) "::1"
      ["SERVER_PORT"]=>
      string(3) "443"
      ["REMOTE_ADDR"]=>
      string(3) "::1"
      ["DOCUMENT_ROOT"]=>
      string(46) "/var/www/training.amerex-fire.com/public_html/"
      ["REQUEST_SCHEME"]=>
      string(5) "https"
      ["CONTEXT_PREFIX"]=>
      string(0) ""
      ["CONTEXT_DOCUMENT_ROOT"]=>
      string(46) "/var/www/training.amerex-fire.com/public_html/"
      ["SERVER_ADMIN"]=>
      string(18) "[no address given]"
      ["SCRIPT_FILENAME"]=>
      string(56) "/var/www/training.amerex-fire.com/public_html/wftest.php"
      ["REMOTE_PORT"]=>
      string(5) "51744"
      ["GATEWAY_INTERFACE"]=>
      string(7) "CGI/1.1"
      ["SERVER_PROTOCOL"]=>
      string(8) "HTTP/1.0"
      ["REQUEST_METHOD"]=>
      string(4) "POST"
      ["QUERY_STRING"]=>
      string(42) "/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["REQUEST_URI"]=>
      string(54) "/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af"
      ["SCRIPT_NAME"]=>
      string(11) "/wftest.php"
      ["PHP_SELF"]=>
      string(11) "/wftest.php"
      ["REQUEST_TIME_FLOAT"]=>
      float(1638466821.067)
      ["REQUEST_TIME"]=>
      int(1638466821)
    }
    c2lnbmF0dXJlPU5HRXlaR1JtTVRRNFl6VmhPV00wTWpFMU1XRTFNamxsT0dOaVpHTmpNRFklM0Q=
                                [headers] => Requests_Response_Headers Object
                                    (
                                        [data:protected] => Array
                                            (
                                                [server] => Array
                                                    (
                                                        [0] => nginx/1.14.0 (Ubuntu)
                                                    )
    
                                                [date] => Array
                                                    (
                                                        [0] => Thu, 02 Dec 2021 17:40:21 GMT
                                                    )
    
                                                [content-type] => Array
                                                    (
                                                        [0] => text/html; charset=UTF-8
                                                    )
    
                                                [content-length] => Array
                                                    (
                                                        [0] => 817
                                                    )
    
                                                [vary] => Array
                                                    (
                                                        [0] => Accept-Encoding
                                                    )
    
                                                [content-encoding] => Array
                                                    (
                                                        [0] => gzip
                                                    )
    
                                            )
    
                                    )
    
                                [status_code] => 200
                                [protocol_version] => 1.1
                                [success] => 1
                                [redirects] => 0
                                [url] => https://training.amerex-fire.com/wftest.php?/site/727fa7da-5521-47e5-a3db-4b89bbbf60af
                                [history] => Array
                                    (
                                    )
    
                                [cookies] => Requests_Cookie_Jar Object
                                    (
                                        [cookies:protected] => Array
                                            (
                                            )
    
                                    )
    
                            )
    
                        [filename:protected] => 
                        [data] => 
                        [headers] => 
                        [status] => 
                    )
    
            )
    
    )
    Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    Thank you for the update.

    The request body being sent is

    signature=NGEyZGRmMTQ4YzVhOWM0MjE1MWE1MjllOGNiZGNjMDY%3D

    It is not valid JSON. We are not sure why it is doing this, but this is definitely the reason you are not able to pass the public key.

    You can try resetting the plugin and starting again.

    To reset Wordfence and keep most of your current settings then do the following:

    1) You can use the Tools >> Import/Export Options page to export most of your current configuration.

    2) Enable the option Delete Wordfence tables and data on deactivation in the General Wordfence Options section on the All Options page.

    3) Press the SAVE CHANGES button.

    4) Deactivate and then activate the Wordfence plugin on the WordPress Plugins page.

    5) Import your saved configuration token on the Tools >> Import/Export Options page.

    6) Optimize the firewall.

    7) The firewall will be in Learning Mode again and you will need to run through these instructions:

    https://www.wordfence.com/help/firewall/learning-mode/`

    Thread Starter LeinardoSmith

    (@leinardosmith)

    @wfphil Good news! Just found out that the latest set of updates fixed the issue (not sure which one fixed it). Thanks for looking into this for us!

    Plugin Support wfphil

    (@wfphil)

    Hi @leinardosmith

    Thank you for the good news.

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

The topic ‘Error Connecting to Wordfence Central’ is closed to new replies.