Skip to content

Commit

Permalink
GDB-10752 Add password hash for the security provisioner
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Nikolov committed Sep 9, 2024
1 parent f193bc8 commit eb757d1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
- Local backups support saving the GraphDB backup archives in volume from an existing persistent volume claim, configured
with `backup.local`
- Cloud backups support uploading the GraphDB backup archives in one of the supported cloud object storage services, configured
with `backup.cloud`
- Added a new example under [examples/backup-local](examples/backup-local) showing how to use the local backup feature
with `backup.cloud`
- Added a new property - `security.provisioner.passwordHash`

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion files/config/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{- include "grahdb.security.extra-users.json" . | nindent 4 }}
"{{ .Values.security.provisioner.username }}" : {
"username" : "{{ .Values.security.provisioner.username }}",
"password" : "{bcrypt}{{ htpasswd .Values.security.provisioner.username .Values.security.provisioner.password | trimPrefix (printf "%s:" .Values.security.provisioner.username) }}",
"password" : {{ .Values.security.provisioner.passwordHash | default ( include "graphdb.security.provisioner.passwordHash" . ) | quote }},
"grantedAuthorities" : [ "ROLE_ADMIN" ],
"appSettings" : {
"DEFAULT_INFERENCE" : true,
Expand Down
7 changes: 7 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,10 @@ Converts custom users YAML to a pretty JSON for insertion in users.js
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Calculate provisoner's bcrypt-hashed password
*/}}
{{- define "graphdb.security.provisioner.passwordHash" -}}
{{- printf "{bcrypt}%s" ( htpasswd .Values.security.provisioner.username .Values.security.provisioner.password | trimPrefix (printf "%s:" .Values.security.provisioner.username)) -}}
{{- end -}}
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ security:
# Note: The user is created regardless of if the existingSecret is provided or not.
username: provisioner
password: iHaveSuperpowers
# Define an initial password for the provisioner user as a bcrypt hash.
# If the password is not specified, it will use the default one specified in the provisioner.password.
# Important: This value must be a bcrypt encrypted hash, not a plaintext string. The format is "{bcrypt}<the-encrypted-hash>"
passwordHash: ""
# Reference to Secret with a basic authentication token of an existing user to use for provisioning tasks instead of the default user in the initial
# user.js that is created using the plaintext username and password configurations from above.
# Note that the user must already exist in GraphDB for this to work properly.
Expand Down

0 comments on commit eb757d1

Please sign in to comment.