Skip to content

Commit

Permalink
fix(docker-jans): allow custom salt (#6551)
Browse files Browse the repository at this point in the history
  • Loading branch information
iromli committed Nov 13, 2023
1 parent f61dc21 commit b099469
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 19 deletions.
1 change: 1 addition & 0 deletions charts/janssen-all-in-one/README.md
Expand Up @@ -267,6 +267,7 @@ Kubernetes: `>=v1.22.0-0`
| resources.limits.memory | string | `"2500Mi"` | Memory limit. |
| resources.requests.cpu | string | `"2500m"` | CPU request. |
| resources.requests.memory | string | `"2500Mi"` | Memory request. |
| salt | string | `""` | Salt. Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value. |
| scim.appLoggers | object | `{"enableStdoutLogPrefix":"true","ldapStatsLogLevel":"INFO","ldapStatsLogTarget":"FILE","persistenceDurationLogLevel":"INFO","persistenceDurationLogTarget":"FILE","persistenceLogLevel":"INFO","persistenceLogTarget":"FILE","scimLogLevel":"INFO","scimLogTarget":"STDOUT","scriptLogLevel":"INFO","scriptLogTarget":"FILE"}` | App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed. |
| scim.appLoggers.enableStdoutLogPrefix | string | `"true"` | Enable log prefixing which enables prepending the STDOUT logs with the file name. i.e jans-scim ===> 2022-12-20 17:49:55,744 INFO |
| scim.appLoggers.ldapStatsLogLevel | string | `"INFO"` | jans-scim_persistence_ldap_statistics.log level |
Expand Down
3 changes: 2 additions & 1 deletion charts/janssen-all-in-one/templates/secret.yaml
Expand Up @@ -35,7 +35,8 @@ stringData:
{{- end }}
"auth_sig_keys": {{ index .Values "auth-server" "authSigKeys" | quote }},
"auth_enc_keys": {{ index .Values "auth-server" "authEncKeys" | quote }},
"optional_scopes": {{ list (include "janssen-all-in-one.optionalScopes" . | fromJsonArray | join ",") }}
"optional_scopes": {{ list (include "janssen-all-in-one.optionalScopes" . | fromJsonArray | join ",") }},
"salt": {{ .Values.salt | quote }}
}
{{ if or ( eq .Values.cnPersistenceType "couchbase" ) ( eq .Values.cnPersistenceType "hybrid" ) }}
Expand Down
2 changes: 2 additions & 0 deletions charts/janssen-all-in-one/values.yaml
Expand Up @@ -16,6 +16,8 @@ orgName: Janssen
state: TX
# -- Persistence backend to run Janssen with couchbase|hybrid|sql|spanner.
cnPersistenceType: sql
# -- Salt. Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value.
salt: ""
configmap:
# -- Jetty header size in bytes in the auth server
cnJettyRequestHeaderSize: 8192
Expand Down
3 changes: 2 additions & 1 deletion charts/janssen/README.md
Expand Up @@ -119,7 +119,7 @@ Kubernetes: `>=v1.22.0-0`
| casa.usrEnvs.secret | object | `{}` | Add custom secret envs to the service variable1: value1 |
| casa.volumeMounts | list | `[]` | Configure any additional volumesMounts that need to be attached to the containers |
| casa.volumes | list | `[]` | Configure any additional volumes that need to be attached to the pod |
| config | object | `{"additionalAnnotations":{},"additionalLabels":{},"adminPassword":"Test1234#","city":"Austin","configmap":{"cnAwsAccessKeyId":"","cnAwsDefaultRegion":"us-west-1","cnAwsProfile":"janssen","cnAwsSecretAccessKey":"","cnAwsSecretsEndpointUrl":"","cnAwsSecretsNamePrefix":"janssen","cnAwsSecretsReplicaRegions":[],"cnCacheType":"NATIVE_PERSISTENCE","cnConfigKubernetesConfigMap":"cn","cnCouchbaseBucketPrefix":"jans","cnCouchbaseCrt":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnCouchbaseIndexNumReplica":0,"cnCouchbasePassword":"P@ssw0rd","cnCouchbaseSuperUser":"admin","cnCouchbaseSuperUserPassword":"Test1234#","cnCouchbaseUrl":"cbjanssen.default.svc.cluster.local","cnCouchbaseUser":"janssen","cnGoogleProjectId":"google-project-to-save-config-and-secrets-to","cnGoogleSecretManagerServiceAccount":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnGoogleSecretNamePrefix":"janssen","cnGoogleSecretVersionId":"latest","cnGoogleSpannerDatabaseId":"","cnGoogleSpannerInstanceId":"","cnJettyRequestHeaderSize":8192,"cnLdapCrt":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnLdapKey":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnLdapUrl":"opendj:1636","cnMaxRamPercent":"75.0","cnPersistenceHybridMapping":"{}","cnRedisSentinelGroup":"","cnRedisSslTruststore":"","cnRedisType":"STANDALONE","cnRedisUrl":"redis.redis.svc.cluster.local:6379","cnRedisUseSsl":false,"cnScimProtectionMode":"OAUTH","cnSecretKubernetesSecret":"cn","cnSqlDbDialect":"mysql","cnSqlDbHost":"my-release-mysql.default.svc.cluster.local","cnSqlDbName":"jans","cnSqlDbPort":3306,"cnSqlDbSchema":"","cnSqlDbTimezone":"UTC","cnSqlDbUser":"jans","cnSqldbUserPassword":"Test1234#","lbAddr":""},"countryCode":"US","dnsConfig":{},"dnsPolicy":"","email":"support@jans.io","image":{"pullSecrets":[],"repository":"ghcr.io/janssenproject/jans/configurator","tag":"1.0.21_dev"},"ldapPassword":"P@ssw0rds","ldapTruststorePassword":"changeit","lifecycle":{},"orgName":"Janssen","redisPassword":"P@assw0rd","resources":{"limits":{"cpu":"300m","memory":"300Mi"},"requests":{"cpu":"300m","memory":"300Mi"}},"state":"TX","usrEnvs":{"normal":{},"secret":{}},"volumeMounts":[],"volumes":[]}` | Configuration parameters for setup and initial configuration secret and config layers used by Janssen services. |
| config | object | `{"additionalAnnotations":{},"additionalLabels":{},"adminPassword":"Test1234#","city":"Austin","configmap":{"cnAwsAccessKeyId":"","cnAwsDefaultRegion":"us-west-1","cnAwsProfile":"janssen","cnAwsSecretAccessKey":"","cnAwsSecretsEndpointUrl":"","cnAwsSecretsNamePrefix":"janssen","cnAwsSecretsReplicaRegions":[],"cnCacheType":"NATIVE_PERSISTENCE","cnConfigKubernetesConfigMap":"cn","cnCouchbaseBucketPrefix":"jans","cnCouchbaseCrt":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnCouchbaseIndexNumReplica":0,"cnCouchbasePassword":"P@ssw0rd","cnCouchbaseSuperUser":"admin","cnCouchbaseSuperUserPassword":"Test1234#","cnCouchbaseUrl":"cbjanssen.default.svc.cluster.local","cnCouchbaseUser":"janssen","cnGoogleProjectId":"google-project-to-save-config-and-secrets-to","cnGoogleSecretManagerServiceAccount":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnGoogleSecretNamePrefix":"janssen","cnGoogleSecretVersionId":"latest","cnGoogleSpannerDatabaseId":"","cnGoogleSpannerInstanceId":"","cnJettyRequestHeaderSize":8192,"cnLdapCrt":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnLdapKey":"SWFtTm90YVNlcnZpY2VBY2NvdW50Q2hhbmdlTWV0b09uZQo=","cnLdapUrl":"opendj:1636","cnMaxRamPercent":"75.0","cnPersistenceHybridMapping":"{}","cnRedisSentinelGroup":"","cnRedisSslTruststore":"","cnRedisType":"STANDALONE","cnRedisUrl":"redis.redis.svc.cluster.local:6379","cnRedisUseSsl":false,"cnScimProtectionMode":"OAUTH","cnSecretKubernetesSecret":"cn","cnSqlDbDialect":"mysql","cnSqlDbHost":"my-release-mysql.default.svc.cluster.local","cnSqlDbName":"jans","cnSqlDbPort":3306,"cnSqlDbSchema":"","cnSqlDbTimezone":"UTC","cnSqlDbUser":"jans","cnSqldbUserPassword":"Test1234#","lbAddr":""},"countryCode":"US","dnsConfig":{},"dnsPolicy":"","email":"support@jans.io","image":{"pullSecrets":[],"repository":"ghcr.io/janssenproject/jans/configurator","tag":"1.0.21_dev"},"ldapPassword":"P@ssw0rds","ldapTruststorePassword":"changeit","lifecycle":{},"orgName":"Janssen","redisPassword":"P@assw0rd","resources":{"limits":{"cpu":"300m","memory":"300Mi"},"requests":{"cpu":"300m","memory":"300Mi"}},"salt":"","state":"TX","usrEnvs":{"normal":{},"secret":{}},"volumeMounts":[],"volumes":[]}` | Configuration parameters for setup and initial configuration secret and config layers used by Janssen services. |
| config-api | object | `{"additionalAnnotations":{},"additionalLabels":{},"dnsConfig":{},"dnsPolicy":"","hpa":{"behavior":{},"enabled":true,"maxReplicas":10,"metrics":[],"minReplicas":1,"targetCPUUtilizationPercentage":50},"image":{"pullPolicy":"IfNotPresent","pullSecrets":[],"repository":"ghcr.io/janssenproject/jans/config-api","tag":"1.0.21_dev"},"lifecycle":{},"livenessProbe":{"httpGet":{"path":"/jans-config-api/api/v1/health/live","port":8074},"initialDelaySeconds":30,"periodSeconds":30,"timeoutSeconds":5},"pdb":{"enabled":true,"maxUnavailable":"90%"},"readinessProbe":{"httpGet":{"path":"jans-config-api/api/v1/health/ready","port":8074},"initialDelaySeconds":25,"periodSeconds":25,"timeoutSeconds":5},"replicas":1,"resources":{"limits":{"cpu":"1000m","memory":"1000Mi"},"requests":{"cpu":"1000m","memory":"1000Mi"}},"topologySpreadConstraints":{},"usrEnvs":{"normal":{},"secret":{}},"volumeMounts":[],"volumes":[]}` | Config Api endpoints can be used to configure the auth-server, which is an open-source OpenID Connect Provider (OP) and UMA Authorization Server (AS). |
| config-api.additionalAnnotations | object | `{}` | Additional annotations that will be added across the gateway in the format of {cert-manager.io/issuer: "letsencrypt-prod"} |
| config-api.additionalLabels | object | `{}` | Additional labels that will be added across the gateway in the format of {mylabel: "myapp"} |
Expand Down Expand Up @@ -205,6 +205,7 @@ Kubernetes: `>=v1.22.0-0`
| config.resources.limits.memory | string | `"300Mi"` | Memory limit. |
| config.resources.requests.cpu | string | `"300m"` | CPU request. |
| config.resources.requests.memory | string | `"300Mi"` | Memory request. |
| config.salt | string | `""` | Salt. Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value. |
| config.state | string | `"TX"` | State code. Used for certificate creation. |
| config.usrEnvs | object | `{"normal":{},"secret":{}}` | Add custom normal and secret envs to the service. |
| config.usrEnvs.normal | object | `{}` | Add custom normal envs to the service. variable1: value1 |
Expand Down
1 change: 1 addition & 0 deletions charts/janssen/charts/config/README.md
Expand Up @@ -96,6 +96,7 @@ Kubernetes: `>=v1.22.0-0`
| resources.limits.memory | string | `"300Mi"` | Memory limit. |
| resources.requests.cpu | string | `"300m"` | CPU request. |
| resources.requests.memory | string | `"300Mi"` | Memory request. |
| salt | string | `""` | Salt. Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value. |
| state | string | `"TX"` | State code. Used for certificate creation. |
| usrEnvs | object | `{"normal":{},"secret":{}}` | Add custom normal and secret envs to the service. |
| usrEnvs.normal | object | `{}` | Add custom normal envs to the service. variable1: value1 |
Expand Down
3 changes: 2 additions & 1 deletion charts/janssen/charts/config/templates/secrets.yaml
Expand Up @@ -35,7 +35,8 @@ stringData:
{{- end }}
"auth_sig_keys": {{ index .Values "global" "auth-server" "authSigKeys" | quote }},
"auth_enc_keys": {{ index .Values "global" "auth-server" "authEncKeys" | quote }},
"optional_scopes": {{ list (include "config.optionalScopes" . | fromJsonArray | join ",") }}
"optional_scopes": {{ list (include "config.optionalScopes" . | fromJsonArray | join ",") }},
"salt": {{ .Values.salt | quote }}
}
{{ if or ( eq .Values.global.cnPersistenceType "couchbase" ) ( eq .Values.global.cnPersistenceType "hybrid" ) }}
Expand Down
2 changes: 2 additions & 0 deletions charts/janssen/charts/config/values.yaml
Expand Up @@ -12,6 +12,8 @@ usrEnvs:
adminPassword: Test1234#
# -- City. Used for certificate creation.
city: Austin
# -- Salt. Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value.
salt: ""
configmap:
# -- Jetty header size in bytes in the auth server
cnJettyRequestHeaderSize: 8192
Expand Down
5 changes: 5 additions & 0 deletions charts/janssen/values.schema.json
Expand Up @@ -32,6 +32,11 @@
"type": "string",
"pattern": "^[a-zA-Z]+$"
},
"salt": {
"description": "Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value.",
"type": "string",
"pattern": "^(?:[a-zA-Z0-9]{24})?$"
},
"configmap": {
"description": "Configuration parameters mapped to envs in a ConfigMap",
"type": "object",
Expand Down
2 changes: 2 additions & 0 deletions charts/janssen/values.yaml
Expand Up @@ -173,6 +173,8 @@ config:
adminPassword: Test1234#
# -- City. Used for certificate creation.
city: Austin
# -- Salt. Used for encoding/decoding sensitive data. If omitted or set to empty string, the value will be self-generated. Otherwise, a 24 alphanumeric characters are allowed as its value.
salt: ""
configmap:
# -- Jetty header size in bytes in the auth server
cnJettyRequestHeaderSize: 8192
Expand Down
16 changes: 8 additions & 8 deletions docker-jans-all-in-one/Dockerfile
Expand Up @@ -4,14 +4,14 @@

# the following ARGs set default base images
# they can be overriden in build process via --build-arg option
ARG JANS_CONFIGURATOR_IMAGE=ghcr.io/janssenproject/jans/configurator:1.0.21-SNAPSHOT_dev
ARG JANS_PERSISTENCE_LOADER_IMAGE=ghcr.io/janssenproject/jans/persistence-loader:1.0.21-SNAPSHOT_dev
ARG JANS_AUTH_IMAGE=ghcr.io/janssenproject/jans/auth-server:1.0.21-SNAPSHOT_dev
ARG JANS_CONFIG_API_IMAGE=ghcr.io/janssenproject/jans/config-api:1.0.21-SNAPSHOT_dev
ARG JANS_FIDO2_IMAGE=ghcr.io/janssenproject/jans/fido2:1.0.21-SNAPSHOT_dev
ARG JANS_SCIM_IMAGE=ghcr.io/janssenproject/jans/scim:1.0.21-SNAPSHOT_dev
ARG JANS_CASA_IMAGE=ghcr.io/janssenproject/jans/casa:1.0.21-SNAPSHOT_dev
ARG JANS_LINK_IMAGE=ghcr.io/janssenproject/jans/link:1.0.21-SNAPSHOT_dev
ARG JANS_CONFIGURATOR_IMAGE=ghcr.io/janssenproject/jans/configurator:1.0.21_dev
ARG JANS_PERSISTENCE_LOADER_IMAGE=ghcr.io/janssenproject/jans/persistence-loader:1.0.21_dev
ARG JANS_AUTH_IMAGE=ghcr.io/janssenproject/jans/auth-server:1.0.21_dev
ARG JANS_CONFIG_API_IMAGE=ghcr.io/janssenproject/jans/config-api:1.0.21_dev
ARG JANS_FIDO2_IMAGE=ghcr.io/janssenproject/jans/fido2:1.0.21_dev
ARG JANS_SCIM_IMAGE=ghcr.io/janssenproject/jans/scim:1.0.21_dev
ARG JANS_CASA_IMAGE=ghcr.io/janssenproject/jans/casa:1.0.21_dev
ARG JANS_LINK_IMAGE=ghcr.io/janssenproject/jans/link:1.0.21_dev

# original Janssen version
ARG CN_VERSION=1.0.21-SNAPSHOT
Expand Down
17 changes: 9 additions & 8 deletions docker-jans-configurator/scripts/parameter.py
Expand Up @@ -81,14 +81,7 @@ class Meta:

auth_enc_keys = Str(missing="")

salt = Str(
validate=[
Length(equal=24),
Predicate("isalnum", error="Only alphanumeric characters are allowed"),
],
missing="",
default="",
)
salt = Str()

@validates("hostname")
def validate_fqdn(self, value):
Expand Down Expand Up @@ -131,6 +124,14 @@ def validate_ext_persistence_pw(self, data, **kwargs):
if err:
raise ValidationError(err)

@validates("salt")
def validate_salt(self, value):
if value and len(value) != 24:
raise ValidationError("Length must be 24.")

if value and not value.isalnum():
raise ValidationError("Only alphanumeric characters are allowed")


def params_from_file(path):
out = {}
Expand Down

0 comments on commit b099469

Please sign in to comment.