From 809e31056528be1da90142e435b9cd3af9ac7543 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Oct 2017 08:15:23 -0700 Subject: [PATCH] Recrypt the LDAP password properly Older installs should add a line to their .env: `LEGACY_CIPHER=rijndael-256` --- app/Console/Commands/RecryptFromMcrypt.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/RecryptFromMcrypt.php b/app/Console/Commands/RecryptFromMcrypt.php index 60599bafae..bb38f098f9 100644 --- a/app/Console/Commands/RecryptFromMcrypt.php +++ b/app/Console/Commands/RecryptFromMcrypt.php @@ -93,15 +93,19 @@ class RecryptFromMcrypt extends Command } - if($legacy_cipher){ + if ($legacy_cipher){ $mcrypter = new McryptEncrypter($legacy_key,$legacy_cipher); }else{ $mcrypter = new McryptEncrypter($legacy_key); } $settings = Setting::getSettings(); - if ($settings->ldap_password=='') { + if ($settings->ldap_pword=='') { $this->comment('INFO: No LDAP password found. Skipping... '); + } else { + $decrypted_ldap_pword = $mcrypter->decrypt($settings->ldap_pword); + $settings->ldap_pword = \Crypt::encrypt($decrypted_ldap_pword); + $settings->save(); } /** @var CustomField[] $custom_fields */ $custom_fields = CustomField::where('field_encrypted','=', 1)->get();