Commit Graph
38 Commits
Author SHA1 Message Date
Brian Joerger ce20b20753 PIV login enforcement (#15874)
Add private key policy enforcement.

  - Add private key policy cert extensions and enforcement.

  - Add private key policy settings and attestation logic.

  - Wire attestation request through login endpoints.

  - Store attestation data for reissue requests.

  - Add private key policy discovery and logic.

  - Relogin on hardware key policy errors.

  - Include integration with Teleport Connect.
2022-09-30 23:27:48 +00:00
rosstimothy 0ec2116ba2 Provide proxy listener mode from reversetunnel.Resolver (#16434)
By only providing the tunnel address from the `reversetunnel.Resolver`
callers would still need to lookup the proxy listener mode to determine
how to dial the address. This results in sending a request to
`/webapi/find` once by the resolver to get the tunnel address and then
a second request to `/webapi/find` by users of the `Resolver` to determine
the proxy listener mode. Propagating the listener mode along with the
tunnel address by the `Resolver` ensures only one `/webapi/find` call
is needed.

This is especially impactful because the `reversetunnel.TunnelAuthDialer`
which is used by the auth http client would do this everytime the
`http.Client` connection pool was empty. When the `http.Client` needed
to dial the auth server it was incurring the additional roundtrip to the
proxy.
2022-09-26 20:15:32 +00:00
Alan Parra a75fcc21d8 Update golangci-lint to 1.49.0 (#16507)
Update metalinter, fix a few lint warnings and replace deprecated linters.

`deadcode`, `structcheck` and `varcheck` are abandoned and now replaced by [`unused`][1].

Since 1.19, `go fmt` reformats godocs according to https://go.dev/doc/comment. I've done a bulk-reformatting of the codebase to keep the linter happy. Backporting is mostly harmless (the exception being `lib/services/role_test.go`, that for some reason breaks the _old_ linter using the new format).

[1]: https://golangci-lint.run/usage/linters/

* Bump golangci-lint version
* Replace abandoned linters
* Fix bodyclose on lib/auth/github.com
* Fix bodyclose on lib/kube/proxy/streamproto/proto_test.go
* Fix bodyclose on lib/srv/alpnproxy/proxy_test.go
* Fix bodyclose on lib/web/conn_upgrade_test.go
* Silence staticcheck on lib/kube/proxy/forwarder_test.go
* Silence staticcheck on lib/utils/certs_test.go
* Address BuildNameToCertificate deprecation warnings
* Run `go fmt ./...`
* Run `go fmt ./...` on api/
* Ignore formatting in role_test.go
* Remove redundant initializers in lib/srv/uacc/
* Update e/
2022-09-19 22:38:59 +00:00
rosstimothy 1973fcee24 Span improvements (#15388)
* Add spans to TeleportClient/ProxyClient/NodeSession

* Improve dialer tracing

* Alter default http client span name to include path

* propagate tracing options in NewClientConn
2022-08-18 21:29:03 +00:00
Bernard Kim 26e3df82b5 Display license out of compliance warnings (#14114) 2022-07-26 19:31:50 -07:00
Krzysztof Skrzętnicki 26a442dfbf Better error message on ping parse error. (#14700) 2022-07-20 20:11:53 +00:00
Andrew Burke 22c0fccba7 Restore HTTP_PROXY for multi-port mode (#13048)
This change undoes the changes in #11990 and #12335 for Teleport going forward.
2022-06-07 11:57:16 -07:00
Roman Tkachenko ec512bafa4 Implement proxy templates (#12848) 2022-06-07 00:06:52 +00:00
Edoardo SpadoliniandAlan Parra 3de0f5dfda Client timeout fixes (#12557)
* Respect timeout in `(directDial).DialTimeout`

* Add a Timeout to the api/client/webclient calls

* Respect timeout in (proxyDial).DialTimeout

* Applied suggestion

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2022-05-13 14:40:59 +02:00
rosstimothy 80d6bff4e5 Add auto instrumentation to http and grpc clients and servers (#12231)
Leverage otelhttp to generate spans for http clients and http handlers.
Additionally add spans for grpc clients and servers by using the
otelgrpc interceptors. This is step one in implementation of RFD 65.
Until further work is done, the spans generated will be a no-op
until the tracing provider is initialized.
2022-05-03 15:55:31 -04:00
Lisa Kim b28094fd45 Add passwordless settings to web config (#12303) 2022-04-29 22:55:45 +00:00
Lisa Kim 93364cf268 Manually extract SSO redirect URL to preserve its own query params (#12100)
Prevents truncating of the redirect URL if this URL
had its own query params.
2022-04-20 17:40:36 +00:00
Alan Parra f9da8e2252 Implement passwordless cluster settings (#11952)
Implement passwordless cluster settings, as described by RFD 52: Passwordless
[1]. See https://github.com/gravitational/teleport/pull/11716 for recent RFD
changes.

Add the "passwordless" connector and allows cluster admins to configure it as
the cluster default.

teleport.yaml:

```yaml
auth_service:
  authentication:
    type: local
    second_factor: on
    webauthn:
      rp_id: example.com
    passwordless: true            # enables/disables passwordless
    connector_name: passwordless  # sets passwordless as the default
```

`tsh` obeys the connector name if present. User overrides are possible via `tsh
--auth=local` or `tsh --auth=passwordless`. The `tsh --pwdless` flag is now
removed, as discussed in recent RFD changes.

Web API `/ping` and `/ping/{connector}` endpoints are changed to support
"passwordless" and to provide other necessary information.

#9160

[1] https://github.com/gravitational/teleport/blob/master/rfd/0052-passwordless.md#cluster-settings

* Add passwordless toggle to AuthPreferenceSpecV2 proto
* Update generate protos
* Add AuthPreference fields and validation
* Reserve system connector names
* Distinguish between type=local and local connector
* Add passwordless option to teleport.yaml
* Do /ping and /ping/{connector} changes
* Make tsh respect the passwordless connector, remove --pwdless
2022-04-18 22:13:43 +00:00
Andrew Burke 89b6534c57 Ignore HTTP_PROXY for reverse tunnels (#11990)
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility.
2022-04-18 17:40:03 +00:00
Jeff Pihach c0a0a6c3c7 Return error message if supplied auth connector name doesn't match registered names. (#11800)
* Include the possible connector values if supplied value is invalid.

* Update messaging for auth flag.

* Return error message from failed ping response.

* Collect the connector names in the existing loops.
2022-04-07 22:29:06 +00:00
Rafał Cieślak ef2ae6f7de Move WebConfig from lib/web/ui to api/client/webclient (#11690)
* Move WebConfig from lib/web/ui to api/client/webclient

Web config was shared with the Web UI through the dynamically generated
/web/config.js file available on the cluster. With the addition of
Teleport Terminal (RFD 63), the Electron app needs to get a hold of this
config as well.

However, unlike the Web UI which directly loads the file and injects
the config this way, any communication between the cluster and Teleport
Terminal is done through the tsh daemon (RFD 63). The tsh daemon needs
to essentially pipe this config from /web/config.js to the gRPC response
it gives to Teleport Terminal.

To achieve this, a GetWebConfig function was added to TeleportClient.
Unfortunately, this breaks the build on Windows as lib/web (where WebConfig
resides) includes code which is not meant to be compiled or run on Windows.

Since we need to share the web config with another frontend application,
it only makes sense to move it to the webclient package. We already have
types shared between the server and the client there, for example the
PingResponse struct.
2022-04-05 08:47:53 +00:00
Andrew Burke e3a8fb7a0f NO_PROXY port support + special case for proxying via localhost (#11403)
This change updates NO_PROXY handling to allow blocking specific host:port combinations, rather than just the host. It also adds a special case for downgrading requests to plain HTTP when --insecure is true and the request goes through a plain HTTP proxy at localhost (i.e. HTTP_PROXY=http://localhost).
2022-04-04 14:23:50 -07:00
Andrew Burke 4543bfd98d Respect HTTP_PROXY/HTTPS_PROXY (#10209)
This change allows tsh to use HTTP proxies when HTTP_PROXY/HTTPS_PROXY is set in the environment.
2022-03-23 19:58:19 +00:00
Alex McGrath 3d35263a6c Add a .tsh/config file and add support for configuring custom http headers 2022-03-23 14:19:07 +00:00
Alan Parra bac0ccdc99 Remove U2F support (#10476)
Follows up on #10466 by removing remaining U2F references, including proto/gRPC
surface and the lib/auth/u2f package itself.

#10375

* Remove U2F from lib/auth/ (1)
* Remove U2F from lib/auth/ (2)
* Remove U2F from lib/auth/ (3)
* Remove U2F from lib/services/
* Remove U2F from tsh mfa add suggestions
* Remove U2F protos
* Update generated protos
* Cleanup a few stragglers
* Remove lib/auth/u2f package
* Fix references to auth.MFAAuthenticateChallenge
* Revert needless lib/auth/password.go change
* Update e/ to ad8fd4a (U2F cleanup)
* Fix stragglers from latest master rebase
* Fix lint and compile failures
2022-02-24 19:54:28 +00:00
Marek Smoliński 5afd0e6204 Update API client: dial auth service with TLS Routing (#9498) 2022-01-03 11:32:45 +01:00
Marek Smoliński f906831e58 Add ability to run Mongo proxy on separate listener (#9194) 2021-12-14 14:26:14 +01:00
Marek Smoliński d24ae5b1ce Add ability to run Postgres proxy on separate listener (#8323) 2021-12-10 11:05:19 +01:00
Zac Bergquist 53562aadb0 Use t.Setenv in tests (#9154)
This new feature in Go 1.17 automatically restores the environment
variable to its previous value when a test ends, making it simpler
to set up the environment for tests and less likely that we accidentally
leave behind global state.

Also convert some of the remaining uses of check to standard Go tests.
2021-12-01 10:43:12 -07:00
Marek Smoliński 33f8a021b1 Fix tunnel address for TLS routing if public tunnel address is present (#8961) 2021-11-15 12:58:22 -08:00
Marek Smoliński 17a5cadabb Add Proxy listener mode and proxy v2 configuration (#8511) 2021-10-21 14:45:47 +02:00
Alan Parra 93a7a8926b Return preferred MFA method on ping endpoints (#8439)
Give Teleport clients a consistent hint of which MFA method they should
favor when facing multiple options.

To be used by tsh and Web UI to decide whether they should refer to
"U2F" or "WebAuthn" during the transitional period.

* Return preferred MFA method on ping endpoints
2021-10-01 13:35:22 -07:00
Alan Parra 6187d00c74 Add Webauthn support to ChangePassword and Ping (#8337)
Add Webauthn support to a few outstanding endpoints and RPCs.

* Refactor and add Webauthn support to ChangePassword
* Add explicit JSON tag to AuthenticateUserRequest.Webauthn
* Add Webauthn support to /webapi/users/password/token
* Add Webauthn to /webapi/ping
* Add default Webauthn device name to ChangeUserAuthentication
* Tidy Ping tests
2021-09-23 13:34:30 -07:00
Trent Clarke a3d8f72d43 Replace log with logrus in Webclient (#8328)
Using the standard logger results in log messages being routed to the
console even in non-debug mode, so reverting to `logrus` which will
honour the debug setting
2021-09-22 21:08:49 +10:00
Trent Clarke e1b2a267a9 Allow login over plain http in restricted situations (#7835)
This patch will allow the web api to (optionally) fall back from HTTPS
to HTTP under very particular circumstances:

  1. The appropriate `insecure` flag was set, and
  2. The target host is the loopback

If both conditions are met, this patch will allow the WebAPI client to
fall back to plain HTTP when attempting to login to the auth server.
2021-09-17 19:47:03 +10:00
Marek Smoliński c142b656c8 ALPN SNI Proxy (#7524) 2021-09-13 11:54:49 +02:00
Zac Bergquist 034e56bd50 webclient: use the provided context (#7801)
Ensure that the webclient package makes HTTP requests using the
provided context so that timeouts and cancelation are respected.

Updates #7795
2021-09-08 11:47:24 -07:00
Brian Joerger 25c9c982db API client tunnel address discovery fix (#7533) 2021-08-11 14:34:50 -07:00
Brian Joerger 9b8b9d6d0c rollback - Upgrade api version. (#7751) 2021-07-30 15:34:19 -07:00
Brian Joerger c040aca4c1 Upgrade api version. (#7609) 2021-07-28 13:51:21 -07:00
Trent Clarke 5ffa4b4829 Adds Message of the Day (#7396)
Adds a configurable MotD to the auth service. If a message is set, any
attempt to login into a cluster via `tsh` will display that message and
not begin to log the user in until that message is acknowledged.
2021-07-20 10:48:00 +10:00
Roman Tkachenko d67e11ff2d Adding postgres_public_addr and mysql_public_addr (#6426) 2021-04-21 19:52:52 -07:00
Brian Joerger d830ed6db7 Refactor api package and docs to use pkg.go.dev effectively. (#6388) 2021-04-20 16:44:17 -07:00