snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.09k stars 3.18k forks source link

Cannot create Backups with paas database #12852

Open Joly0 opened 1 year ago

Joly0 commented 1 year ago

Debug mode

Describe the bug

I am running snipe-it as a docker container with azure and have a paas mysql database on azure aswell. So far, everything works as expected, except for the backups, which dont work. The moment i click on "create backup" i am presented with this error message: image

For the database i have ssl enabled and for the container i have set these environment variables

I have already looked into this and found this issue https://github.com/snipe/snipe-it/issues/11785 but this is not my problem. So far the laravel.log is empty aswell, so no hints from there aswell.

I have tried accessing the db with the same username, pw and ssl certificate as the snipe-it container uses through mysql workbench and there everything works 100% fine.

Reproduction steps

  1. Create Azure MySQL Database
  2. Create Snipe-IT as a docker container for web app with docker compose
  3. Setup Snipe-IT
  4. Try to create a backup

Expected behavior

The backups should work, as everything else does

Screenshots

No response

Snipe-IT Version

v6.1.0 - build 10161

Operating System

Azure Web App

Web Server

Nginx

PHP Version

8.1

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

Error Backup failed because The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Got error: 3159: "Connections using insecure transport are prohibited while --require_secure_transport=ON." when trying to connect . 
#0 /app/www/vendor/spatie/db-dumper/src/DbDumper.php(263): Spatie\DbDumper\Exceptions\DumpFailed::processDidNotEndSuccessfully() 
#1 /app/www/vendor/spatie/db-dumper/src/Databases/MySql.php(203): Spatie\DbDumper\DbDumper->checkIfDumpWasSuccessFul() 
#2 /app/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(260): Spatie\DbDumper\Databases\MySql->dumpToFile() 
#3 [internal function]: Spatie\Backup\Tasks\Backup\BackupJob->Spatie\Backup\Tasks\Backup\{closure}() 
#4 /app/www/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(695): array_map() 
#5 /app/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(263): Illuminate\Support\Collection->map() 
#6 /app/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(171): Spatie\Backup\Tasks\Backup\BackupJob->dumpDatabases() 
#7 /app/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(147): Spatie\Backup\Tasks\Backup\BackupJob->createBackupManifest() 
#8 /app/www/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(56): Spatie\Backup\Tasks\Backup\BackupJob->run() 
#9 /app/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Spatie\Backup\Commands\BackupCommand->handle() 
#10 /app/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() 
#11 /app/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() 
#12 /app/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod() 
#13 /app/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call() 
#14 /app/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call() 
#15 /app/www/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute() 
#16 /app/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run() 
#17 /app/www/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run() 
#18 /app/www/vendor/symfony/console/Application.php(1024): Spatie\Backup\Commands\BaseCommand->run() 
#19 /app/www/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand() 
#20 /app/www/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun() #21 /app/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run() 
#22 /app/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(186): Illuminate\Console\Application->run() 
#23 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(263): Illuminate\Console\Application->call() 
#24 /app/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Foundation\Console\Kernel->call() 
#25 /app/www/app/Http/Controllers/SettingsController.php(1096): Illuminate\Support\Facades\Facade::__callStatic() 
#26 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\SettingsController->postBackups() 
#27 /app/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction() 
#28 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\Routing\ControllerDispatcher->dispatch() 
#29 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\Route->runController() #30 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(721): Illuminate\Routing\Route->run() 
#31 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}() 
#32 /app/www/app/Http/Middleware/CheckPermissions.php(24): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#33 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckPermissions->handle() 
#34 /app/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php(58): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#35 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\AuthenticateSession->handle() 
#36 /app/www/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#37 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Auth\Middleware\Authenticate->handle() 
#38 /app/www/app/Http/Middleware/AssetCountForSidebar.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#39 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\AssetCountForSidebar->handle() 
#40 /app/www/vendor/laravel/passport/src/Http/Middleware/CreateFreshApiToken.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#41 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laravel\Passport\Http\Middleware\CreateFreshApiToken->handle() 
#42 /app/www/app/Http/Middleware/CheckForTwoFactor.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#43 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckForTwoFactor->handle() 
#44 /app/www/app/Http/Middleware/CheckUserIsActivated.php(47): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#45 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckUserIsActivated->handle() 
#46 /app/www/app/Http/Middleware/CheckLocale.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #47 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckLocale->handle() 
#48 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#49 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle() 
#50 /app/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#51 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle() 
#52 /app/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#53 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle() 
#54 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#55 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(723): Illuminate\Pipeline\Pipeline->then() 
#56 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): Illuminate\Routing\Router->runRouteWithinStack() #57 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\Routing\Router->runRoute() #58 /app/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(651): Illuminate\Routing\Router->dispatchToRoute() 
#59 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch() 
#60 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}() 
#61 /app/www/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#62 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Livewire\DisableBrowserCache->handle() 
#63 /app/www/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#64 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle() 
#65 /app/www/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#66 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle() 
#67 /app/www/app/Http/Middleware/PreventBackHistory.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#68 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\PreventBackHistory->handle() 
#69 /app/www/app/Http/Middleware/SecurityHeaders.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#70 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\SecurityHeaders->handle() 
#71 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#72 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() 
#73 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle() 
#74 /app/www/app/Http/Middleware/CheckForDebug.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#75 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckForDebug->handle() 
#76 /app/www/app/Http/Middleware/CheckForSetup.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#77 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckForSetup->handle() 
#78 /app/www/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#79 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle() 
#80 /app/www/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#81 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle() 
#82 /app/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#83 /app/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest() 
#84 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle() 
#85 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#86 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle() 
#87 /app/www/app/Http/Middleware/NoSessionStore.php(28): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#88 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\NoSessionStore->handle() 
#89 /app/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() 
#90 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then() 
#91 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() 
#92 /app/www/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle() 
#93 {main} Backup failed because: The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Got error: 3159: "Connections using insecure transport are prohibited while --require_secure_transport=ON." when trying to connect .

Additional context

No response

Joly0 commented 1 year ago

Could someone please look at this? @uberbrady (sorry for the ping, but i am quite frustrated now)

uberbrady commented 1 year ago

I'm trying to figure out if the problem is on our end (which is possible), or if it's something in the laravel-backup package. I'll report back.

uberbrady commented 1 year ago

Hrm, so if you go to config/database.php , if you scroll down to the connections / mysql / dump part - you'll see a commented-out add_extra_option part in there.

Try and add the options --ssl-ca='/cert.pem' --ssl=1 to that. Does it work if you do that? If so, that'll give you a temporary workaround and will give me an idea of what to put in to a PR to get SSL-restricted MySQL backups working correctly.

Joly0 commented 1 year ago

Yes indeed this fixed the issue. Had to adjust the path to the pem file, but afterwards it did work in a test environment image Unfortunately i am trying to run snipe-it in an azure web app for containers and i dont have shell access there so i cant edit the files and therefore would have to wait for a release/push to master on your site. But thank you so far :)

uberbrady commented 1 year ago

Well, that's at least a start, I guess. I'll have to try and figure out how to translate all the various .env values we have into the appropriate add_extra_option parts. It may still make sense to have this change implemented at the laravel-backup side; I don't know.

Joly0 commented 1 year ago

Yep, i am glad this issue is solved now. Thank you very much for your effort. If some testing is required, i am willing to apply as a helper

Joly0 commented 1 year ago

Hey @uberbrady (sry for the ping )

Maybe you could add your information here https://github.com/spatie/laravel-backup/discussions/1679 aswell, so the package creators know about the issue and solution aswell and maybe can do something on their side. I am not as knowledgeable as you and might mix something up explaining the issue there.

Otherwise if there is anything i can do or help with, eg. testing a different branch with a fix or something else, please let me know :)

GitHub
Backup failed because The dump process failed with exitcode 2 · spatie/laravel-backup · Discussion #1679
Hey, i am using snipe-it which uses laravel-backup and i have an issue open over there aswell (snipe/snipe-it#12852) but it doesnt seem like i will get any help. I did some testing and the mysqldum...
Joly0 commented 9 months ago

Hey @uberbrady have you yet been able to get this properly implemented?