@@ -33,8 +33,7 @@ class HubSetup {
33
33
publicUrl : 'https://domain.tld' ,
34
34
adminUser : 'admin' ,
35
35
adminPw : 'admin' ,
36
- syncerUser : 'syncer' , // TODO: randomize?
37
- syncerPw : HubSetup . uuid ( ) ,
36
+ systemClientSecret : HubSetup . uuid ( ) ,
38
37
}
39
38
}
40
39
}
@@ -113,7 +112,7 @@ ${e}`;
113
112
result += '# * KC_DB\n# * KC_HEALTH_ENABLED\n# * KC_HTTP_RELATIVE_PATH\n\n' ;
114
113
}
115
114
116
- result += '# Generated using script version 6 \n\n' ;
115
+ result += '# Generated using script version 7 \n\n' ;
117
116
118
117
return result ;
119
118
}
@@ -231,16 +230,6 @@ GRANT ALL PRIVILEGES ON DATABASE hub TO hub;`);
231
230
'realm-management' : [ 'realm-admin' ]
232
231
}
233
232
}
234
- } ,
235
- {
236
- name : 'syncer' ,
237
- description : 'syncer' ,
238
- composite : true ,
239
- composites : {
240
- client : {
241
- 'realm-management' : [ 'view-users' ]
242
- }
243
- }
244
233
}
245
234
] ,
246
235
} ,
@@ -253,13 +242,11 @@ GRANT ALL PRIVILEGES ON DATABASE hub TO hub;`);
253
242
realmRoles : [ 'admin' ]
254
243
} ,
255
244
{
256
- username : this . cfg . hub . syncerUser ,
257
- firstName : "syncer" ,
258
- lastName : "syncer" ,
259
- email : "syncer@localhost" ,
245
+ username : 'system' ,
246
+ email : "system@localhost" ,
260
247
enabled : true ,
261
- credentials : [ { type : 'password' , value : this . cfg . hub . syncerPw , temporary : false } ] ,
262
- realmRoles : [ 'syncer' ]
248
+ serviceAccountClientId : "cryptomatorhub-system" ,
249
+ clientRoles : { 'realm-management' : [ 'realm-admin' ] }
263
250
}
264
251
] ,
265
252
scopeMappings : [
@@ -325,6 +312,16 @@ GRANT ALL PRIVILEGES ON DATABASE hub TO hub;`);
325
312
frontchannelLogout : false ,
326
313
protocol : 'openid-connect' ,
327
314
attributes : { 'pkce.code.challenge.method' : 'S256' } ,
315
+ } ,
316
+ {
317
+ clientId : 'cryptomatorhub-system' ,
318
+ serviceAccountsEnabled : true ,
319
+ publicClient : false ,
320
+ name : 'Cryptomator Hub System' ,
321
+ enabled : true ,
322
+ clientAuthenticatorType : 'client-secret' ,
323
+ secret : this . cfg . hub . systemClientSecret ,
324
+ standardFlowEnabled : false ,
328
325
} ] ,
329
326
browserSecurityHeaders : {
330
327
contentSecurityPolicy : `frame-src 'self'; frame-ancestors 'self' ${ HubSetup . urlWithTrailingSlash ( this . cfg . hub . publicUrl ) } ; object-src 'none';`
@@ -431,7 +428,7 @@ EOF`;
431
428
'init-config' : { condition : 'service_completed_successfully' } ,
432
429
'postgres' : { condition : 'service_healthy' }
433
430
} ,
434
- image : 'ghcr.io/cryptomator/keycloak:24.0.4 ' ,
431
+ image : 'ghcr.io/cryptomator/keycloak:26.1.5 ' ,
435
432
command : startCmd ,
436
433
volumes : [ 'kc-config:/opt/keycloak/data/import' ] ,
437
434
deploy : {
@@ -441,7 +438,7 @@ EOF`;
441
438
} ,
442
439
...( ! this . cfg . compose . includeTraefik && { ports : [ `${ this . getPort ( this . cfg . keycloak . publicUrl ) } :8080` ] } ) ,
443
440
healthcheck : {
444
- test : [ 'CMD' , 'curl' , '-f' , `http://localhost:8080 ${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/live` ] ,
441
+ test : [ 'CMD' , 'curl' , '-f' , `http://localhost:9000 ${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/live` ] ,
445
442
interval : '60s' ,
446
443
timeout : '3s' ,
447
444
} ,
@@ -454,10 +451,10 @@ EOF`;
454
451
KC_DB_USERNAME : 'keycloak' ,
455
452
KC_DB_PASSWORD : this . cfg . db . keycloakPw ,
456
453
KC_HEALTH_ENABLED : 'true' ,
457
- KC_HOSTNAME : devMode ? null : this . getHostname ( this . cfg . keycloak . publicUrl ) ,
454
+ KC_HOSTNAME : devMode ? null : 'https://' + this . getHostname ( this . cfg . keycloak . publicUrl ) ,
458
455
// KC_HOSTNAME_PORT: devMode ? null : this.getPort(this.cfg.keycloak.publicUrl), // FIXME as string!! FIXME does not work at all!!
459
456
KC_HTTP_ENABLED : 'true' ,
460
- KC_PROXY : 'edge ' ,
457
+ KC_PROXY_HEADERS : 'xforwarded ' ,
461
458
KC_HTTP_RELATIVE_PATH : this . getPathname ( this . cfg . keycloak . publicUrl ) ,
462
459
} ,
463
460
...( this . cfg . compose . includeTraefik && this . getTraefikConfig ( this . cfg . keycloak . publicUrl , 'kc' ) )
@@ -478,7 +475,7 @@ EOF`;
478
475
} ,
479
476
...( ! this . cfg . compose . includeTraefik && { ports : [ `${ this . getPort ( this . cfg . hub . publicUrl ) } :8080` ] } ) ,
480
477
healthcheck : {
481
- test : [ 'CMD-SHELL' , '(curl -f http://localhost:8080 /q/health/live && curl -f http://localhost:8080/api/config) || exit 1' ] ,
478
+ test : [ 'CMD-SHELL' , '(curl -f http://localhost:9000 /q/health/live && curl -f http://localhost:8080/api/config) || exit 1' ] ,
482
479
interval : '10s' ,
483
480
timeout : '3s' ,
484
481
} ,
@@ -488,9 +485,8 @@ EOF`;
488
485
HUB_KEYCLOAK_PUBLIC_URL : this . cfg . keycloak . publicUrl ,
489
486
HUB_KEYCLOAK_LOCAL_URL : ! this . cfg . keycloak . useExternal ? `http://keycloak:8080${ this . getPathname ( this . cfg . keycloak . publicUrl ) } ` : this . cfg . keycloak . publicUrl ,
490
487
HUB_KEYCLOAK_REALM : this . cfg . keycloak . realmId ,
491
- HUB_KEYCLOAK_SYNCER_USERNAME : this . cfg . hub . syncerUser ,
492
- HUB_KEYCLOAK_SYNCER_PASSWORD : this . cfg . hub . syncerPw ,
493
- HUB_KEYCLOAK_SYNCER_CLIENT_ID : 'admin-cli' ,
488
+ HUB_KEYCLOAK_SYSTEM_CLIENT_ID : 'cryptomatorhub-system' ,
489
+ HUB_KEYCLOAK_SYSTEM_CLIENT_SECRET : this . cfg . hub . systemClientSecret ,
494
490
HUB_KEYCLOAK_SYNCER_PERIOD : '5m' , // TODO make configurable?
495
491
HUB_KEYCLOAK_OIDC_CRYPTOMATOR_CLIENT_ID : 'cryptomator' ,
496
492
QUARKUS_OIDC_AUTH_SERVER_URL : new URL ( `realms/${ this . cfg . keycloak . realmId } ` , HubSetup . urlWithTrailingSlash ( ! this . cfg . keycloak . useExternal ? `http://keycloak:8080${ this . getPathname ( this . cfg . keycloak . publicUrl ) } ` : this . cfg . keycloak . publicUrl ) ) . href , // network-internal URL
@@ -499,6 +495,7 @@ EOF`;
499
495
QUARKUS_DATASOURCE_JDBC_URL : 'jdbc:postgresql://postgres:5432/hub' ,
500
496
QUARKUS_DATASOURCE_USERNAME : 'hub' ,
501
497
QUARKUS_DATASOURCE_PASSWORD : this . cfg . db . hubPw ,
498
+ QUARKUS_HTTP_PROXY_PROXY_ADDRESS_FORWARDING : true ,
502
499
QUARKUS_HTTP_HEADER__CONTENT_SECURITY_POLICY__VALUE : `default-src 'self'; connect-src 'self' api.cryptomator.org ${ HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) } ; object-src 'none'; child-src 'self'; img-src * data:; frame-ancestors 'none'`
503
500
} ,
504
501
...( this . cfg . compose . includeTraefik && this . getTraefikConfig ( this . cfg . hub . publicUrl , 'hub' ) ) ,
@@ -608,8 +605,7 @@ class KubernetesConfigBuilder extends ConfigBuilder {
608
605
'db_admin_pass' : this . cfg . db . adminPw ,
609
606
'db_hub_pass' : this . cfg . db . hubPw ,
610
607
...( ! this . cfg . keycloak . useExternal ) && { 'db_kc_pass' : this . cfg . db . keycloakPw } ,
611
- 'hub_syncer_user' : this . cfg . hub . syncerUser ,
612
- 'hub_syncer_pass' : this . cfg . hub . syncerPw ,
608
+ 'hub_system_client_secret' : this . cfg . hub . systemClientSecret ,
613
609
'initdb.sql' : this . getInitDbSQL ( ) ,
614
610
...( ! this . cfg . keycloak . useExternal ) && { 'realm.json' : JSON . stringify ( realmCfg , null , 2 ) }
615
611
}
@@ -657,7 +653,7 @@ class KubernetesConfigBuilder extends ConfigBuilder {
657
653
args : [
658
654
'/bin/sh' ,
659
655
'-c' ,
660
- `set -x; while ! wget -q --spider "http://keycloak-svc:8080 ${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/live" 2>>/dev/null; do sleep 10; done`
656
+ `set -x; while ! wget -q --spider "http://keycloak-svc:9000 ${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/live" 2>>/dev/null; do sleep 10; done`
661
657
]
662
658
} ] : [ ] ) ] ,
663
659
containers : [ {
@@ -683,9 +679,8 @@ class KubernetesConfigBuilder extends ConfigBuilder {
683
679
{ name : 'HUB_KEYCLOAK_PUBLIC_URL' , value : this . cfg . keycloak . publicUrl } ,
684
680
{ name : 'HUB_KEYCLOAK_LOCAL_URL' , value : ! this . cfg . keycloak . useExternal ? `http://keycloak-svc:8080${ this . getPathname ( this . cfg . keycloak . publicUrl ) } ` : this . cfg . keycloak . publicUrl } ,
685
681
{ name : 'HUB_KEYCLOAK_REALM' , value : this . cfg . keycloak . realmId } ,
686
- { name : 'HUB_KEYCLOAK_SYNCER_USERNAME' , valueFrom : { secretKeyRef : { name : 'hub-secrets' , key : 'hub_syncer_user' } } } ,
687
- { name : 'HUB_KEYCLOAK_SYNCER_PASSWORD' , valueFrom : { secretKeyRef : { name : 'hub-secrets' , key : 'hub_syncer_pass' } } } ,
688
- { name : 'HUB_KEYCLOAK_SYNCER_CLIENT_ID' , value : 'admin-cli' } ,
682
+ { name : 'HUB_KEYCLOAK_SYSTEM_CLIENT_ID' , value : 'cryptomatorhub-system' } ,
683
+ { name : 'HUB_KEYCLOAK_SYSTEM_CLIENT_SECRET' , valueFrom : { secretKeyRef : { name : 'hub-secrets' , key : 'hub_system_client_secret' } } } ,
689
684
{ name : 'HUB_KEYCLOAK_SYNCER_PERIOD' , value : '5m' } , // TODO make configurable?
690
685
{ name : 'HUB_KEYCLOAK_OIDC_CRYPTOMATOR_CLIENT_ID' , value : 'cryptomator' } ,
691
686
{ name : 'QUARKUS_OIDC_AUTH_SERVER_URL' , value : new URL ( `realms/${ this . cfg . keycloak . realmId } ` , HubSetup . urlWithTrailingSlash ( ! this . cfg . keycloak . useExternal ? `http://keycloak-svc:8080${ this . getPathname ( this . cfg . keycloak . publicUrl ) } ` : this . cfg . keycloak . publicUrl ) ) . href } ,
@@ -694,6 +689,7 @@ class KubernetesConfigBuilder extends ConfigBuilder {
694
689
{ name : 'QUARKUS_DATASOURCE_JDBC_URL' , value : 'jdbc:postgresql://postgres-svc:5432/hub' } ,
695
690
{ name : 'QUARKUS_DATASOURCE_USERNAME' , value : 'hub' } ,
696
691
{ name : 'QUARKUS_DATASOURCE_PASSWORD' , valueFrom : { secretKeyRef : { name : 'hub-secrets' , key : 'db_hub_pass' } } } ,
692
+ { name : 'QUARKUS_HTTP_PROXY_PROXY_ADDRESS_FORWARDING' , value : 'true' } ,
697
693
...( this . cfg . keycloak . useExternal || this . getHostname ( this . cfg . hub . publicUrl ) != this . getHostname ( this . cfg . keycloak . publicUrl ) ? [ { name : 'QUARKUS_HTTP_HEADER__CONTENT_SECURITY_POLICY__VALUE' , value : `default-src 'self'; connect-src 'self' api.cryptomator.org ${ HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) } ; object-src 'none'; child-src 'self'; img-src * data:; frame-ancestors 'none'` } ] : [ ] )
698
694
]
699
695
} ]
@@ -775,11 +771,11 @@ class KubernetesConfigBuilder extends ConfigBuilder {
775
771
{ name : 'KC_DB_PASSWORD' , valueFrom : { secretKeyRef : { name : 'hub-secrets' , key : 'db_kc_pass' } } } ,
776
772
{ name : 'KC_HEALTH_ENABLED' , value : 'true' } ,
777
773
{ name : 'KC_HTTP_ENABLED' , value : 'true' } ,
778
- { name : 'KC_PROXY ' , value : 'edge ' } ,
774
+ { name : 'KC_PROXY_HEADERS ' , value : 'xforwarded ' } ,
779
775
{ name : 'KC_HTTP_RELATIVE_PATH' , value : this . getPathname ( this . cfg . keycloak . publicUrl ) }
780
776
] ;
781
777
if ( ! devMode ) {
782
- env . push ( { name : 'KC_HOSTNAME' , value : this . getHostname ( this . cfg . keycloak . publicUrl ) } ) ;
778
+ env . push ( { name : 'KC_HOSTNAME' , value : 'https://' + this . getHostname ( this . cfg . keycloak . publicUrl ) } ) ;
783
779
// env.push({name: 'KC_HOSTNAME_PORT', value: '' + this.getPort(this.cfg.keycloak.publicUrl)}); // FIXME as string!! FIXME does not work at all!!
784
780
}
785
781
let deployment = {
@@ -803,20 +799,20 @@ class KubernetesConfigBuilder extends ConfigBuilder {
803
799
} ] ,
804
800
containers : [ {
805
801
name : 'keycloak' ,
806
- image : 'ghcr.io/cryptomator/keycloak:24.0.4 ' ,
802
+ image : 'ghcr.io/cryptomator/keycloak:26.1.5 ' ,
807
803
command : startCmd ,
808
804
ports : [ { containerPort : 8080 } ] ,
809
805
resources : {
810
806
requests : { cpu : '25m' , memory : '512Mi' } ,
811
807
limits : { cpu : '1000m' , memory : '1024Mi' } ,
812
808
} ,
813
809
livenessProbe : {
814
- httpGet : { path : `${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/live` , port : 8080 } ,
810
+ httpGet : { path : `${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/live` , port : 9000 } ,
815
811
initialDelaySeconds : 120 ,
816
812
periodSeconds : 60
817
813
} ,
818
814
readinessProbe : {
819
- httpGet : { path : `${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/ready` , port : 8080 } ,
815
+ httpGet : { path : `${ this . getPathname ( HubSetup . urlWithTrailingSlash ( this . cfg . keycloak . publicUrl ) ) } health/ready` , port : 9000 } ,
820
816
initialDelaySeconds : 10 ,
821
817
periodSeconds : 3
822
818
} ,
0 commit comments