Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mcrypt_encrypt key zero error after updating to 3.5 #2931

Closed
2 tasks done
Openclutch opened this issue Nov 17, 2016 · 6 comments
Closed
2 tasks done

mcrypt_encrypt key zero error after updating to 3.5 #2931

Openclutch opened this issue Nov 17, 2016 · 6 comments

Comments

@Openclutch
Copy link

Openclutch commented Nov 17, 2016

Expected Behavior (or desired behavior if a feature request)

Just to load snipe it


Actual Behavior

Errors when loading the front page after I updated from 2.1.2 to 3.5.


Please confirm you have done the following before posting your bug report:


Please provide answers to these questions before posting your bug report:

  • Version of Snipe-IT you're running: Trying to run 3.5, previously on 2.1.2
  • What OS and web server you're running Snipe-IT on: Centos 6.7
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc): install.sh originally, then followed this: link to upgrade.
  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error: ErrorException in McryptEncrypter.php line 104:
    mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported
  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error: front page, or any page.
  • If a stacktrace is provided in the error, include that too.
  • Any errors that appear in your browser's error console.
  • Confirm whether the error is reproduceable on the demo.
  • Include any additional information you can find in app/storage/logs and your webserver's logs. Same as stack trace in debug mode.
  • Include what you've done so far in the installation, and if you got any error messages along the way.
  • Indicate whether or not you've manually edited any data directly in the database: No edits to db.

PHP version 5.6.27
Mysql version 5.6.33

I have converted everything over to the new config file, including the key value, which has exactly 32 characters in it. The file that contains that is in: config/app.php. It previously worked in our old version with the same cipher of: rijndael-256. It seems like I need to refresh the config somehow to get it to work in the new framework but not sure how. Hope you guys can help.

From the app.php config file, not my real key, but if it helps I can provide it.
'key' => env('12345678901234567890123456789012'),
'cipher' => 'rijndael-256',

Full stack trace:
[2016-11-16 23:36:14] production.ERROR: exception 'ErrorException' with message 'mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported' in /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Encryption/McryptEncrypter.php:104
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'mcrypt_encrypt(...', '/home/reman/pub...', 104, Array)
#1 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Encryption/McryptEncrypter.php(104): mcrypt_encrypt('rijndael-256', '', 's:40:"CYXsQK4tO...', 'cbc', 'x\xA8\xC8\xCDe\xA6 \x89\x96\x10\x1A(\xDEBF...')
#2 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Encryption/McryptEncrypter.php(77): Illuminate\Encryption\McryptEncrypter->padAndMcrypt('CYXsQK4tOjRpMFp...', 'x\xA8\xC8\xCDe\xA6 \x89\x96\x10\x1A(\xDEBF...')
#3 /home/reman/public_html/bootstrap/cache/compiled.php(13186): Illuminate\Encryption\McryptEncrypter->encrypt('CYXsQK4tOjRpMFp...')
#4 /home/reman/public_html/bootstrap/cache/compiled.php(13150): Illuminate\Cookie\Middleware\EncryptCookies->encrypt(Object(Illuminate\Http\RedirectResponse))
#5 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#6 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#7 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#8 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#9 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#10 /home/reman/public_html/bootstrap/cache/compiled.php(9948): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#11 /home/reman/public_html/bootstrap/cache/compiled.php(8226): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#12 /home/reman/public_html/bootstrap/cache/compiled.php(8217): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#13 /home/reman/public_html/bootstrap/cache/compiled.php(8207): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#14 /home/reman/public_html/bootstrap/cache/compiled.php(2419): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#15 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#16 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#17 /home/reman/public_html/vendor/fideloper/proxy/src/TrustProxies.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#18 [internal function]: Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#20 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#21 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 /home/reman/public_html/app/Http/Middleware/CheckForSetup.php(22): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#23 [internal function]: App\Http\Middleware\CheckForSetup->handle(Object(Illuminate\Http\Request), Object(Closure))
#24 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#25 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#26 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#27 /home/reman/public_html/app/Http/Middleware/NosniffGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#28 [internal function]: App\Http\Middleware\NosniffGuard->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#30 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#31 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#32 /home/reman/public_html/app/Http/Middleware/XssProtectHeader.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#33 [internal function]: App\Http\Middleware\XssProtectHeader->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#35 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#36 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#37 /home/reman/public_html/app/Http/Middleware/FrameGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#38 [internal function]: App\Http\Middleware\FrameGuard->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#40 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#41 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#42 /home/reman/public_html/bootstrap/cache/compiled.php(13474): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#43 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#45 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#46 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#47 /home/reman/public_html/bootstrap/cache/compiled.php(11964): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#48 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#50 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#51 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#52 /home/reman/public_html/vendor/misterphilip/maintenance-mode/src/MisterPhilip/MaintenanceMode/Http/Middleware/CheckForMaintenanceMode.php(145): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#53 [internal function]: MisterPhilip\MaintenanceMode\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#54 /home/reman/public_html/bootstrap/cache/compiled.php(9963): call_user_func_array(Array, Array)
#55 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#56 /home/reman/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#57 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#58 /home/reman/public_html/bootstrap/cache/compiled.php(9948): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#59 /home/reman/public_html/bootstrap/cache/compiled.php(2366): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#60 /home/reman/public_html/bootstrap/cache/compiled.php(2350): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#61 /home/reman/public_html/public/index.php(60): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#62 {main}

@snipe
Copy link
Owner

snipe commented Nov 17, 2016

From the app.php config file, not my real key, but if it helps I can provide it.
'key' => env('12345678901234567890123456789012'),
'cipher' => 'rijndael-256',

Nothing should be modified in the config/app.php - all of those variables are set in your .env file.

@snipe snipe closed this as completed Nov 17, 2016
@snipe
Copy link
Owner

snipe commented Nov 17, 2016

Also, if you're upgrading, you'll need to use mcrypt as your cipher (and make sure mcrypt is installed) if you have any encrypted custom fields or a stored LDAP password.

@Openclutch
Copy link
Author

Thanks for the fast response. Where would I find the .env file? I didn't see it in the upgrade instructions?

I don't think we use encrypted custom fields or LDAP so I don't think that would be an issue.

@snipe
Copy link
Owner

snipe commented Nov 17, 2016

@Openclutch
Copy link
Author

My bad... Sorry for wasting your time. I'll configure that and revert my changes from the app.php and it will probably work.

Thanks for the help!

@snipe
Copy link
Owner

snipe commented Nov 17, 2016

balloon-dance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants