Commit graph

23 commits

Author SHA1 Message Date
Zac Bergquist 2ae9d770fc
Refactor tctl's dependencies (#22693)
* Move configuration from lib/service to lib/service/servicecfg

The new servicecfg package will hold only configuration for services.
This will allow other packages (like tctl and tsh) to depend on
servicecfg without pulling in all of lib/service (which has a number
of platform-specific details).

This is the first step towards being able to build tctl for Windows.

* Move PAM and BPF config into servicecfg

This breaks a compile-time dependency on BPF/PAM for tctl.
2023-03-09 17:48:36 +00:00
Nic Klaassen 884cbc0a32
temporarily disable TestHSMDualAuthRotation (#22568)
This test has become pretty flaky recently, disabling it for now until I
can find the root cause or fix the test.

Flaky test issue: https://github.com/gravitational/teleport/issues/20217
2023-03-04 04:20:11 +00:00
STeve (Xin) Huang 39cee50cc9
Fix Too many requests error in github actions test (#19606) 2022-12-23 03:47:02 +00:00
Nic Klaassen fbed5c9684
test: add GCP KMS unit tests (#18245) 2022-11-29 00:16:59 +00:00
Roman Tkachenko 3fd1cca5b2
Github Actions workflow (#18617)
Signed-off-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Victor Sokolov <gzigzigzeo@gmail.com>
2022-11-22 16:55:26 -05:00
Nic Klaassen 962e5a25bc
plumb context to keystore methods (#18034)
* plumb context to keystore methods

Contexts are more relevant now with the GCP KMS keystore which makes
http requests, this commit makes sure they are passed everywhere they
are needed, with only a few `context.TODO`s sprinkled in.
2022-11-10 18:57:17 -08:00
Nic Klaassen bfbb71734d
feat: add GCP KMS support for Teleport CA key material (#17933)
* feat: add GCP KMS support for Teleport CA key material

This commit implements support for GCP KMS as a backend for CA
operations in Teleport.

This is able to take advantage of much of the infrastucture that we have
already created for HSM support, and simply appears as a new backend for
the private key material.

The necessary configuration parameters include only the name of the KMS
keyring to use, and the protection level (which can be HSM or SOFTWARE).
These are configured in the teleport.yaml directly, in a new section
under the existing `ca_key_params` used for HSM configuration.

The GCP credentials are expected to be provided to the Teleport auth
server via the
[Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc).
This means that it "just works" if the auth server is running on a GCP
compute instance with the correct attached role, and you can run tests
locally by authenticating with `gcloud auth login`.

This does not support Teleport Cloud, as our current HSM support does
not, because the Auth server needs the configuration and the access to
the GCP account. That would be a larger effort probably requiring a new
Teleport service.
2022-11-11 00:03:49 +00:00
Nic Klaassen 46f0265546
cleanup: shrink/remove keystore interface (#17908)
* shrink/remove keystore interface

This commit introduces the keystore.Manager type to handle all
interaction between CA and the keystore backends.

Why:

* reduces the code that needs to be implemented per keystore backend to
  only the necessary operations
* separate concerns of managing key material and handling CA data
  structures
* define interfaces where they're used, not implemented
* delete net 245 lines of code
* reduce keystore.KeyStore stutter
2022-11-09 01:44:22 +00:00
Ryan Clark 806a568ada
Introduce config v3, add auth_server and proxy_server, remove auth_addresses (#15761) 2022-09-28 15:30:15 +00:00
Ryan Clark 29175e57d3
Use a getter/setter for reading the token value from the config (#14080) 2022-08-10 08:50:21 +00:00
Edoardo Spadolini fa65fd02b1
Refactor Supervisor.WaitForEvent (#14940) 2022-07-28 13:34:27 +00:00
Noah Stride 5e8cfb345c
Correct terminology from SSHAddr to ListenAddr for Auth server (#13725)
Rename auth SSHAddr to ListenAddr
2022-06-22 23:03:08 +00:00
Nic Klaassen a3e8bdcdc6
serialize hsm tests (#13632) 2022-06-18 00:02:45 +00:00
Nic Klaassen 77a90c1f8e
improve HSM test reliability (#13504) 2022-06-15 18:30:13 +00:00
rosstimothy 25ec2c8a39
Add client side circuit breaker to auth clients (#10282)
* Add client side circuit breaker to auth clients

In order to apply back pressure we can utilize a circuit breaker that
monitors error responses from auth server. When tripped it will prevent
all outbound requests to auth for a period of time. This can also help
prevent a potential thundering heard when auth is in an unhealthy state.
By default the circuit breaker will only be tripped if 90% of the
requests made in the monitoring interval fail.
2022-06-03 11:55:56 -04:00
Noah Stride 2f1675e480
Run HSM integration tests in parallel (#12470)
* run HSM tests in parallel

* add missing punctuation to commit

Co-authored-by: STeve (Xin) Huang <xin.huang@goteleport.com>

Co-authored-by: STeve (Xin) Huang <xin.huang@goteleport.com>
2022-05-19 13:41:34 +00:00
rosstimothy 550d23d15d
Fix goroutine and memory leak in watchCertAuthorities (#10871)
* Fix goroutine and memory leak in watchCertAuthorities

The CA Watcher was blocking both on writing to a channel when the watcher
was closed and on HTTP calls that had no request timeout or context passed
to cause cancellation.

All resourceWatcher implementations that had a bug which may cause them to block
on writing to a channel forever were fixed by selecting on the write and ctx.Done.

Adding context.Context to all Get/Put/Post/Delete methods on the auth HTTPClient to
force callers to propagate context. Prior all calls used context.TODO which
prevents requests from being properly cancelled.

Add context propagation to RotateCertAuthority, RotateExternalCertAuthority,
GetCertAuthority, GetCertAuthorities. This is needed to get the correct ctx
from the CertAtuhorityWatcher all the way down to the HTTPClient that makes
the call.

Closes #10648
2022-03-10 11:05:39 -05:00
Marek Smoliński 4285a6b074
Fix HSM flaky integration tests (#10390) 2022-02-17 10:10:21 +01:00
Jim Bishopp 22e043c430
Add TestModules (#10369)
Allows tests to set fake values to be returned from modules.GetModules()
2022-02-15 21:54:40 +00:00
Nic Klaassen 99cc8eb5ef
Require enterprise license for HSM support (#8370) 2021-09-27 10:40:47 -07:00
Alan Parra dba49bfad6
Lint and fix missing license headers (#8075)
Introduce new make targets to check and add license headers to files
("make lint-license" and "make fix-license"). License checking is now a part of
"make lint" as well.

Initial attempts used goheader, but it caused "make lint-go" to become about 9x
slower (if not more), plus it only targets go files. Google's addlicense is fast
enough and targets however many file types we want.

Existing files that were missing licenses got the header added, using the
current year as the license date.

* Introduce lint-license and fix-license make targets
* Ignore generated files
* Add license to go files
* Replace irregular licenses with standard copyright/license
* Add license to proto files
* Install addlicense in build.assets Dockerfile
2021-08-30 09:44:09 -07:00
Nic Klaassen da951723f6
Add file configuration for HSMs (#7959) 2021-08-18 21:58:05 -07:00
Nic Klaassen c48ee9f062
Add support for HSM CA rotation (#7862) 2021-08-18 21:21:43 -07:00