BetfaiR implementation asking for SSL

+4 votes

Hi, Thank your for this interesting package and the help manual!

When trying to login I get:

Error in curlPerform(url = "https://api.betfair.com/global/v3/BFGlobalService",  :
  SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I understand there is an option in RCurl to over-ride this tho security may be lessened.

Any assistance appreciated, cheers.

asked Nov 13, 2011 in betfaiR package by hobbes Novice (400 points)
edited Nov 14, 2011 by colin

2 Answers

+2 votes
 
Best answer
download cacert.pem as in the answer below and place it in your betwise folder

add this line in R:

>options( RCurlOptions = list(cainfo ="/betwise/cacert.pem"))

similar issue was in  Betfairly

this fixed it for me obviously you can change directory of cacert.pem
answered Nov 24, 2011 by Sarpy23 Handicapper (650 points)
edited Mar 29, 2012 by colin
Thanks Sarpy this was most useful!
Same here. After downloading had the same error message as above trying to login. Found "cacert.pem" in c:\program files\R\R-2.14.0\library\Rcurl\CurlSSL. Moved it to c:\betwise and ran the options command in Sarpy's post and now can run all the BetfaiR functions okay. Thanks!

(using Windows XP)
+1 vote
Hi - haven't come across this error message yet though this is documented behaviour for RCurl, here:

http://www.omegahat.org/RCurl/FAQ.html

Look towards the bottom of the page for the same error message you've reproduced below.  Basically you need to make sure that you have a valid certificate installed (eg. http://curl.haxx.se/docs/caextract.html) to pass to the underlying curl program - or to disable certificate checks.  Full instructions for specifying the right certificate are listed at the above URL - ideally you want to make sure that the file curl-ca-bundle.crt is available for your local curl install, as specified in the RCurl FAQs.

Also, see the help info for curl for more details on the same subject:

http://curl.haxx.se/docs/sslcerts.html

Remember that RCurl is just an R wrapper for curl, so if your curl install is good for https pages then so should RCurl be.

Also, note that the SSL library should be installed for curl to work with https connections.  You can check that it is by typing

> curl-config --feature

at your system command line - or instead from within R by running the sourceforge access example listed in the

>?getURL

R help function (after RCurl has been loaded by the betfaiR library).
answered Nov 15, 2011 by betwise2 Novice (390 points)
I have exactly the same issue.

Very little of what is on the curl FAQ seems to work - the curl.netmirror.org link seems to be permanently failed) and so far, I can't work out how to get the verifypeer=FALSE to work (i've submitted the url's www.betfair.com and api.betfair.com). It is probably not too difficult to solve, but it makes the documentation look pretty weak in this area. A walk-through would be nice, from someone who understands what this is all about (which I don't, even though I can make some educated guesses - I'm a gambler not a tech or R guru!)
What operating system are you on?  I haven't experienced this issue myself (all my testing machines already have a reliable install of curl, which I think is your issue) so can't walkthrough a solution without recreating the problem.  However, looks like enough folk have reported they are having this issue that trying to recreate the problem is useful - so will post on this thread when I've had time to set up a test machine without curl and then install. If you make any progress with the links above in the interim, please post back to this thread.
Ok. It is a vista home premium installation, and is completely up to date. The load finds all the references fine, though does warn that they were built under 2.12.2 (I have 2.12.1 right now). There is a message specific to RCurl which is "Loading required package RCurl" so that doesn't seem to be an issue. All the references are present in R/library/. Functionally, everything seems to run clean. I could install the most up to date build of R but my connection here is slow and 45M is a lot unless that is for sure the problem. Since I'm not the only one with problems, and the RCurl certificate messages helfile dates from 2006 - I don't believe this to be an OS issue anyway. The message I am getting is identical to that mentioned in the original posting.

Edit 1: If I enter the line 'getURLContent("https://api.betfair.com/global/v3/BFGlobalService",ssl.verifypeer = FALSE)' the return is 'Error: Not Found'. If I use some other URL (such as www.betfair.com), I get a whole bunch of html returned beginning "<!doctype html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">, but it doesn't help login access.

It may or may not be relevant that my default browser is Firefox.

Edit 2: Reading up on RCurl / curl, it seems this isn't a new issue. There are a number of historical issues relating to aged certificate packs being shipped with libcurl. As far as I can make out, this was fixed; so I updated (now on 2.14.0), and checked with IE9 as default, FFx as default, and with the Internet2.dll enabled. I still get the same 'certificate verify fails' message, and am about at the limit of things I can think to try. Betfair seems to understand my Mozilla certificates, so why can't curl resolve this? So far, getting nowhere fast. Any suggestions as to what else I can try?
I also have exactly the same problem as the original poster.

I downloaded the software from your website and installed it exactly as decribed onto my Windows 7 PC and as soon as you try to use rCurl with HTTPS you get the error message (i.e. when you attempt to Logon).
I use IE8 as my browser and have looked at the posts on other internet sites and there's lots of talk about loading certificate files and the like but I can't see that anyone has actually solved this problem.
So I'm just adding my support for a quick solution. Any help would be much appreciated.
Hi - I've not been able to replicate the problem in Linux, so will have a look with a clean Windows install as soon as I get a chance, then hopefully should be able to do the walkthrough that folks are after.  My first port of call, however, would be to make sure there is a reliable curl install on the machine.  This can be tested independently of R and RCurl.  (Fortunately installing curl in Linux is easy, there are usually pre-built packages for it or it is pre-installed).
I downloaded and installed R (2.14 now, after the update)
I downloaded and successfully installed the BetfaiR package, which itself causes 5 packages to be downloaded (Including RCurl).
While appreciating the difference between PC's and Linux boxes, anything other than that is a black box to me.

If Libcurl needs to be installed independently of RCurl, then shouldn't RCurl take care of that when it is downloading itself?
...