@@ -27,6 +27,8 @@ CERT_PATH=
27
27
CERT_UPDATE_COMMAND=
28
28
STUNNEL_CAFILE=
29
29
30
+ ssl_version=
31
+
30
32
# TODO: Might have to use portmap entry in future to determine the CONNECT_PORT for nfsv3.
31
33
CONNECT_PORT=2049
32
34
@@ -184,12 +186,13 @@ add_stunnel_configuration()
184
186
return 1
185
187
fi
186
188
187
- # TODO: Change to TLSv1.3 once we have TLSv1.3 version enabled.
188
- echo " sslVersion = TLSv1.2" >> $stunnel_conf_file
189
- if [ $? -ne 0 ]; then
190
- chattr -f +i $stunnel_conf_file
191
- eecho " Failed to add sslVersion option to $stunnel_conf_file !"
192
- return 1
189
+ if [ -n " $ssl_version " ]; then
190
+ echo " sslVersion = TLSv${ssl_version} " >> $stunnel_conf_file
191
+ if [ $? -ne 0 ]; then
192
+ chattr -f +i $stunnel_conf_file
193
+ eecho " Failed to add sslVersion option to $stunnel_conf_file !"
194
+ return 1
195
+ fi
193
196
fi
194
197
195
198
echo " debug = $DEBUG_LEVEL " >> $stunnel_conf_file
@@ -308,6 +311,27 @@ tls_nfsv4_files_share_mount()
308
311
local container
309
312
local extra
310
313
314
+ # Check if user has provided SSLVersion in the mount options.
315
+ if [[ " $MOUNT_OPTIONS " == * " tls" * ]]; then
316
+
317
+ ssl_version=$( echo " $MOUNT_OPTIONS " | grep -oE ' tls=[^,]+' | awk -F= ' {print $2}' )
318
+
319
+ # Check if SSL version is either 1.2 or 1.3
320
+ if [[ " $ssl_version " == " 1.2" || " $ssl_version " == " 1.3" ]]; then
321
+ echo " TLS version option: $ssl_version "
322
+ else
323
+ echo " No valid TLS version. Please provide a valid TLS version (1.2 or 1.3)."
324
+ exit 1
325
+ fi
326
+
327
+ # Remove the tls option from MOUNT_OPTIONS.
328
+ if [[ " $MOUNT_OPTIONS " == * " tls=${ssl_version} ," * ]]; then
329
+ MOUNT_OPTIONS=${MOUNT_OPTIONS// tls=$ssl_version ,/ }
330
+ else
331
+ MOUNT_OPTIONS=${MOUNT_OPTIONS// ,tls=$ssl_version / }
332
+ fi
333
+ fi
334
+
311
335
# Set trap to cleanup the lock on mountmap file on exit.
312
336
trap ' cleanup' EXIT
313
337
0 commit comments