Define sindominio schema

merge-requests/4/head
meskio 4 years ago
parent 54c3bce855
commit 0484293d63
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 3
      README.md
  2. 11
      examples/data.ldif
  3. 9
      examples/sindominio.ldif
  4. 13
      examples/sindominio.schema
  5. 5
      ldap/user.go

@ -1,7 +1,8 @@
Set up a testing environment:
```
sudo apt install slapd
sudo ldapadd -Y EXTERNAL -H ldapi:// -f /etc/ldap/schema/misc.ldif
sudo cp examples/sindominio.* /etc/ldap/schema/
sudo ldapadd -Y EXTERNAL -H ldapi:// -f /etc/ldap/schema/sindominio.ldif
sudo slapadd -n 1 -l examples/data.ldif
```

@ -9,16 +9,16 @@ sn: user
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetLocalMailRecipient
objectClass: sdPerson
objectClass: top
sdRole: amiga
sdLocked: unused
userPassword: {SSHA}FHqod3gytvH9MDGhpMV1DKjyU7eO1EDG
loginShell: /bin/bash
uidNumber: 1000
gidNumber: 1000
homeDirectory: /home/user
mail: user@nodomain
mailHost: mail.nodomain
mailRoutingAddress: user@mail.nodomain
dn: uid=superuser,ou=People,dc=nodomain
uid: superuser
@ -27,16 +27,15 @@ sn: superuser
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetLocalMailRecipient
objectClass: sdPerson
objectClass: top
sdRole: sindominante
userPassword: {SSHA}FHqod3gytvH9MDGhpMV1DKjyU7eO1EDG
loginShell: /bin/bash
uidNumber: 1001
gidNumber: 1001
homeDirectory: /home/superuser
mail: superuser@nodomain
mailHost: mail.nodomain
mailRoutingAddress: superuser@mail.nodomain
dn: ou=Group,dc=nodomain
objectClass: top

@ -0,0 +1,9 @@
dn: cn=sindominio,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: sindominio
olcAttributeTypes: ( 1.3.6.1.4.1.42023.11 NAME 'sdRole' DESC 'Rol en SinDominio'
SUP name SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.42023.12 NAME 'sdLocked'
DESC 'Cuenta de SinDominio bloqueada' SUP name )
olcObjectClasses: ( 1.3.6.1.4.1.42023.10 NAME 'sdPerson'
DESC 'Personas de SinDominio' SUP top AUXILIARY MUST sdRole MAY sdLocked )

@ -0,0 +1,13 @@
attributetype ( 1.3.6.1.4.1.42023.11 NAME 'sdRole'
DESC 'Rol en SinDominio'
SUP name SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.42023.12 NAME 'sdLocked'
DESC 'Cuenta de SinDominio bloqueada'
SUP name)
objectclass ( 1.3.6.1.4.1.42023.10 NAME 'sdPerson'
DESC 'Personas de SinDominio'
SUP top AUXILIARY
MUST sdRole
MAY sdLocked)

@ -134,14 +134,13 @@ func (l *Ldap) AddUser(user string, pass string, gid int) error {
addRequest.Attribute("uid", []string{ldap.EscapeFilter(user)})
addRequest.Attribute("cn", []string{ldap.EscapeFilter(user)})
addRequest.Attribute("sn", []string{ldap.EscapeFilter(user)})
addRequest.Attribute("objectClass", []string{"inetOrgPerson", "posixAccount", "shadowAccount", "inetLocalMailRecipient", "top"})
addRequest.Attribute("objectClass", []string{"inetOrgPerson", "posixAccount", "shadowAccount", "sdPerson", "top"})
addRequest.Attribute("uidNumber", []string{strconv.Itoa(uid)})
addRequest.Attribute("gidNumber", []string{strconv.Itoa(gid)})
addRequest.Attribute("loginShell", []string{"/bin/false"})
addRequest.Attribute("homeDirectory", []string{l.HomePath + user})
addRequest.Attribute("mail", []string{user + "@" + l.MailDomain})
addRequest.Attribute("mailHost", []string{"mail." + l.MailDomain})
addRequest.Attribute("mailRoutingAddress", []string{user + "@mail." + l.MailDomain})
addRequest.Attribute("sdRole", []string{"amiga"})
err = conn.Add(addRequest)
if err != nil {
return err

Loading…
Cancel
Save