Problem
opencloud init generates random passwords for all internal secrets (IDM service passwords, JWT, transfer secrets, etc.) and provides no mechanism to inject pre-defined values via environment variables.
In containerized deployments (Kubernetes, Docker), this means:
- Every pod restart with an empty config dir generates new random secrets
- IDM (LDAP) service passwords written during init no longer match what services use at runtime
- This causes
LDAP bind failures and broken authentication after any restart without config volume persistence
Only --admin-password is exposed as a CLI flag. The 12 other secrets have no override mechanism.
Affected secrets
| Secret |
Config field |
Proposed ENV var |
| IDM service password |
idm.service_user_config.password |
IDM_SVC_PASSWORD |
| IDM Reva service password |
idm.service_user_config.reva_password |
IDM_REVASVC_PASSWORD |
| IDM IDP service password |
idm.service_user_config.idp_password |
IDM_IDPSVC_PASSWORD |
| Admin password |
admin_password |
OC_ADMIN_PASSWORD |
| JWT secret |
token_manager.jwt_secret |
OC_JWT_SECRET |
| Machine auth API key |
machine_auth_api_key |
OC_MACHINE_AUTH_API_KEY |
| Transfer secret |
transfer_secret |
OC_TRANSFER_SECRET |
| Service account secret |
service_account.service_account_secret |
OC_SERVICE_ACCOUNT_SECRET |
| WOPI secret |
collaboration.wopi.wopi_src_secret |
COLLABORATION_WOPI_SECRET |
| System user API key |
system_user_api_key |
SYSTEM_USER_API_KEY |
| URL signing secret |
n/a |
OC_URL_SIGNING_SECRET |
| Thumbnails transfer secret |
n/a |
THUMBNAILS_TRANSFER_SECRET |
Proposed fix
Add a helper in opencloud/pkg/init/ that checks for the corresponding environment variable before falling back to random generation:
func secretFromEnvOrRandom(envVar string, length int) (string, error) {
if v := os.Getenv(envVar); v != "" {
return v, nil
}
return generators.GenerateRandomPassword(length)
}
This is fully backward-compatible: when no ENV var is set, behavior is identical to today.
Use case
Helm charts and container orchestrators can inject stable, pre-defined secrets via Kubernetes Secrets → ENV vars, eliminating the need for config volume persistence and ensuring LDAP credentials remain consistent across restarts.
Problem
opencloud initgenerates random passwords for all internal secrets (IDM service passwords, JWT, transfer secrets, etc.) and provides no mechanism to inject pre-defined values via environment variables.In containerized deployments (Kubernetes, Docker), this means:
LDAP bindfailures and broken authentication after any restart without config volume persistenceOnly
--admin-passwordis exposed as a CLI flag. The 12 other secrets have no override mechanism.Affected secrets
idm.service_user_config.passwordIDM_SVC_PASSWORDidm.service_user_config.reva_passwordIDM_REVASVC_PASSWORDidm.service_user_config.idp_passwordIDM_IDPSVC_PASSWORDadmin_passwordOC_ADMIN_PASSWORDtoken_manager.jwt_secretOC_JWT_SECRETmachine_auth_api_keyOC_MACHINE_AUTH_API_KEYtransfer_secretOC_TRANSFER_SECRETservice_account.service_account_secretOC_SERVICE_ACCOUNT_SECRETcollaboration.wopi.wopi_src_secretCOLLABORATION_WOPI_SECRETsystem_user_api_keySYSTEM_USER_API_KEYOC_URL_SIGNING_SECRETTHUMBNAILS_TRANSFER_SECRETProposed fix
Add a helper in
opencloud/pkg/init/that checks for the corresponding environment variable before falling back to random generation:This is fully backward-compatible: when no ENV var is set, behavior is identical to today.
Use case
Helm charts and container orchestrators can inject stable, pre-defined secrets via Kubernetes Secrets → ENV vars, eliminating the need for config volume persistence and ensuring LDAP credentials remain consistent across restarts.