Skip to content

Commit

Permalink
GDB-10780 Add GraphDB security configurations examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Nikolov committed Sep 2, 2024
1 parent d97e4a0 commit 3f49678
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
50 changes: 50 additions & 0 deletions examples/security/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Users provisioning
===

## Configuring the admin and provisioner

```yaml
security:
enabled: true
admin:
initialPassword: "{bcrypt}$2a$12$VDd8PrAndaJfoMJFlHFot.osSxZWQjMQZKgrEJgVZKFj6WFPvkbnS" # admin123
provisioner:
username: graphdb-provisioner
password: provisionerpass123
```
## Configuring extra users
```yaml
security:
enabled: true
initialUsers:
users:
tester:
username: tester
password: "{bcrypt}$2a$12$Ox/aDv4TpnVrMZPmCBNdbu1WI8ekuXiYWMuMie.fpHb.uWRukej1i" # password123
grantedAuthorities: [ "ROLE_USER" ]
```
**Note: The password for the additional user is created by appending the bcrypt-hashed version
of the password to the "{bcrypt}" string.**
## Configuring users by using a Secret
The Secret resource is defined in the [graphdb-users.yaml](./graphdb-users.yaml) file. It loads
the [users.js](./users.js) file as its content, which contains descriptions of all users. Each
user's password is stored by appending the bcrypt-hashed version of the password to the {bcrypt} string.
```yaml
security:
enabled: true
initialUsers:
existingSecret: "graphdb-users"
secretKey: users.js
```
#### Credentials
| Username | Password |
|----------|----------|
| admin | admin |
| tester | tester |
27 changes: 27 additions & 0 deletions examples/security/graphdb-users.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This YAML file defines a Kubernetes Secret named "graphdb-users."
# It stores the contents of the "users.js" file (located in the "files" directory)
# in base64-encoded format. This Secret securely provides sensitive data,
# such as configuration files, to Kubernetes pods.
#
# Place this Secret under the templates directory of the Helm chart.

apiVersion: v1
kind: Secret
metadata:
name: graphdb-users
stringData:
users.js: >
{
"users" : {
"admin" : {
"username" : "admin",
"password" : "{bcrypt}$2a$12$EgGOH5kMwtrmBooSu/iRnOSkP712nLYOdLNQsZZ2dvM28XTgzvSKq",
"grantedAuthorities" : [ "ROLE_ADMIN" ]
},
"tester": {
"username" : "tester",
"password" : "{bcrypt}$2a$12$MYBDxuw9ziuYwnOyYbt1P.yqzkG.ufxR3r7nw8QKuHa/Cu0gpnR5a",
"grantedAuthorities" : [ "ROLE_USER" ]
}
}
}

0 comments on commit 3f49678

Please sign in to comment.