CiscoDevNet / terraform-provider-mso

Terraform Cisco MSO provider
https://registry.terraform.io/providers/CiscoDevNet/mso/latest/docs
Mozilla Public License 2.0
10 stars 32 forks source link

Bug: Connection to MSO with tls1.3 fails #264

Closed edudppaz closed 6 months ago

edudppaz commented 6 months ago

Community Note

Terraform Version

1.5.6

MSO version

APIC version and APIC Platform for Site Level Resources

Affected Resource(s)

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Error: Post "***/login": remote error: tls: handshake failure

Panic Output

Expected Behavior

Coonnection is established

Actual Behavior

SSL connection failure

Steps to Reproduce

  1. terraform apply

Important Factoids

Seems like the mso-go-client doesnt have the tLS v1.3 enabled, which makes all connections that need an Algorithm not supported by tls1.2 fail:

https://github.com/ciscoecosystem/mso-go-client/blob/b46bf097889c24f278cc96be69c7a5bde04dce09/client/client.go#L153

func (c *Client) useInsecureHTTPClient(insecure bool) *http.Transport {
    transport := &http.Transport{
        TLSClientConfig: &tls.Config{
            CipherSuites: []uint16{
                tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
                tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
                tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
                tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
                tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
            },
            PreferServerCipherSuites: true,
            InsecureSkipVerify:       insecure,
            MinVersion:               tls.VersionTLS11,
            MaxVersion:               tls.VersionTLS12,
        },
    }

    return transport
}

The same certificate and signing algorithm does work with the aci-go-client as that client does have tls1.3 enabled:

        MaxVersion:               tls.VersionTLS13,

References

shrsr commented 6 months ago

@edudppaz Thank you for opening the issue. Our team will look into this!