DarkaOnLine / Ripcord

XML RPC client and server around PHP's xmlrpc library
33 stars 21 forks source link

New SSL error occurring accessing Odoo via XML-RPC API #9

Closed flyingL123 closed 6 years ago

flyingL123 commented 6 years ago

I've been accessing Odoo regularly for months via the XML-RPC API. I use a php script I wrote that makes use of your library.

All of a sudden, in the last day or so, I have been seeing this error in my logs:

production.ERROR: exception 'ErrorException' with message 'file_get_contents(): SSL: crypto enabling timeout' in app/vendor/darkaonline/ripcord/src/Ripcord/Client/Transport/Stream.php:59

Nothing has changed on my server in the last few days. I don't even know where to start troubleshooting this. Does it have to do with this library? Or does this mean Odoo changed something on their server?

My server is running Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-36-generic x86_64) and using PHP version: PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct 3 2016 13:00:37).

Any idea what this error means or why it suddenly started occurring?

DarkaOnLine commented 6 years ago

This problem is not related to the package. Take a look at this: https://stackoverflow.com/questions/14078182/openssl-file-get-contents-failed-to-enable-crypto

flyingL123 commented 6 years ago

Thanks @DarkaOnLine. Any chance you can offer me some more help here? I have seen that SO post but I don't really understand what it's telling me. Is it telling me that I can't use the package anymore because you're using file_get_contents instead of curl?

DarkaOnLine commented 6 years ago

It means that your server is out of date and it is failing to validate newer SSL certificate on your Odoo server.

You can disable SSL verification by passing context to file_get_content. https://github.com/DarkaOnLine/Ripcord/blob/master/src/Ripcord/Client/Transport/Stream.php#L29

   $context=array(
      "ssl"=>array(
            "verify_peer"=>false,
            "verify_peer_name"=>false,
        ),
    ); 

   $transport = \Ripcord\Client\Transport\Straem($context);

   $client = Ripcord::client($url, $options, $transport);

I think this should work.

flyingL123 commented 6 years ago

I think that fixed it. Thanks so much! You literally just saved me an entire day of frustrated digging which would have inevitably ended with updating my server which would have then caused a host of more issues.

flyingL123 commented 6 years ago

Quick follow up here, this didn't fix the problem after all. I was confused why it would since some calls were working and others weren't. I was just getting false positives when I first tested it so I thought it was fixed.

According to Odoo there is an issue on their end that they are fixing. I don't have any more details than that unfortunately but if they get it fixed I'm happy. Anyway, thanks for your help, just wanted to make sure I followed up here in case someone else comes across this same problem.