• Resolved houdini69

    (@houdini69)


    Hi,

    Tried to configure Crowdsec with my new site but got this log error when test it with 192.168.1.254 IP address. Remediation gave me a blank page.

    Something went wrong during bouncing|{“type”:”EXCEPTION_WHILE_BOUNCING”,”message”:”Unexpected CURL call failure: “,”code”:500,”file”:”/var/www/wordpress/wp-content/plugins/crowdsec/vendor/crowdsec/bouncer/src/AbstractBouncer.php”,”line”:173}

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @houdini69,
    Thanks for your message.

    Your error message indicates that you received no response for the tested curl call.

    I suppose you are using the last version of Crowdsec and the plugin.

    Maybe a first step to debug this problem would be to make a direct curl call with this type of command:

    curl -H "X-Api-Key:your-bouncer-api-key" your-crowdsec-url/v1/decisions\?ip=192.168.1.254

    It should look like below on a basic installation:

    curl -H "X-Api-Key:ab4429********725d43feb2" https://localhost:8080/v1/decisions\?ip=192.168.1.254

    Could you test it to see if it works or if you can get a useful error message ?

    (If it works, you should get “null” for an IP with no active decision”)

    Thanks

    Thread Starter houdini69

    (@houdini69)

    Ok.

    curl -H "X-Api-Key:**********" https://localhost:8080/v1/decisions\?ip=192.168.1.254

    gives me a null answer with no active decision.

    I got that in nginx log error in CrowdSec extension setting page with Test bouncing,

    FastCGI sent in stderr: “PHP message: PHP Warning: Undefined array key “HTTP_REFERER” in /var/www/wordpress/wp-content/plugins/crowdsec/inc/admin/init.php on line 220″ while reading response header from upstream

    Thread Starter houdini69

    (@houdini69)

    I have added this directive and there is no more nginx log error but still a blank page,

    fastcgi_param HTTP_REFERER $http_referer;

    Thanks.
    Well, it seems to be not so easy to debug.

    Could you check if the PHP curl extension is installed ?

    You can run php -r 'var_dump(extension_loaded("curl"));'
    for example and if the result is bool(true), it is ok.


    Could you enable de debug mode (Advanced settings), then clic the test button and share the content of what appears in the /wp-content/plugins/crowdsec/logs/debug.log file ?

    For a working test, I have this kind of lines in debug.log :

    2023-04-25T07:01:31.390386+00:00|100|Instantiate client|…
    2023-04-25T07:01:31.411349+00:00|100|Instantiate cache|…
    2023-04-25T07:01:31.411465+00:00|100|Instantiate remediation engine|…
    2023-04-25T07:01:31.411920+00:00|100|Cache result …
    2023-04-25T07:01:31.411946+00:00|100|Now processing a bouncer request …
    2023-04-25T07:01:31.421607+00:00|100|Decisions have been sorted by priority| …
    2023-04-25T07:01:31.421989+00:00|200|Final remediation|{"remediation":"bypass"} …

    Maybe we will see something usefull in these lines.

    And maybe you could also test without Curl by disabling “Use cURL to call Local API” in the Connection details settings ?

    Thanks

    Thread Starter houdini69

    (@houdini69)

    php -r ‘var_dump(extension_loaded(“curl”));’
    bool(true)

    • This reply was modified 1 year, 7 months ago by houdini69.
    Thread Starter houdini69

    (@houdini69)

    with debug log setting,

    2023-04-25T16:35:29.800015+00:00|100|Instantiate client|{“type”:”CLIENT_INIT”,”configs”:{“api_key”:”***”,”auth_type”:”api_key”,”tls_cert_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../tls/”,”tls_key_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../tls/”,”tls_verify_peer”:false,”tls_ca_cert_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../tls/”,”api_url”:””,”api_timeout”:120,”user_agent_suffix”:”WordPress”,”user_agent_version”:”v2.3.1″}}
    2023-04-25T16:35:29.801561+00:00|100|Instantiate cache|{“type”:”CACHE_INIT”,”configs”:{“fs_cache_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../.cache”,”use_cache_tags”:false},”adapter”:”Symfony\Component\Cache\Adapter\PhpFilesAdapter”}
    2023-04-25T16:35:29.802762+00:00|100|Instantiate remediation engine|{“type”:”REM_INIT”,”configs”:{“fallback_remediation”:”captcha”,”stream_mode”:false,”clean_ip_cache_duration”:60,”bad_ip_cache_duration”:120,”geolocation”:{“enabled”:false,”type”:”maxmind”,”cache_duration”:86400,”maxmind”:{“database_type”:”country”,”database_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../geolocation/”}},”ordered_remediations”:[“ban”,”captcha”,”bypass”]},”cache”:”CrowdSec\RemediationEngine\CacheStorage\PhpFiles”}
    2023-04-25T16:35:29.804147+00:00|100|Instantiate bouncer|{“type”:”BOUNCER_INIT”,”logger”:”CrowdSec\Common\Logger\FileLog”,”remediation”:”CrowdSec\RemediationEngine\LapiRemediation”,”configs”:{“use_curl”:false,”debug_mode”:true,”disable_prod_log”:false,”log_directory_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../logs/”,”forced_test_ip”:””,”forced_test_forwarded_ip”:””,”display_errors”:false,”bouncing_level”:”flex_bouncing”,”trust_ip_forward_array”:[],”cache_system”:”phpfs”,”captcha_cache_duration”:86400,”hide_mentions”:false,”custom_css”:””,”excluded_uris”:[]}}
    2023-04-25T16:35:29.804414+00:00|200|Bouncing current IP|{“ip”:”192.168.1.254″}
    2023-04-25T16:35:29.805502+00:00|100|Cache result|{“type”:”LAPI_REM_CACHED_DECISIONS”,”ip”:”192.168.1.254″,”result”:”miss”}
    2023-04-25T16:35:29.805646+00:00|100|Now processing a bouncer request|{“type”:”BOUNCER_CLIENT_REQUEST”,”method”:”GET”,”endpoint”:”/v1/decisions”,”parameters”:{“ip”:”192.168.1.254″}}
    2023-04-25T16:35:29.806276+00:00|400|Something went wrong during bouncing|{“type”:”EXCEPTION_WHILE_BOUNCING”,”message”:”Unexpected HTTP call failure.”,”code”:500,”file”:”/var/www/wordpress/wp-content/plugins/crowdsec/vendor/crowdsec/bouncer/src/AbstractBouncer.php”,”line”:173}

    Thread Starter houdini69

    (@houdini69)

    cURL API call desactivated

    sudo tail debug.log
    2023-04-25T17:56:26.819879+00:00|100|Now processing a bouncer request|{“type”:”BOUNCER_CLIENT_REQUEST”,”method”:”GET”,”endpoint”:”/v1/decisions”,”parameters”:{“ip”:”192.168.1.254″}}
    2023-04-25T17:56:26.820161+00:00|400||{“type”:”WP_EXCEPTION_WHILE_TESTING_CONNECTION”,”message”:”Unexpected HTTP call failure.”,”code”:500,”file”:”/var/www/wordpress/wp-content/plugins/crowdsec/vendor/crowdsec/bouncer/src/AbstractBouncer.php”,”line”:173}
    2023-04-25T17:56:26.867904+00:00|100|Instantiate client|{“type”:”CLIENT_INIT”,”configs”:{“api_key”:”***”,”auth_type”:”api_key”,”tls_cert_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../tls/”,”tls_key_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../tls/”,”tls_verify_peer”:false,”tls_ca_cert_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../tls/”,”api_url”:””,”api_timeout”:120,”user_agent_suffix”:”WordPress”,”user_agent_version”:”v2.3.1″}}
    2023-04-25T17:56:26.869535+00:00|100|Instantiate cache|{“type”:”CACHE_INIT”,”configs”:{“fs_cache_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../.cache”,”use_cache_tags”:false},”adapter”:”Symfony\Component\Cache\Adapter\PhpFilesAdapter”}
    2023-04-25T17:56:26.870710+00:00|100|Instantiate remediation engine|{“type”:”REM_INIT”,”configs”:{“fallback_remediation”:”captcha”,”stream_mode”:false,”clean_ip_cache_duration”:60,”bad_ip_cache_duration”:120,”geolocation”:{“enabled”:false,”type”:”maxmind”,”cache_duration”:86400,”maxmind”:{“database_type”:”country”,”database_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../geolocation/”}},”ordered_remediations”:[“ban”,”captcha”,”bypass”]},”cache”:”CrowdSec\RemediationEngine\CacheStorage\PhpFiles”}
    2023-04-25T17:56:26.872063+00:00|100|Instantiate bouncer|{“type”:”BOUNCER_INIT”,”logger”:”CrowdSec\Common\Logger\FileLog”,”remediation”:”CrowdSec\RemediationEngine\LapiRemediation”,”configs”:{“use_curl”:false,”debug_mode”:true,”disable_prod_log”:false,”log_directory_path”:”/var/www/wordpress/wp-content/plugins/crowdsec/inc/../logs/”,”forced_test_ip”:””,”forced_test_forwarded_ip”:””,”display_errors”:false,”bouncing_level”:”flex_bouncing”,”trust_ip_forward_array”:[],”cache_system”:”phpfs”,”captcha_cache_duration”:86400,”hide_mentions”:false,”custom_css”:””,”excluded_uris”:[]}}
    2023-04-25T17:56:26.872290+00:00|200|Bouncing current IP|{“ip”:”192.168.1.254″}
    2023-04-25T17:56:26.873346+00:00|100|Cache result|{“type”:”LAPI_REM_CACHED_DECISIONS”,”ip”:”192.168.1.254″,”result”:”miss”}
    2023-04-25T17:56:26.873488+00:00|100|Now processing a bouncer request|{“type”:”BOUNCER_CLIENT_REQUEST”,”method”:”GET”,”endpoint”:”/v1/decisions”,”parameters”:{“ip”:”192.168.1.254″}}
    2023-04-25T17:56:26.874072+00:00|400|Something went wrong during bouncing|{“type”:”EXCEPTION_WHILE_BOUNCING”,”message”:”Unexpected HTTP call failure.”,”code”:500,”file”:”/var/www/wordpress/wp-content/plugins/crowdsec/vendor/crowdsec/bouncer/src/AbstractBouncer.php”,”line”:173}

    Thanks.

    It seems that your “api_url” setting is empty as your log shows ”api_url”:””

    Can you set https://localhost:8080 in your Local API URL setting and try again ?

    Thanks

    Thread Starter houdini69

    (@houdini69)

    Ok, It’s working now! “Local API URL” field seemed to be populated but in fact not!

    Thank you for your help

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Unexpected CURL call failure: issue’ is closed to new replies.