Commit graph

19 commits

Author SHA1 Message Date
STeve (Xin) Huang 3179bc3382
Teleport Proxy Behind ALB support for IP Pinning (#26623)
* Teleport Proxy Behind ALB support for IP Pinning

* move X-Forwarded-For handling to a middleware

* fix where middleware should be nil

* minor refactor based on review comments

* remove TODO and use contains

* use_x_forwarded_for -> trust_x_forwarded_for

* add NoopHTTPMiddleware
2023-06-28 13:09:24 +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 Jones 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
Nic Klaassen bc441ef2cf
IAM Join Method (gRPC service) (#10087) 2022-02-10 00:41:34 +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
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
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
Alex Lyulkov a56b5236ac Moved to go1.5 vendoring 2016-01-20 18:52:25 +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
Renamed from lib/ratelimiter/ratelimiter_test.go (Browse further)