hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.78k stars 9.13k forks source link

Add LDAPS configuration support for aws_directory_service_directory #12636

Open ablackrw opened 4 years ago

ablackrw commented 4 years ago

Community Note

Description

Per Microsoft security advisory ADV190023, Microsoft is deprecating the use of insecure LDAP connections to domain controllers. As such, it will be necessary to configure the CA certificates and LDAPS configuration of aws_directory_service_directory resources of type ADConnector or MicrosoftAD to avoid communications disruptions.

New or Affected Resource(s)

Potential Terraform Configuration

resource "aws_directory_service_directory" "example" {
  name = var.adc_domain
  password = var.adc_pass
  size = "Small"
  type = "ADConnector"
  certificates = {
    file("path/to/file"),
    file("path/to/file")
  }
}

This design assumes that LDAPS is to be enabled if one or more certificates are specified.

An alternate design would be similar to the following:

resource "aws_directory_service_directory" "example" {
  name = var.adc_domain
  password = var.adc_pass
  size = "Small"
  type = "ADConnector"
  ldaps = true
}

resource "aws_directory_service_certificate" "example" {
  directory = aws_directory_service_directory.example.arn
  file = file("path/to/file")
}

However, this design fails to encapsulate the requirement that at least one certificate be associated with a directory before ldaps can be enabled.

References

LozanoMatheus commented 3 years ago

I think we'll also need to add the EnableLDAPS, DisableLDAPS and DescribeLDAPSSettings. I'm curious how the Enable/Disable works since both have the same fields/values.

OriBenHur-akeyless commented 2 years ago

Anything new about this?

wxGold commented 2 years ago

Any update please?

stefano-n26 commented 1 year ago

is this still on going?

cacack commented 1 year ago

I found my way here for the same needs -- enabling LDAPS for Active Directory Connector.

Pending a feature improvement to the provider, has anyone solved via a workaround? I'm specifically thinking the use of the local provisioner to run a Python script and leverage boto3 to inject the certs and enable LDAPS mode. Or will this be more trouble than it is worth and should just stick to doing this out-of-band to our TF pipelines?

uo-thomas commented 1 year ago

@cacack We currently use a null_resource with a local-exec provisioner and just call the API:

`resource "null_resource" "ad_connector_cert_register" { provisioner "local-exec" { command = "aws ds register-certificate --region ${local.region} --directory-id ${aws_directory_service_directory.ad_connector.id} --certificate-data file://FILE.cer" }

depends_on = [ aws_directory_service_directory.ad_connector ] }`