Skip to content

Commit 7ee187a

Browse files
committed
Added schema
1 parent ad51d77 commit 7ee187a

File tree

5 files changed

+182
-316
lines changed

5 files changed

+182
-316
lines changed

openldap/ldif/group.ldif

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dn: cn={{ env "NOMAD_META_group" }},ou={{ env "NOMAD_META_groups" }},{{ env "NOMAD_META_basedn" }}
2+
cn: {{ env "NOMAD_META_group" }}
3+
gidNumber: {{ env "NOMAD_META_gid" }}
4+
objectClass: posixGroup
5+
objectClass: groupOfMembers
6+
objectClass: top
7+
description: {{ env "NOMAD_META_description" }}
8+

openldap/ldif/root.ldif

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dn: ou={{ env "NOMAD_META_groups" }},{{ env "NOMAD_META_basedn" }}
1111
ou: {{ env "NOMAD_META_groups" }}
1212
objectClass: top
1313
objectClass: organizationalUnit
14+
objectClass: groupOfMembers
1415
description: User groups
1516

1617
# Users

openldap/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ resource "nomad_job" "ldap" {
2121
ldif = jsonencode({
2222
"root" = file("${path.module}/ldif/root.ldif")
2323
})
24-
schema = jsonencode({})
24+
schema = jsonencode({
25+
"rfc2307bis" = file("${path.module}/schema/rfc2307bis.ldif")
26+
})
2527
}
2628
}
2729
}

openldap/nomad/openldap.hcl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ variable "schema" {
6060
type = map(string)
6161
}
6262

63+
variable "extra_schemas" {
64+
description = "Extra schemas, optional"
65+
type = string
66+
default = "cosine, inetorgperson"
67+
}
68+
6369
variable "admin_password" {
6470
description = "LDAP admin password"
6571
type = string
@@ -115,7 +121,7 @@ job "openldap" {
115121
network {
116122
port "ldap" {
117123
static = var.port
118-
to = 1389
124+
to = 389
119125
}
120126
}
121127

@@ -165,7 +171,7 @@ job "openldap" {
165171
LDAP_PORT_NUMBER = NOMAD_PORT_ldap
166172
LDAP_ROOT = var.basedn
167173
LDAP_ADD_SCHEMAS = "yes"
168-
LDAP_EXTRA_SCHEMAS = "cosine, inetorgperson, nis"
174+
LDAP_EXTRA_SCHEMAS = var.extra_schemas
169175
LDAP_SKIP_DEFAULT_TREE = "yes"
170176
LDAP_CUSTOM_LDIF_DIR = local.ldif_path
171177
LDAP_CUSTOM_SCHEMA_DIR = local.schema_path
@@ -174,9 +180,9 @@ job "openldap" {
174180
config {
175181
image = var.docker_image
176182
force_pull = var.docker_always_pull
177-
volumes = compact([
178-
format("%s:%s/data", var.data, local.data_path),
179-
])
183+
//volumes = compact([
184+
// format("%s:%s/data", var.data, local.data_path),
185+
//])
180186
ports = ["ldap"]
181187
}
182188

0 commit comments

Comments
 (0)