-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvault.tf
66 lines (56 loc) · 1.91 KB
/
vault.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
variable "vault_keytab" {
type = string
}
provider "vault" {}
resource "vault_generic_endpoint" "auth_kerberos" {
path = "sys/auth/kerberos/domain.local"
disable_read = true
data_json = jsonencode({
type = "kerberos"
config = {
passthrough_request_headers = ["Authorization"]
allowed_response_headers = ["www-authenticate"]
}
})
}
resource "vault_generic_endpoint" "auth_kerberos_config" {
path = join("/", ["auth", substr(vault_generic_endpoint.auth_kerberos.path, 9, 0), "config"])
ignore_absent_fields = true
disable_delete = true
data_json = jsonencode({
keytab = var.vault_keytab
service_account = "vault_svc"
})
}
resource "vault_generic_endpoint" "auth_kerberos_config_ldap" {
depends_on = [vault_generic_endpoint.auth_kerberos_config]
path = "${vault_generic_endpoint.auth_kerberos_config.path}/ldap"
ignore_absent_fields = true
disable_delete = true
data_json = jsonencode({
url = "ldap://dc.domain.local"
userdn = "DC=domain,DC=local"
userattr = "cn"
upndomain = "DOMAIN.LOCAL"
groupattr = "cn"
groupdn = "DC=domain,DC=local"
groupfilter = "(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))"
binddn = "CN=vagrant-domain,CN=Users,DC=domain,DC=local"
bindpass = "VagrantPass1"
})
}
resource "vault_ldap_auth_backend_group" "group" {
depends_on = [vault_generic_endpoint.auth_kerberos_config_ldap]
groupname = "Domain Users"
policies = ["default"]
backend = "${substr(vault_generic_endpoint.auth_kerberos.path, 9, 0)}"
}
resource "vault_ldap_auth_backend" "ldap" {
binddn = "[email protected]"
bindpass = "VagrantPass1"
path = "ldap"
url = "ldap://dc.domain.local"
userdn = "CN=Users,DC=domain,DC=local"
userattr = "sAMAccountName"
discoverdn = true
}