Skip to content

Commit d1eefc3

Browse files
authored
Merge pull request grokability#17692 from grokability/grokability#17387-make-saml-key-size-an-env
Fixed grokability#17386 - Added SAML key size to env - possible alternative to grokability#17387
2 parents eb17974 + 39e6223 commit d1eefc3

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,17 @@ LDAP_TIME_LIM=600
193193
IMPORT_TIME_LIMIT=600
194194
IMPORT_MEMORY_LIMIT=500M
195195
REPORT_TIME_LIMIT=12000
196-
REQUIRE_SAML=false
197196
API_THROTTLE_PER_MINUTE=120
198197
CSV_ESCAPE_FORMULAS=true
199198
LIVEWIRE_URL_PREFIX=null
200199

200+
201+
# --------------------------------------------
202+
# OPTIONAL: SAML SETTINGS
203+
# --------------------------------------------
204+
REQUIRE_SAML=false
205+
SAML_KEY_SIZE=2048
206+
201207
# --------------------------------------------
202208
# OPTIONAL: HASHING
203209
# --------------------------------------------

app/Http/Requests/SettingsSamlRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function withValidator($validator)
109109
];
110110

111111
$pkey = openssl_pkey_new([
112-
'private_key_bits' => 2048,
112+
'private_key_bits' => config('app.saml_key_size'),
113113
'private_key_type' => OPENSSL_KEYTYPE_RSA,
114114
]);
115115

config/app.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207

208208
/*
209209
|--------------------------------------------------------------------------
210-
| Require SAML Login
210+
| Require SAML Login
211211
|--------------------------------------------------------------------------
212212
|
213213
| Disable the ability to login via form login, and disables the 'nosaml'
@@ -220,6 +220,23 @@
220220

221221
'require_saml' => env('REQUIRE_SAML', false),
222222

223+
/*
224+
|--------------------------------------------------------------------------
225+
| SAML KEYS
226+
|--------------------------------------------------------------------------
227+
|
228+
| This is the size of the keys used by openssl_pkey_new for SAML authentication.
229+
| The default is 2048 bits, but this can be changed to 3072 or 4096 bits
230+
| for higher security. Note that this will increase the time it takes to
231+
| generate the keys, so it is not recommended to set this to a very high value
232+
| unless you have a specific need for it.
233+
|
234+
| The European Commission now requires at least 3072-bit keys for new SAML certificates
235+
| @link https://github.com/grokability/snipe-it/issues/17386
236+
*/
237+
238+
'saml_key_size' => env('SAML_KEY_SIZE', 2048),
239+
223240

224241
/*
225242
|--------------------------------------------------------------------------

0 commit comments

Comments
 (0)