Merge "[COMMON] Allow to set default password complexity"
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 7 Sep 2020 07:53:28 +0000 (07:53 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 7 Sep 2020 07:53:28 +0000 (07:53 +0000)
kubernetes/common/common/templates/_createPassword.tpl
kubernetes/onap/values.yaml

index 8b2f1e2..bfa96da 100644 (file)
   {{ end }}
 {{- end -}}
 
+{{- define "common._defaultPasswordStrength" -}}
+  {{ if .Values.passwordStrengthOverride }}
+    {{- printf "%s" .Values.passwordStrengthOverride -}}
+  {{ else if .Values.global.passwordStrength }}
+    {{- printf "%s" .Values.global.passwordStrength -}}
+  {{ else if .Values.passwordStrength }}
+    {{- printf "%s" .Values.passwordStrength -}}
+  {{ else }}
+    {{- printf "long" }}
+  {{ end }}
+{{- end -}}
+
 {{/*
   Generate a new password based on masterPassword. The new password is not
   random, it is derived from masterPassword, fully qualified chart name and
@@ -59,7 +71,8 @@
 {{- define "common.createPassword" -}}
   {{- $dot := default . .dot -}}
   {{- $uid := default "onap" .uid -}}
-  {{- $strength := default "long" .strength -}}
+  {{- $defaultStrength := include "common._defaultPasswordStrength" $dot | trim -}}
+  {{- $strength := default $defaultStrength .strength -}}
   {{- $mp := include "common.masterPassword" $dot -}}
   {{- derivePassword 1 $strength $mp (include "common.fullname" $dot) $uid -}}
 {{- end -}}
index 394c0b4..9928e93 100755 (executable)
@@ -89,6 +89,11 @@ global:
   # flag to enable debugging - application support required
   debugEnabled: false
 
+  # default password complexity
+  # available options: phrase, name, pin, basic, short, medium, long, maximum security
+  # More datails: https://masterpassword.app/masterpassword-algorithm.pdf
+  passwordStrength: long
+
   # configuration to set log level to all components (the one that are using
   # "common.log.level" to set this)
   # can be overrided per components by setting logConfiguration.logLevelOverride