opentofu/internal/backend
Sheridan C Rawlins 75e5ae27a2
[fixes 31700] Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert. (#31699)
* Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert.

* Fix style.

* Skip cert validation to be sure error is related to missing client cert; not untrusted server cert.

* Remove misplaced err check.

* Fix the size of test using http backend.

* Just for correctness, include all certs in the pem encoded cert - sometimes certs come with a chain of their signers.

* Adjusted names as recommended in PR comments.

* Adjusted names to be full-length and more descriptive.

* Added full-fledged testing with mTLS http server

* Fix goimports.

* Fix the names of the backend config.

* Exclusive lock for write and delete.

* Revert "Fix goimports."

This reverts commit 7d40f6099fbbb675fb2e25e35ee40aeafe3d0a22.

* goimports just for server test.

* Added the go:generation for the mock.

* Move the TLS configuration out to make it more readable - don't replace the HTTPClient as the retryablehttp already creates one - just configure its TLS.

* Just switch the client/data params - felt more natural this way.

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/testdata/gencerts.sh

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* the location of the file name is not sensitive.

* Added error if only one of client_certificate_pem and client_private_key_pem are set.

* Remove testify from test cases; use t.Error* for assert and t.Fatal* for require.

* Fixed import consistency

* Just use default openssl.

* Since file(...) is so trivial to use, changed the client cert, key, and ca cert to be the data.

See also https://github.com/hashicorp/terraform-provider-http/pull/211

Co-authored-by: Sheridan C Rawlins <scr@ouryahoo.com>
Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-01-26 14:08:07 +00:00
..
init remove deprecated backends (#31711) 2022-08-31 10:17:07 +01:00
local Merge pull request #32395 from hashicorp/jbardin/plan-output-on-error 2023-01-04 12:44:52 -05:00
remote Fix test compilation errors caused by interface change 2022-11-21 14:35:33 -05:00
remote-state [fixes 31700] Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert. (#31699) 2023-01-26 14:08:07 +00:00
backend_test.go Move backend/ to internal/backend/ 2021-05-17 14:09:07 -07:00
backend.go remove -always-out 2022-12-14 11:09:34 -05:00
cli.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
operation_type.go Move backend/ to internal/backend/ 2021-05-17 14:09:07 -07:00
operationtype_string.go Move backend/ to internal/backend/ 2021-05-17 14:09:07 -07:00
testing.go Use safe or force workspace delete for cloud backend 2022-11-21 14:35:33 -05:00
unparsed_value_test.go core and backend: remove redundant handling of default variable values 2022-01-10 12:26:54 -08:00
unparsed_value.go core and backend: remove redundant handling of default variable values 2022-01-10 12:26:54 -08:00