core icon indicating copy to clipboard operation
core copied to clipboard

Investigate php5-curl issues with SNI and redirects

Open PVince81 opened this issue 11 years ago • 71 comments

Whenever an app in the the app store points to a Github URL (or some other servers), some curl on some environments will show:

{"reqId":"zM09Y0\/eIzFoer4ohglK","remoteAddr":"127.0.0.1","app":"core","message":"cURL error 60: SSL certificate problem: unable to get local issuer certificate","level":3,"time":"2015-07-07T13:06:33+00:00","method":"POST","url":"\/owncloud\/index.php\/settings\/ajax\/enableapp.php"}

It happened for me on the following setup:

  • openSUSE Tumbleweed
  • curl-7.42.1-1.1.x86_64
  • php5-5.6.9-1.1.x86_64
  • php5-curl-5.6.9-1.1.x86_64

The problem was with the calendar app which redirected to the following URL: https://github.com/owncloud/calendar/releases/download/v0.7.0/calendar.zip which itself seems to redirect to an amazon S3 link.

See https://github.com/owncloud/documentation/pull/1290 and https://github.com/owncloud/calendar/issues/826#issuecomment-119180578

@LukasReschke

PVince81 avatar Jul 07 '15 14:07 PVince81

So do I need to wait until 8.2 is released before my very basic installation of ownCloud with a shared calendar will work? Right now I'm getting the same error as mentioned by PVince81 when I try to enable the calendar app.

Thank you.

PolishedStaple avatar Jul 07 '15 19:07 PolishedStaple

@nestsman in case you have ssh access to the server you can also manually install apps.

  • wget the app from the appstore
  • extract the zip/tar into the apps folder
  • enable the app in the apps management

DeepDiver1975 avatar Jul 07 '15 22:07 DeepDiver1975

I face the same problem with FreeBSD 10.1. Could this have to do with an older OpenSSL version? Mine is 1.0.1l with cURL 7.43.

gamanakis avatar Jul 08 '15 11:07 gamanakis

I tried with OpenSSL 1.0.2c from ports, recompiled cURL and php5-curl (5.4.42), however this doesn't resolve it.

gamanakis avatar Jul 08 '15 13:07 gamanakis

@DeepDiver1975 tried this with the Calendar app; still getting the cURL error 60 when trying to enable from the web interface.

ghost avatar Jul 09 '15 02:07 ghost

I thought this had to do with PHP not being able to find a certificate store but my hypothesis was wrong. Playing with php.ini's curl.cainfo, openssl.cafile, and openssl.capath didn't solve the issue.

@gamanakis seems it doens't have to do with old versions of openssl either, as what your testing with is very current.

josh4trunks avatar Jul 09 '15 05:07 josh4trunks

My distro where the problem appeared has openssl-1.0.2a-1.1.x86_64 My productive server where it worked properlty has openssl-1.0.1k-11.72.1.x86_64

@entyrion maybe it's trying to update the app. Did you get the correct version of the calendar app from Github ? It should be 0.7.0. Have a look in the file "apps/calendar/appinfo/version"

PVince81 avatar Jul 09 '15 08:07 PVince81

I did a git bisect. Known good commit: 8.1 RC1 d5ef1f28ce0d4014161155e2d0a2493bdba52913 Known bad commit: 8.1 RC2 e7a30e091d8ea79b14117ca47d6c2fd2dc61a48a So: ae3d402dbc3c9620cea5b32bedc7f00874b12dd0 is the first bad commit commit ae3d402dbc3c9620cea5b32bedc7f00874b12dd0 Author: Joas Schilling [email protected] Date: Mon Jun 29 11:15:56 2015 +0200

Send OC version to appstore so it can reply with the right links

:040000 040000 d3b7bb600bc8ec37ab5afb2f1c22905cc37e898f 2a78d56b5cdc508527d93638b4884ff1720046de M lib :040000 040000 aeb5c93adbac570d85c97bd11a32efb8ea43c8f1 b93b29d4137a1abdb0e5c034ac166919a9911c73 M settings :040000 040000 898d6d580c7917f818698d8154be41ec51a6679f 210fae7a1328a18fdb00ab3b8657564b63de14b6 M tests

Could someone verify this?

gamanakis avatar Jul 09 '15 13:07 gamanakis

I don't see anything related to SSL verification in this commit. But the parameters seem to have changed. Maybe without the parameters the link that the app store delivered was not from Github, which made it work ? And the new link (for 8.1) points to Github and causes the redirect issue ?

PVince81 avatar Jul 09 '15 14:07 PVince81

False alarm. On my system (FreeBSD 10.1, see above) reversing selectively the above on the official 8.1.0 doesn't produce the error anymore but also doesn't install the apps (contacts and calendar), meaning probably that no connection at all is made to the apps-server.

gamanakis avatar Jul 09 '15 16:07 gamanakis

unsuccessful update 8.0.4 to 8.1 #17534 false alarm too. Reinstall worked fine without apps (contacts and calendar). They can't be reinstalled : cURL error 60

ruspantini avatar Jul 09 '15 17:07 ruspantini

I just manually installed the calendar and it works !!! I downloaded here Calendar 0.6.5 for ownCloud 8.1 then Extracted the contents from the downloaded archive to the apps folder. Then navigate to "Apps" with an administrative user, and enabled the app again. This time it worked. I have to try with Contacts and will report ...

ruspantini avatar Jul 09 '15 18:07 ruspantini

Yes that works. Not really a solution to the problem though.

jankkm avatar Jul 09 '15 18:07 jankkm

Well I'm not a developer ... kind of a newbie and I was quite proud of having found a solution and maybe helping you all ;-) still trying with contacts ...

ruspantini avatar Jul 09 '15 18:07 ruspantini

It works with Contacts too. I forgot to mention ownCloud 8.1 asks for reinstallation each time. After a quick reinstallation contacts and calendar show up. Have a great evening everyone. I'll be back tomorrow

ruspantini avatar Jul 09 '15 19:07 ruspantini

I prefer to wait for 8.1.2 to fix the problem. Apparently there is not a QA team in place to catch this kind of stuff before it's released?

PolishedStaple avatar Jul 09 '15 19:07 PolishedStaple

I think I resolved it for FreeBSD 10.1. In addition to curl, php5-curl and php5-openssl also apache24 has to be compiled against OpenSSL 1.0.2c from ports.

There seems to be a problem with the OpenSSL 1.0.1l installed in the base system regarding SNI. For example: OpenSSL 1.0.1l base system /usr/bin/openssl s_client -servername chrismeller.com -connect chrismeller.com:443 returns "Verify return code: 20 (unable to get local issuer certificate)"

while OpenSSL 1.0.2c from ports /usr/local/bin/openssl s_client -servername chrismeller.com -connect chrismeller.com:443 returns "Verify return code: 0 (ok)"

gamanakis avatar Jul 09 '15 23:07 gamanakis

@gamanakis thanks, I'll try recompiling everything with "WITH_OPENSSL_PORT=yes" and see if that fixes my use cases.

josh4trunks avatar Jul 09 '15 23:07 josh4trunks

@PVince81

My distro where the problem appeared has openssl-1.0.2a-1.1.x86_64

See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201446 "This is a bug with OpenSSL since 1998 and fixed in 1.0.1n..."

gamanakis avatar Jul 10 '15 00:07 gamanakis

I can confirm recompiling everything with openssl 1.0.2d worked for me. I'm not sure what package needs to be compiled against the latest version, but I assume php.

josh4trunks avatar Jul 10 '15 07:07 josh4trunks