Commit Graph
30 Commits
Author SHA1 Message Date
David Boslee cc36d290a1 Add metrics to track connection ingress (#19734)
* Add metrics to track connection ingress

* Add connection unwrapping

* Add license

* Remove debug logging

* Add ingress reporter tests

* Remove circular dependency

* Fix import formatting

* Missing defer

* Fix spelling of accepted

* Add _total suffix to counters

* Add godocs and fix nits

* Add test for http conn state reporter

* Use loop to unwrap netConnGetters

* Test meterics after http conn closed

* Ensure conns implement conn getter interface
2023-02-01 23:45:34 +00:00
rosstimothy 3d5557d947 Add a connection limiting listener (#20130)
Introduces `limiter.Listener` to provide a consistent and reusable
mechanism for limiting incoming connections per client. The new
listener is used by `sshutils/server.go` instead of manually applying
limits in `HandleConnection`.

This is particularly important now that the Proxy SSH port multiplexes
both SSH and gRPC. Each listener is now wrapped in a `limiter.Listener`
that uses the same `limiter.ConnectionsListener` to ensure that the
connection limits for the Proxy are enforced for all traffic on the
port.
2023-01-19 15:10:11 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +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
Russell JonesandRoman Tkachenko e2c29e2917 Refactor tests under limiter package.
Refactored all tests under "lib/limiter" to use testify instead
of gocheck.

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-07-18 14:00:06 -07:00
Noah Stride 02b4f8575f Configure linter to catch British 🇬🇧 spellings 🇺🇸 🦅 📖 (#14363)
* configure golangci-lint misspell to check for anglicized spellings

* Americanize spellings

* fix aws constant value with british spelling 🇬🇧

* update api types with americanized spellings

* use american spellings .cloudbuild/scripts
2022-07-14 10:51:23 +00:00
Edward DowlingandRoman Tkachenko a971fe491f Make TestLimiter test less flaky (#13526) (#14102)
* Make TestLimiter test less flaky

* Update lib/srv/regular/sshserver_test.go

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

* Update lib/srv/regular/sshserver_test.go

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

* Remove unneeded helper to wait for server to start and add a comment

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-07-11 09:28:19 +00:00
Nic Klaassen bc441ef2cf IAM Join Method (gRPC service) (#10087) 2022-02-10 00:41:34 +00:00
Jakub Nyckowski c7c94111cd Add "limiter" support to database service (#9087)
Add rate and connection limiter to database service.
2022-01-07 22:23:22 +00:00
Lisa Kim 6c1a5b7b87 Implement Account Recovery Codes (#8034)
* Add dice-ware library to create the recovery codes
* Add new recovery code "generated" and "used" events
* Implement create, upsert, and get recovery codes
* Create ChangeUserAuthentication grpc endpoint that is essentially a rework
  of ChangePasswordWithToken that returns both a web session and
  recovery codes (if user meets requirement)
* Add custom rate limit for grpc endpoint for ChangeUserAuthentication

* This commit also includes unused methods related to verifying recovery
  code and recovery attempts that isn't utilized until later PRs
2021-08-26 17:29:08 -07:00
Andrew Lytvynov fc1c1dbd14 Move all utils.InitLoggerForTests calls to TestMain
This prevents data races between changing the standard logger and it
acutally being used.
2021-02-23 18:04:55 -08:00
a-palchikov 7c87576a8b flaky tests: consistent logging (#4849)
* Update logrus package to fix data races
* Introduce a logger that uses the test context to log the messages so they are output if a test fails for improved trouble-shooting.
* Revert introduction of test logger - simply leave logger configuration at debug level outputting to stderr during tests.
* Run integration test for e as well
* Use make with a cap and append to only copy the relevant roles.
* Address review comments
* Update integration test suite to use test-local logger that would only output logs iff a specific test has failed - no logs from other test cases will be output.
* Revert changes to InitLoggerForTests API
* Create a new logger instance when applying defaults or merging with file service configuration
* Introduce a local logger interface to be able to test file configuration merge.
* Fix kube integration tests w.r.t log
* Move goroutine profile dump into a separate func to handle parameters consistently for all invocations
2020-12-07 15:35:15 +01:00
Andrew Lytvynov 92ed2db38a Fixing golint warnings, batch 1
Mostly cosmetic changes:
- making receiver names consistent
- renaming `foo.FooBar` to `foo.Bar` (using package name as prefix)
- removing redundant `else` branches
- changing `a += 1` to `a++`
2020-10-13 00:22:49 +00:00
Sasha Klizhentas cece4be212 Initial implementation of Kubernetes support
This issue updates #1986.

This is intial, experimental implementation that will
be updated with tests and edge cases prior to production 2.7.0 release.

Teleport proxy adds support for Kubernetes API protocol.
Auth server uses Kubernetes API to receive certificates
issued by Kubernetes CA.

Proxy intercepts and forwards API requests to the Kubernetes
API server and captures live session traffic, making
recordings available in the audit log.

Tsh login now updates kubeconfig configuration to use
Teleport as a proxy server.
2018-06-03 12:55:13 -07:00
Sasha Klizhentas 8b81a0c384 Migrate to golang/dep for dependency management
Update following packages:

* Replace Sirupsen/log with sirupsen/log everywhere
* Update etcd client to 3.2.4
* Update docker/term to moby/term
* Update kr/pty to v1.0.0 release
* Update K8s client to 2.0
2017-08-22 15:30:30 -07:00
Ev Kontsevoy b175d92052 PR comments - implemented! 2016-05-07 21:51:35 -07:00
klizhentas d68e693cad migrate to trace errors 2016-04-12 11:07:14 -07:00
klizhentas 6edd6675e6 re-introduce reverse tunnels into teleport
Reverse tunnels are now first class citizens of teleport.
There's no longer static configuration for reverse tunnel agents
in the config. Instead, admins can add and remove reverse tunnels
using tctl reversetunnel (hidden) commands.

* tctl reversetunnel ls
  lists reverse tunnels

* tctl reversetunnel upsert a.example.com 10.0.0.4:2023,10.0.0.5:2033 --ttl=10m
  updates or inserts reverse tunnel for 10 minutes

* tctl reversetunnel del a.example.com
  deletes a reverse tunnel

Teleport proxies watch changes in the reverse tunnels on the backend and
spin up / spin down reverse tunnels according to these changes.
2016-03-18 17:13:22 -07:00
klizhentas 7a2a9e334f add support for TELEPORT_DEBUG_TESTS environment variable turning on verbose testing 2016-03-14 14:07:45 -07:00
klizhentas 3526a9565d fix limiter test, fixes #131 2016-02-15 19:48:09 -08:00
Alexander Klizhentas 0fd6ca035b Merge pull request #132 from gravitational/ev/110
This closes #110
2016-02-13 23:54:45 -08:00
Ev Kontsevoy 4d6800623c Removed old configuration persistence
- Removed `yaml` structure attributes
- Removed "LoadFromYAML()" routine
- Removed YAML persistence tests

References #133
2016-02-13 21:17:30 -08:00
Ev Kontsevoy bfa3f9d300 This closes #110
- Tests can be enabled in Jenkins
- Unused tctl/command code is removed
- Fixed one broken test
2016-02-13 20:31:56 -08:00
Alex Lyulkov d2f50cf4b6 Fixed tests logging 2016-02-05 17:09:21 +03:00
Ev Kontsevoy 83f2d30d12 Replaced our own logger with logrus 2016-02-02 17:53:21 -08:00
Alex Lyulkov a56b5236ac Moved to go1.5 vendoring 2016-01-20 18:52:25 +03:00
Alex Lyulkov d4aecba1c1 fixed dependencies 2015-12-13 01:29:23 +03:00
Alex Lyulkov 8451bc1e31 fixed bugs, added error text when web login fails 2015-12-10 18:37:48 +03:00
Alex Lyulkov c8332eba27 Added node labels, fixed limiter bugs 2015-12-07 23:05:54 +03:00
Alex Lyulkov 0a7e6fdfbe Refactoring 2015-12-03 12:26:34 +03:00