Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ocis admin creation for idm #3507

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions idm/ldif/base.ldif.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,27 @@ objectClass: organizationalUnit
ou: groups

{{ range . -}}
{{ if eq .Name "admin" -}}
dn: uid=admin,ou=users,o=libregraph-idm
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: ownCloud
objectClass: person
objectClass: top
uid: admin
givenName: Admin
sn: Admin
cn: admin
displayName: Admin
description: An admin for this oCIS instance.
mail: [email protected]
ownCloudUUID: ddc2004c-0977-11eb-9d3f-a793888cd0f8
{{ else -}}
dn: uid={{ .Name }},ou=sysusers,o=libregraph-idm
objectClass: account
objectClass: simpleSecurityObject
uid: {{ .Name }}
{{ end -}}
userPassword:: {{ .Password }}

{{ end -}}
Expand Down
17 changes: 0 additions & 17 deletions idm/ldif/demousers.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,6 @@ ownCloudUUID: 058bff95-6708-4fe5-91e4-9ea3d377588b
userPassword:: e0FSR09OMn0kYXJnb24yaWQkdj0xOSRtPTY1NTM2LHQ9MSxwPTIkZU0xaXR6amQ2dlNSSERx
NlZCbXBlQSQxNzBhcTB3YjJZZ2NLU2cwWDhHY3l6ckZwMUllcGplMTNraDdVNjUyNXk4

dn: uid=admin,ou=users,o=libregraph-idm
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: ownCloud
objectClass: person
objectClass: top
uid: admin
givenName: Admin
sn: Admin
cn: admin
displayName: Admin
description: An admin for this oCIS instance.
mail: [email protected]
ownCloudUUID: ddc2004c-0977-11eb-9d3f-a793888cd0f8
userPassword:: e0FSR09OMn0kYXJnb24yaWQkdj0xOSRtPTY1NTM2LHQ9MSxwPTIkRXdwYUhJeVErcG9wdkcv
Tk81R0o2USRNWHp4czNvdHBhOWp3S0hxc1lLMlZodzAralUxSFowMUNpOXducWZlT1pn

dn: cn=users,ou=groups,o=libregraph-idm
objectClass: groupOfNames
objectClass: ownCloud
Expand Down
7 changes: 5 additions & 2 deletions idm/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ func bootstrap(logger log.Logger, cfg *config.Config, srvcfg server.Config) erro
}

serviceUsers := []svcUser{
{
Name: "admin",
Password: cfg.ServiceUserPasswords.OcisAdmin,
},
{
Name: "libregraph",
Password: cfg.ServiceUserPasswords.IdmAdmin,
Password: cfg.ServiceUserPasswords.Idm,
},
{
Name: "idp",
Expand Down Expand Up @@ -141,7 +145,6 @@ func bootstrap(logger log.Logger, cfg *config.Config, srvcfg server.Config) erro
}

bootstrapData := tmplWriter.String()

if cfg.CreateDemoUsers {
bootstrapData = bootstrapData + "\n" + idm.DemoUsersLDIF
}
Expand Down
7 changes: 4 additions & 3 deletions idm/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ type Settings struct {
}

type ServiceUserPasswords struct {
IdmAdmin string `yaml:"admin_password" env:"IDM_ADMIN_PASSWORD" desc:"Password to set for the \"idm\" service users. Either cleartext or an argon2id hash"`
Reva string `yaml:"reva_password" env:"IDM_REVASVC_PASSWORD" desc:"Password to set for the \"reva\" service users. Either cleartext or an argon2id hash"`
Idp string `yaml:"idp_password" env:"IDM_IDPSVC_PASSWORD" desc:"Password to set for the \"idp\" service users. Either cleartext or an argon2id hash"`
OcisAdmin string `yaml:"admin_password" env:"IDM_ADMIN_PASSWORD" desc:"Password to set for the ocis \"admin\" user. Either cleartext or an argon2id hash"`
Idm string `yaml:"idm_password" env:"IDM_SVC_PASSWORD" desc:"Password to set for the \"idm\" service user. Either cleartext or an argon2id hash"`
Reva string `yaml:"reva_password" env:"IDM_REVASVC_PASSWORD" desc:"Password to set for the \"reva\" service user. Either cleartext or an argon2id hash"`
Idp string `yaml:"idp_password" env:"IDM_IDPSVC_PASSWORD" desc:"Password to set for the \"idp\" service user. Either cleartext or an argon2id hash"`
}
7 changes: 4 additions & 3 deletions idm/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ func DefaultConfig() *config.Config {
},
CreateDemoUsers: false,
ServiceUserPasswords: config.ServiceUserPasswords{
IdmAdmin: "idm",
Idp: "idp",
Reva: "reva",
OcisAdmin: "admin",
Idm: "idm",
Idp: "idp",
Reva: "reva",
},
IDM: config.Settings{
LDAPSAddr: "127.0.0.1:9235",
Expand Down