diff --git a/app/Console/Commands/UpdateKey.php b/app/Console/Commands/UpdateKey.php index 2ec8f4bc3bc5..4bf51c28ef2e 100644 --- a/app/Console/Commands/UpdateKey.php +++ b/app/Console/Commands/UpdateKey.php @@ -70,7 +70,8 @@ class UpdateKey extends Command $key = str_random(32); } - $crypt = new Encrypter($key, config('app.cipher')); + $cipher = $legacy ? 'AES-256-CBC' : config('app.cipher'); + $crypt = new Encrypter($key, $cipher); // update values using the new key/encrypter foreach (AccountGateway::all() as $gateway) { @@ -85,11 +86,21 @@ class UpdateKey extends Command $bank->save(); } + $message = date('r') . ' Successfully updated '; if ($envWriteable) { - $this->info(date('r') . ' Successfully update the key'); + if ($legacy) { + $message .= 'the key, set the cipher in the .env file to AES-256-CBC'; + } else { + $message .= 'the key'; + } } else { - $this->info(date('r') . ' Successfully update data, make sure to set the new app key: ' . $key); + if ($legacy) { + $message .= 'the data, make sure to set the new cipher/key: AES-256-CBC/' . $key; + } else { + $message .= 'the data, make sure to set the new key: ' . $key; + } } + $this->info($message); } /** diff --git a/app/Listeners/HandleUserLoggedIn.php b/app/Listeners/HandleUserLoggedIn.php index 9ac0c2f235f4..9eee5232041c 100644 --- a/app/Listeners/HandleUserLoggedIn.php +++ b/app/Listeners/HandleUserLoggedIn.php @@ -101,6 +101,8 @@ class HandleUserLoggedIn // warn if using the default app key if (in_array(config('app.key'), ['SomeRandomString', 'SomeRandomStringSomeRandomString', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'])) { Session::flash('error', trans('texts.error_app_key_set_to_default')); + } elseif (in_array($appCipher, ['MCRYPT_RIJNDAEL_256', 'MCRYPT_RIJNDAEL_128'])) { + Session::flash('error', trans('texts.mcrypt_warning')); } } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 03d3ec6a93d8..25b6ca123309 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2602,6 +2602,7 @@ $LANG = array( 'unable_to_delete_primary' => 'Note: to delete this company first delete all linked companies.', 'please_register' => 'Please register your account', 'processing_request' => 'Processing request', + 'mcrypt_warning' => 'Warning: Mcrypt is deprecated, run php artisan ninja:update-key --legacy=true to update your cipher.', );