Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gravitational/teleport into mcbat…
Browse files Browse the repository at this point in the history
…tirola/contact-rbac
  • Loading branch information
mcbattirola committed Nov 28, 2024
2 parents db32629 + d521af2 commit 47f6911
Show file tree
Hide file tree
Showing 180 changed files with 12,223 additions and 6,656 deletions.
12 changes: 11 additions & 1 deletion .github/ISSUE_TEMPLATE/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -1586,12 +1586,22 @@ Docs: [IP Pinning](https://goteleport.com/docs/access-controls/guides/ip-pinning
- [ ] Verify that users can run custom audit queries.
- [ ] Verify that the Privileged Access Report is generated and periodically refreshed.

- [ ] Access Requests
- [ ] Verify when role.spec.allow.request.reason.mode: "required":
- [ ] CLI fails to create Access Request displaying a message that reason is required.
- [ ] Web UI fails to create Access Request displaying a message that reason is required.
- [ ] Other roles allowing requesting the same resources/roles without reason.mode set or with reason.mode: "optional" don't affect the behaviour.
- [ ] Non-affected resources/roles don't require reason.
- [ ] When there is a role with spec.options.request_access: always it effectively becomes role.spec.options.request_access: reason (i.e.) requires reason:
- [ ] For CLI.
- [ ] For Web UI.

- [ ] Access Lists
- [ ] Verify Access List membership/ownership/expiration date.
- [ ] Verify permissions granted by Access List membership.
- [ ] Verify permissions granted by Access List ownership.
- [ ] Verify Access List Review.
- [ ] verify Access LIst Promotion.
- [ ] Verify Access List Promotion.
- [ ] Verify that owners can only add/remove members and not change other properties.
- [ ] Nested Access Lists
- [ ] Verify that Access Lists can be added as members or owners of other Access Lists.
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ outputs:
is recommended that you migrate to v2 as soon as possible to benefit from new
Machine ID features.

For more details and guidance on how to upgrade to v2, see [docs](docs/pages/reference/machine-id/v14-upgrade-guide.mdx).
For more details and guidance on how to upgrade to v2, see [docs](https://github.com/gravitational/teleport/blob/branch/v14/docs/pages/reference/machine-id/v14-upgrade-guide.mdx).

## 13.0.1 (05/xx/23)

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,4 @@ The remainder of the source code in this repository is available under the
from source must comply with the terms of this license.
Teleport Community Edition builds distributed on http://goteleport.com/download
are available under a [modified Apache 2.0 license](./LICENSE-community).
are available under a [modified Apache 2.0 license](./build.assets/LICENSE-community).
6 changes: 6 additions & 0 deletions api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import (
discoveryconfigv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/discoveryconfig/v1"
dynamicwindowsv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/dynamicwindows/v1"
externalauditstoragev1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/externalauditstorage/v1"
gitserverv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/gitserver/v1"
identitycenterv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/identitycenter/v1"
integrationpb "github.com/gravitational/teleport/api/gen/proto/go/teleport/integration/v1"
kubeproto "github.com/gravitational/teleport/api/gen/proto/go/teleport/kube/v1"
Expand Down Expand Up @@ -4874,6 +4875,11 @@ func (c *Client) UserTasksServiceClient() *usertaskapi.Client {
return usertaskapi.NewClient(usertaskv1.NewUserTaskServiceClient(c.conn))
}

// GitServerClient returns a client for managing git servers
func (c *Client) GitServerClient() gitserverv1.GitServerServiceClient {
return gitserverv1.NewGitServerServiceClient(c.conn)
}

// GetCertAuthority retrieves a CA by type and domain.
func (c *Client) GetCertAuthority(ctx context.Context, id types.CertAuthID, loadKeys bool) (types.CertAuthority, error) {
ca, err := c.TrustClient().GetCertAuthority(ctx, &trustpb.GetCertAuthorityRequest{
Expand Down
588 changes: 295 additions & 293 deletions api/client/proto/authservice.pb.go

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions api/client/webclient/webclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func Find(cfg *Config) (*PingResponse, error) {
}
defer clt.CloseIdleConnections()

return findWithClient(cfg, clt)
}

func findWithClient(cfg *Config, clt *http.Client) (*PingResponse, error) {
ctx, span := cfg.TraceProvider.Tracer("webclient").Start(cfg.Context, "webclient/Find")
defer span.End()

Expand Down Expand Up @@ -214,6 +218,10 @@ func Ping(cfg *Config) (*PingResponse, error) {
}
defer clt.CloseIdleConnections()

return pingWithClient(cfg, clt)
}

func pingWithClient(cfg *Config, clt *http.Client) (*PingResponse, error) {
ctx, span := cfg.TraceProvider.Tracer("webclient").Start(cfg.Context, "webclient/Ping")
defer span.End()

Expand Down Expand Up @@ -267,13 +275,18 @@ func Ping(cfg *Config) (*PingResponse, error) {
return pr, nil
}

// GetMOTD retrieves the Message Of The Day from the web proxy.
func GetMOTD(cfg *Config) (*MotD, error) {
clt, err := newWebClient(cfg)
if err != nil {
return nil, trace.Wrap(err)
}
defer clt.CloseIdleConnections()

return getMOTDWithClient(cfg, clt)
}

func getMOTDWithClient(cfg *Config, clt *http.Client) (*MotD, error) {
ctx, span := cfg.TraceProvider.Tracer("webclient").Start(cfg.Context, "webclient/GetMOTD")
defer span.End()

Expand Down Expand Up @@ -302,6 +315,60 @@ func GetMOTD(cfg *Config) (*MotD, error) {
return motd, nil
}

// NewReusableClient creates a reusable webproxy client. If you need to do a single call,
// use the webclient.Ping or webclient.Find functions instead.
func NewReusableClient(cfg *Config) (*ReusableClient, error) {
// no need to check and set config defaults, this happens in newWebClient
client, err := newWebClient(cfg)
if err != nil {
return nil, trace.Wrap(err, "building new web client")
}

return &ReusableClient{
client: client,
config: cfg,
}, nil
}

// ReusableClient is a webproxy client that allows the caller to make multiple calls
// without having to buildi a new HTTP client each time.
// Before retiring the client, you must make sure no calls are still in-flight, then call
// ReusableClient.CloseIdleConnections().
type ReusableClient struct {
client *http.Client
config *Config
}

// Find fetches discovery data by connecting to the given web proxy address.
// It is designed to fetch proxy public addresses without any inefficiencies.
func (c *ReusableClient) Find() (*PingResponse, error) {
return findWithClient(c.config, c.client)
}

// Ping serves two purposes. The first is to validate the HTTP endpoint of a
// Teleport proxy. This leads to better user experience: users get connection
// errors before being asked for passwords. The second is to return the form
// of authentication that the server supports. This also leads to better user
// experience: users only get prompted for the type of authentication the server supports.
func (c *ReusableClient) Ping() (*PingResponse, error) {
return pingWithClient(c.config, c.client)
}

// GetMOTD retrieves the Message Of The Day from the web proxy.
func (c *ReusableClient) GetMOTD() (*MotD, error) {
return getMOTDWithClient(c.config, c.client)
}

// CloseIdleConnections closes any connections on its [Transport] which
// were previously connected from previous requests but are now
// sitting idle in a "keep-alive" state. It does not interrupt any
// connections currently in use.
//
// This must be run before retiring the ReusableClient.
func (c *ReusableClient) CloseIdleConnections() {
c.client.CloseIdleConnections()
}

// MotD holds data about the current message of the day.
type MotD struct {
Text string
Expand Down
Loading

0 comments on commit 47f6911

Please sign in to comment.