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

Upgrade from v2.0.4 -> v2.0.6 Results in 500 Error #1399

Closed
moterpent opened this issue Nov 26, 2015 · 10 comments
Closed

Upgrade from v2.0.4 -> v2.0.6 Results in 500 Error #1399

moterpent opened this issue Nov 26, 2015 · 10 comments

Comments

@moterpent
Copy link

After upgrading from v2.0.4, receive a 500 error upon trying to log in.

Process:

  1. Change into install directory
  2. Run "git pull"
  3. Run "php composer.phar install"
  4. Run "php composer.phar dump-autoload"
  5. Run "php artisan migrate"
  6. Connect to web page (initial login page is fine). Enter credentials.
  7. Receive 500 message.

Version: v2.0.4 (upgrading to 2.0.6)

OS: CentOS Linux release 7.1.1503 (Core)

Error: 500 - Invalid Data

Open: /data/web/snipe/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php

$payload = json_decode(base64_decode($payload), true);

// If the payload is not valid JSON or does not have the proper keys set we will
// assume it is invalid and bail out of the routine since we will not be able
// to decrypt the given value. We'll also check the MAC for this encryption.
if ( ! $payload || $this->invalidPayload($payload))
{
throw new DecryptException('Invalid data.');
}

Stack Trace:

[23:11:56] LOG.error: exception 'Illuminate\Encryption\DecryptException' with message 'Invalid data.' in /data/web/snipe/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:139
Stack trace:
#0 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(89): Illuminate\Encryption\Encrypter->getJsonPayload(NULL)
#1 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(208): Illuminate\Encryption\Encrypter->decrypt(NULL)
#2 /data/web/snipe/app/controllers/AuthController.php(36): Illuminate\Support\Facades\Facade::__callStatic('decrypt', Array)
#3 /data/web/snipe/app/controllers/AuthController.php(36): Illuminate\Support\Facades\Crypt::decrypt(NULL)
#4 /data/web/snipe/app/controllers/AuthController.php(172): AuthController->ldap('merickson', 'eth$shar11')
#5 [internal function]: AuthController->postSignin()
#6 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#7 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('postSignin', Array)
#8 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(AuthController), Object(Illuminate\Routing\Route), 'postSignin')
#9 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postSignin')
#10 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}()
#11 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#12 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#13 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#14 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#15 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#16 /data/web/snipe/vendor/barryvdh/laravel-debugbar/src/Middleware/Stack.php(34): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#17 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Barryvdh\Debugbar\Middleware\Stack->handle(Object(Illuminate\Http\Request), 1, true)
#18 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#19 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#20 /data/web/snipe/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#21 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#22 /data/web/snipe/public/index.php(49): Illuminate\Foundation\Application->run()
#23 {main}

errorlog

Log:

==> log-apache2handler-2015-11-25.txt <==
[2015-11-25 23:15:46] production.DEBUG: Authenticating user against LDAP. [] []
[2015-11-25 23:15:46] production.ERROR: exception 'Illuminate\Encryption\DecryptException' with message 'Invalid data.' in /data/web/snipe/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:139
Stack trace:
#0 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(89): Illuminate\Encryption\Encrypter->getJsonPayload(NULL)
#1 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(208): Illuminate\Encryption\Encrypter->decrypt(NULL)
#2 /data/web/snipe/app/controllers/AuthController.php(36): Illuminate\Support\Facades\Facade::__callStatic('decrypt', Array)
#3 /data/web/snipe/app/controllers/AuthController.php(36): Illuminate\Support\Facades\Crypt::decrypt(NULL)
#4 /data/web/snipe/app/controllers/AuthController.php(172): AuthController->ldap('merickson', 'eth$shar11')
#5 [internal function]: AuthController->postSignin()
#6 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#7 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('postSignin', Array)
#8 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(AuthController), Object(Illuminate\Routing\Route), 'postSignin')
#9 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postSignin')
#10 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}()
#11 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#12 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#13 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#14 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#15 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#16 /data/web/snipe/vendor/barryvdh/laravel-debugbar/src/Middleware/Stack.php(34): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#17 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Barryvdh\Debugbar\Middleware\Stack->handle(Object(Illuminate\Http\Request), 1, true)
#18 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#19 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#20 /data/web/snipe/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#21 /data/web/snipe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#22 /data/web/snipe/public/index.php(49): Illuminate\Foundation\Application->run()
#23 {main} [] []

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

Are you using LDAP to authenticate, or just regular system users?

@moterpent
Copy link
Author

There are both types though we typically have been using active directory backed ldap accounts after initial installation. I believe the original built-in, local admin account was still functional pre-upgrade.

The 500 message / output appears consistent regardless of the type of user or even whether or not credentials are even for a valid user and/or password.

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

Did you update the LDAP settings in the admin panel post-upgrade? We've made that a DB setting now instead of a config file option.

Although as you're describing this, if you ended up logged out if Snipe-IT before you upgraded, you wouldn't be able to change those settings. Argh. That's our bad. If you can enter them directly in the database settings table, that should work. Otherwise I'll have a patch out within 24 hours. I'm logged in all the time, so it didn't even occur to me.

@moterpent
Copy link
Author

Yeah, unfortunately no account logged in at the time of upgrade.

I'll take a look at the settings table and see if I can piece together a functional row to get it up and working. Thanks in advance for the patch as well.

As always thank you for the quick response. It's above and beyond, and very much appreciated.

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

The settings table only has one row - any field that starts with ldap_ is one you want to edit.

Thank you for the kind words. I'm really sorry about this oversight. I boned this one, and I'll have a fix out as soon as I'm back at my keyboard. I'm usually more careful than that. I don't have access to an LDAP server (other than public test servers), so I didn't think this through to your scenario. :-/

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

(Also, best bug report ever. I wish they were all so detailed.)

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

I'm only able to reproduce this error when the username is wrong - is this happening for you regardless of username entered?

@moterpent
Copy link
Author

Doh. You are right. I must have been putting in the local/basic user account name incorrectly last night. My bad. Amazing what a little sleep can do.

I was able to log in with the initial local admin account. I then filled out the ldap config form with the contents from base_dir/app/config/production/ldap.php. I seem to be able to log in with AD users again.

Thank you for the help. Best open project support experience ever!

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

Hah, I know how that is, no worries. (And thanks for the kind words!)

I'm working on a migration right now that will import LDAP settings and archive the old LDAP config file. I'll be careful not to let it overwrite your existing DB stuff, since you're caught between the release and the patch.

@snipe
Copy link
Owner

snipe commented Nov 26, 2015

This fix is now on master and develop. @moterpent, this shouldn't affect you, since you've already updated your settings in the database. It does a check to see if there's an LDAP config and if there is a value in the database:

if ((Config::get('ldap.url')) && ($settings->ldap_server=='')) {
...
}

So it should basically bypass the the import, since the second condition will not be met.

Anyone else having this issue, please pull from master and run migrations.

@snipe snipe closed this as completed in 989ce59 Nov 26, 2015
@snipe snipe removed the in progress label Nov 26, 2015
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