Skip to content

Commit

Permalink
Fix ocis admin creation for idm
Browse files Browse the repository at this point in the history
The admin user was created as part of the demo user set. But we need the
admin to be created always.
  • Loading branch information
rhafer committed Apr 11, 2022
1 parent a830555 commit 2a09da2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
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

0 comments on commit 2a09da2

Please sign in to comment.