HDInnovations / UNIT3D-Community-Edition

Private Torrent Tracker Built With Laravel, Livewire and AlpineJS.
GNU Affero General Public License v3.0
1.98k stars 379 forks source link

[Bug] after upgrade to 7.2.0 error il cURL ssl #3331

Closed carloangeletti closed 10 months ago

carloangeletti commented 10 months ago

UNIT3D Version

7.2.0

PHP & Platform

8.3.1 - ubuntu 22.04

Laravel verion

10.37.3

Have you done this?

Expectation

After upgrade to 7.2.0 and open Torrent details, receive "error 500"

Description

This in laravel log

cURL error 60: SSL: no alternative certificate subject name matches target host name 'api.themoviedb.org' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/884452?api_key= REDACTED&language=it_IT&append_to_response=videos%2Cimages%2Ccredits%2Cexternal_ids%2Ckeywords%2Crecommendations%2Calternative_titles

Stack trace & logs

No response

Are you a UNIT3D sponsor?

No, don't give priority to this

Upvote & Fund

Fund with Polar

HDVinnie commented 10 months ago

You did not include the full error with attack trace...

carloangeletti commented 10 months ago

Hi @HDVinnie, i have only this in error in laravel log: cURL error 60: SSL: no alternative certificate subject name matches target host name 'api.themoviedb.org' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/884452?api_key=REDACTED&language=it_IT&append_to_response=videos%2Cimages%2Ccredits%2Cexternal_ids%2Ckeywords%2Crecommendations%2Calternative_titles

I noticed that initially it works correctly, after a few minutes it starts to give error 500 when you open the torrent details

the only error in the log is the one written above

HDVinnie commented 10 months ago

1) This just looks like TMDB had a SSL beret issue which is now resolved. Im not able to replicate this. 2) You have leaked your TMDB API KEY twice in this issue. Please change it.

carloangeletti commented 10 months ago

Hi, yes changing it is not a problem. Can I try to update again, if I encounter the error again could you help me?

carloangeletti commented 10 months ago

I just updated and I get the same error again

if you want I can give you access to the tracker admin to control what happens I'll write to you privately on discord

carloangeletti commented 10 months ago

cURL error 60: SSL: no alternative certificate subject name matches target host name 'api.themoviedb.org' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/585083?api_key=XXXXXXXXXXXXXX&language=it&append_to_response=videos%2Cimages%2Ccredits%2Cexternal_ids%2Ckeywords%2Crecommendations%2Calternative_titles

GuzzleHttp\Exception\RequestException

/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

Roardom commented 10 months ago

The stack trace indicates where the error happens, not just what it is. Only sending the error itself is not helpful. Please send the full stack trace (with redacted credentials).

carloangeletti commented 10 months ago

Hi @Roardom thanks for the fetch meta, I understand what you are saying but in the logs there is only this one that I sent. There is nothing more.

In the meantime, I restored a dump of version 7.1.2 because users were no longer receiving downloads and every torrent details have error 500.

I also asked HDVinnie directly for a quote to optimize these things (I have another error due to the fact that it doesn't get the meta from TMDB correctly and every time we have to clear the cache and edit the torrents).

If someone is willing to give us support we will be happy.

Roardom commented 10 months ago

I'm glad your database restore when smoothly. I'm sure HDVinnie will be able to help you out with that. But just to be sure since none of your other previous bug reports have stack traces, you are aware that you have to click the error in Staff Dashboard / Laravel Logs, and it will expand showing more detailed information including the full stacktrace, correct?

carloangeletti commented 10 months ago

Yes I know, thanks. He will make some more attempts these days to recover the complete error.

Thanks in the meantime for the support.

carloangeletti commented 10 months ago

Hi, I'll come back to you, hopefully, with all the information necessary to understand the bug.

cURL error 60: SSL: no alternative certificate subject name matches target host name 'api.themoviedb.org' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/11329?api_key=XXXX&language=it&append_to_response=videos%2Cimages%2Ccredits%2Cexternal_ids%2Ckeywords%2Crecommendations%2Calternative_titles

/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

`cURL error 60: SSL: no alternative certificate subject name matches target host name 'api.themoviedb.org' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/9687?api_key=XXXX&language=it&append_to_response=videos%2Cimages%2Ccredits%2Cexternal_ids%2Ckeywords%2Crecommendations%2Calternative_titles {"userId":3,"exception":"[object] (GuzzleHttp\Exception\RequestException(code: 0): cURL error 60: SSL: no alternative certificate subject name matches target host name 'api.themoviedb.org' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/9687?api_key=XXXX&language=it&append_to_response=videos%2Cimages%2Ccredits%2Cexternal_ids%2Ckeywords%2Crecommendations%2Calternative_titles at /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:211) [stacktrace]

0 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(158): GuzzleHttp\Handler\CurlFactory::createRejection()

1 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(110): GuzzleHttp\Handler\CurlFactory::finishError()

2 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(47): GuzzleHttp\Handler\CurlFactory::finish()

3 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()

4 /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()

5 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(1252): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()

6 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(1218): Illuminate\Http\Client\PendingRequest->Illuminate\Http\Client\{closure}()

7 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(1204): Illuminate\Http\Client\PendingRequest->Illuminate\Http\Client\{closure}()

8 /var/www/html/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(35): Illuminate\Http\Client\PendingRequest->Illuminate\Http\Client\{closure}()

9 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(38): GuzzleHttp\PrepareBodyMiddleware->__invoke()

10 /var/www/html/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}()

11 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke()

12 /var/www/html/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}()

13 /var/www/html/vendor/guzzlehttp/guzzle/src/Client.php(333): GuzzleHttp\HandlerStack->__invoke()

14 /var/www/html/vendor/guzzlehttp/guzzle/src/Client.php(169): GuzzleHttp\Client->transfer()

15 /var/www/html/vendor/guzzlehttp/guzzle/src/Client.php(189): GuzzleHttp\Client->requestAsync()

16 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(1049): GuzzleHttp\Client->request()

17 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(894): Illuminate\Http\Client\PendingRequest->sendRequest()

18 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(248): Illuminate\Http\Client\PendingRequest->Illuminate\Http\Client\{closure}()

19 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(892): retry()

20 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php(770): Illuminate\Http\Client\PendingRequest->send()

21 /var/www/html/app/Services/Tmdb/Client/Movie.php(241): Illuminate\Http\Client\PendingRequest->get()

22 /var/www/html/app/Http/Controllers/TorrentController.php(113): App\Services\Tmdb\Client\Movie->__construct()

23 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\TorrentController->show()

24 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction()

25 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\Routing\ControllerDispatcher->dispatch()

26 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\Route->runController()

27 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\Routing\Route->run()

28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\{closure}()

29 /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Auth\Middleware\EnsureEmailIsVerified->handle()

31 /var/www/html/app/Http/Middleware/CheckIfBanned.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\CheckIfBanned->handle()

33 /var/www/html/app/Http/Middleware/SetLanguage.php(96): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\SetLanguage->handle()

35 /var/www/html/vendor/hdvinnie/laravel-security-headers/src/SecureHeadersMiddleware.php(16): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

36 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): HDVinnie\SecureHeaders\SecureHeadersMiddleware->handle()

37 /var/www/html/app/Http/Middleware/UpdateLastAction.php(34): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\UpdateLastAction->handle()

39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()

41 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle()

43 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php(60): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\AuthenticateSession->handle()

45 /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

46 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Auth\Middleware\Authenticate->handle()

47 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

48 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle()

49 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

50 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()

51 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle()

52 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

53 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()

54 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

55 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle()

56 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

57 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\Pipeline\Pipeline->then()

58 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack()

59 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute()

60 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute()

61 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()

62 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()

63 /var/www/html/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

64 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Livewire\DisableBrowserCache->handle()

65 /var/www/html/app/Http/Middleware/BlockIpAddress.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

66 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\BlockIpAddress->handle()

67 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

68 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle()

69 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

70 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()

71 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()

72 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

73 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()

74 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()

75 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

76 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()

77 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

78 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()

79 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

80 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()

81 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()

82 /var/www/html/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle()

83 {main}

"} `

carloangeletti commented 10 months ago

Hi @Roardom and @HDVinnie . Have you had the opportunity to analyze the error? Thanks in advance.

Roardom commented 10 months ago

I randomly triggered it the other day and haven't managed to trigger it since. The only thing I can think of is that tmdb is blocked in some countries (such as Russia) and could be causing the error. I haven't been able to reproduce it since.

carloangeletti commented 10 months ago

Hi @Roardom thanks for the reply.

The server is in Europe, in Amsterdam. I don't think it depends on that otherwise I would have had the problem even with the foreseen versions.

What if you try to force the curl call by not validating the ssl certificate? I know it's not safe to do this but it might be an idea.

Roardom commented 10 months ago

This issue is most likely beyond unit3d. Upon a quick google I found https://www.themoviedb.org/talk/6531b98e9ac535087755c46a which mentions that the user fixed it by using a different DNS provider. Have you tried curl'ing tmdb directly to see if you can connect? I haven't been able to replicate the issue since that one struck of luck so I'm unable to find a solution as of right now.

carloangeletti commented 10 months ago

Hi @Roardom , you're right. Thank you for your suggestion. I changed the DNS configuration to Google ones and now everything seems to work correctly.

I'll update you in the next few days if everything is actually ok.