Snipe It 4.0 Beta Production Error
Expected Behavior (or desired behavior if a feature request)
Testing a Snipe It 3.6.4 to 4.0 Upgrade
Actual Behavior
After upgrade and migration I get this error:
production.ERROR: exception 'ErrorException' with message 'openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating' in /opt/snipe-it/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:132 Stack trace:
Please confirm you have done the following before posting your bug report:
- [ ] I have enabled debug mode
- [x ] I have read checked the Common Issues page
Please provide answers to these questions before posting your bug report:
- Version of Snipe-IT you're running - 3.6.4
- What OS and web server you're running Snipe-IT on - CentOS 7.3
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) - Manual Install
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
- What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error - snipeit.domain.com
- If a stacktrace is provided in the error, include that too. production.ERROR: exception 'ErrorException' with message 'openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating' in /opt/snipe-it/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:132 Stack trace:
- Any errors that appear in your browser's error console. Whoops, looks like something went wrong
- Confirm whether the error is reproduceable on the demo.
- Include any additional information you can find in
app/storage/logsand your webserver's logs. - 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, brand new installation of Snipe It 3.6.4 (with zero assets) and testing the upgrade to 4.0 so I can do it later on the production server
It defaults to an OpenSSL cipher now (versus mcrypt, which is deprecated.) Try adding APP_CIPHER= with the 3.x cipher (yiu can find that in the config/app.php of your old 3.x files). Then clear your config cache
Grr. Sorry, that APP_CIPHER= blah should be added to your .env. I'm on my phone :(
@snipe thanks for your prompt reply! much appreciated! so i added APP=CIPER=
OPTIONAL: MISC
--------------------------------------------
APP_LOG=single APP_LOCKED=false FILESYSTEM_DISK=local APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1 ALLOW_IFRAMING=false APP_CIPHER=AES-256-CBC
then ran: php artisan config:clear php artisan config:cache
restarted apache but same error.... i did copy this .env file from my 3.x Snipe-IT folder because I read that you're not suppose to copy the APP_KEY as it should generate it by itself but what else can I try?
Thanks
I had this issue but myn was blank system so ran generate app key and all started to work guessing this shouldn't be done with system with data in
i have no data in this VM and i took a snapshot so i can always revert
i tried to generate a key : php artisa key:generate and it was successful but still can't open Snipe It:
[2017-08-14 09:38:17] production.ERROR: exception 'ErrorException' with message 'openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating' in /opt/snipe-it/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:132
ok so after i re ran the generate app key, i then re-ran all the upgrading commands restarted apache and voila!!! thanks @snazy2000 @snipe ^_^
Yeah, the issue is that regenerating the key will make any encrypted fields you have un-decryptable. We just pushed out a recrypter artisan command that should solve that issue, but we haven't tested it extensively yet.
If you have the latest from develop, you can try php artisan snipeit:legacy-recrypt to pull out any mcrypt-encrypted fields and re-encrypt them using the OpenSSL method.
I am having similar issues:
[root@SnipeTest snipeit]# su -s /bin/bash apache -c "php artisan snipeit:legacy-recrypt"
ERROR: You do not have a LEGACY_APP_KEY set in your .env file. Please locate your old APP_KEY and ADD a line to your .env file like: LEGACY_APP_KEY=YOUR_OLD_APP_KEY
@NCATS-Lab hey I think you need to generate the APP KEY all over again re-run the $ php artisa key:generate and then go through all the upgrading commands
php composer.phar install --no-dev --prefer-source php composer.phar dump-autoload php artisan migrate php artisan config:clear php artisan config:cache
I have the same error.
[2017-09-15 17:50:37] production.ERROR: exception 'ErrorException' with message 'openssl_decrypt(): IV passed is 32 bytes long which is longer than the 16 expected by selected cipher, truncating' in /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:132 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'openssl_decrypt...', '/opt/lampp/htdo...', 132, Array) #1 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(132): openssl_decrypt('j16nCjaEDWDtUIg...', 'AES-256-CBC', '\xF40\xF29G(I\7\xE1\xF0PJ!\x1A...', 0, 'B\xEF\x08\x10z\xCB\xE8\xC2\xB1\xE8<c\xCC\xAC\x90...') #2 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(95): Illuminate\Encryption\Encrypter->decrypt('eyJpdiI6IlF1OEl...') #3 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(76): Illuminate\Cookie\Middleware\EncryptCookies->decryptCookie('eyJpdiI6IlF1OEl...') #4 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Cookie\Middleware\EncryptCookies->decrypt(Object(Illuminate\Http\Request)) #5 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure)) #6 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #7 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #8 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Router.php(561): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #9 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Router.php(520): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #10 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Router.php(498): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #11 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(174): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #12 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request)) #13 /opt/lampp/htdocs/snipeitv4/vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(51): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #14 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Barryvdh\Debugbar\Middleware\Debugbar->handle(Object(Illuminate\Http\Request), Object(Closure)) #15 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #16 /opt/lampp/htdocs/snipeitv4/app/Http/Middleware/CheckForDebug.php(25): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #17 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\CheckForDebug->handle(Object(Illuminate\Http\Request), Object(Closure)) #18 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #19 /opt/lampp/htdocs/snipeitv4/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #20 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure)) #21 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #22 /opt/lampp/htdocs/snipeitv4/app/Http/Middleware/CheckForSetup.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #23 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\CheckForSetup->handle(Object(Illuminate\Http\Request), Object(Closure)) #24 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #25 /opt/lampp/htdocs/snipeitv4/app/Http/Middleware/NosniffGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #26 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\NosniffGuard->handle(Object(Illuminate\Http\Request), Object(Closure)) #27 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #28 /opt/lampp/htdocs/snipeitv4/app/Http/Middleware/XssProtectHeader.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #29 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\XssProtectHeader->handle(Object(Illuminate\Http\Request), Object(Closure)) #30 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #31 /opt/lampp/htdocs/snipeitv4/app/Http/Middleware/FrameGuard.php(17): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #32 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\FrameGuard->handle(Object(Illuminate\Http\Request), Object(Closure)) #33 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #34 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #35 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #36 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #37 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #38 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #39 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #40 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #41 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure)) #42 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request)) #43 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request)) #44 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(149): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #45 /opt/lampp/htdocs/snipeitv4/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) #46 /opt/lampp/htdocs/snipeitv4/public/index.php(59): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #47 {main}
This issue still persists, even with trying the regeneration
I have issue with recryption command The only supported ciphers are MCRYPT_RIJNDAEL_128 and MCRYPT_RIJNDAEL_256
.env settings are as below
APP_ENV=production APP_DEBUG=false APP_KEY=base64:6ffLMZuEgpZlKd5FgWYbUhjmiicUFtFCLIq1+80NmP4= LEGACY_APP_KEY=base64:Re4zxdQ+yXweGKCydgy8jZvlUCx3DDH9DTwl4lB1vVI= LEGACY_CIPHER=rijndael-256 APP_URL=null APP_TIMEZONE='UTC' APP_LOCALE=en
I have issue with recryption command The only supported ciphers are MCRYPT_RIJNDAEL_128 and MCRYPT_RIJNDAEL_256
I got the same problem, did you solve it?
I used old APP_KEY after that all ok