Skip to content

Commit

Permalink
Merge branch 'master' into lisa/web-export
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlisa authored Jun 11, 2024
2 parents dd9d1ec + 07d6658 commit cc8dd82
Show file tree
Hide file tree
Showing 444 changed files with 10,154 additions and 16,224 deletions.
21 changes: 2 additions & 19 deletions .github/ISSUE_TEMPLATE/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,9 @@ tsh ssh node-that-requires-device-trust
- [ ] Device authentication issues device event (any outcomes)
- [ ] Device web authentication issues "Device Web Token Created" and "Device
Web Authentication Confirmed" events
- [ ] Device web authentication events have web_session_id set.
- [ ] Device web authentication events have web_authentication_id set.
Corresponding "Device Authenticated" events have both
web_authentication=true and web_session_id set.
web_authentication=true and web_authentication_id set.
- [ ] Events with [UserMetadata][event_trusted_device] contain TrustedDevice
data (for certificates with device extensions)
Expand Down Expand Up @@ -1524,23 +1524,6 @@ Docs: [IP Pinning](https://goteleport.com/docs/access-controls/guides/ip-pinning
- [ ] You can access Desktop service on leaf cluster
- [ ] If you change your IP you no longer can access Desktop services.
## Assist
Assist is not supported by `tsh` and WebUI is the only way to use it.
Assist test plan is in the core section instead of WebUI as most functionality is implemented in the core.
- Configuration
- [ ] Assist is disabled by default (OSS, Enterprise)
- [ ] Assist can be enabled in the configuration file.
- [ ] Assist is disabled in the Cloud.
- [ ] Assist is enabled by default in the Cloud Team plan.
- [ ] Assist is always disabled when etcd is used as a backend.
- SSH integration
- [ ] Assist icon is visible in WebUI's Terminal
- [ ] A Bash command can be generated in the above window.
- [ ] When an output is selected in the Terminal "Explain" option is available, and it generates the summary.

## IGS:
- [ ] Access Monitoring
- [ ] Verify that users can run custom audit queries.
Expand Down
2 changes: 1 addition & 1 deletion .github/vale-styles/messaging/edition-names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends: existence
scope:
# Using the raw scope so we can catch instances in TabItem labels.
- raw
message: '"%s" is no longer a recognized Teleport edition. Use "Teleport Enterprise" instead, and clarify the hosting type in parentheses rather than including it in the name of the product, e.g., "Teleport Enterprise (self-hosted)" or "Teleport Enterprise (cloud-hosted)".'
message: '"%s" is no longer a recognized Teleport edition. Use "Teleport Enterprise" instead, and clarify the hosting type rather than including it in the name of the product. For example, you could say, "For managed Teleport Enterprise...", "Teleport Enterprise (managed)", "self-hosted Teleport Enterprise," etc., as long as the implication is that Teleport Enterprise is a single product that users can host in two ways. If the hosting type is not important in a given sentence, there is no need to specify it.'
level: error
ignorecase: false
tokens:
Expand Down
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ linters-settings:
context: all
key-naming-case: snake
static-msg: true
forbidden-keys:
- level
- msg
- source
- time
testifylint:
disable-all: true
enable:
Expand Down
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ Opsgenie plugin users, role annotations must now contain
See [the Opsgenie plugin documentation](docs/pages/access-controls/access-request-plugins/opsgenie.mdx)
for setup instructions.

#### Teleport Assist chat has been removed
#### Teleport Assist has been removed

Teleport Assist chat has been removed from Teleport 16. Assist is still available
in the SSH Web Terminal and Audit Monitoring.
Teleport Assist chat has been removed from Teleport 16.

#### DynamoDB permission requirements have changed

Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,16 @@ endif

# Add -debugtramp=2 to work around 24 bit CALL/JMP instruction offset.
# Add "-extldflags -Wl,--long-plt" to avoid ld assertion failure on large binaries
GO_LDFLAGS += -extldflags -Wl,--long-plt -debugtramp=2
GO_LDFLAGS += -extldflags=-Wl,--long-plt -debugtramp=2
endif
endif # OS == linux

ifeq ("$(OS)-$(ARCH)","darwin-arm64")
# Temporary link flags due to changes in Apple's linker
# https://github.com/golang/go/issues/67854
GO_LDFLAGS += -extldflags=-ld_classic
endif

# Windows requires extra parameters to cross-compile with CGO.
ifeq ("$(OS)","windows")
ARCH ?= amd64
Expand Down
88 changes: 7 additions & 81 deletions api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import (
"github.com/gravitational/teleport/api/client/userloginstate"
"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/api/gen/proto/go/assist/v1"
accesslistv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/accesslist/v1"
accessmonitoringrulev1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/accessmonitoringrules/v1"
auditlogpb "github.com/gravitational/teleport/api/gen/proto/go/teleport/auditlog/v1"
Expand Down Expand Up @@ -110,7 +109,6 @@ func init() {
// AuthServiceClient keeps the interfaces implemented by the auth service.
type AuthServiceClient struct {
proto.AuthServiceClient
assist.AssistServiceClient
auditlogpb.AuditLogServiceClient
userpreferencespb.UserPreferencesServiceClient
notificationsv1pb.NotificationServiceClient
Expand Down Expand Up @@ -522,7 +520,6 @@ func (c *Client) dialGRPC(ctx context.Context, addr string) error {
c.conn = conn
c.grpc = AuthServiceClient{
AuthServiceClient: proto.NewAuthServiceClient(c.conn),
AssistServiceClient: assist.NewAssistServiceClient(c.conn),
AuditLogServiceClient: auditlogpb.NewAuditLogServiceClient(c.conn),
UserPreferencesServiceClient: userpreferencespb.NewUserPreferencesServiceClient(c.conn),
NotificationServiceClient: notificationsv1pb.NewNotificationServiceClient(c.conn),
Expand Down Expand Up @@ -607,6 +604,8 @@ func (c *Client) waitForConnectionReady(ctx context.Context) error {
// Config contains configuration of the client
type Config struct {
// Addrs is a list of teleport auth/proxy server addresses to dial.
// If you are using identity file credentials, at least one address must be supplied.
// This field is optional if you are using tsh profile credentials.
Addrs []string
// Credentials are a list of credentials to use when attempting
// to connect to the server.
Expand Down Expand Up @@ -847,12 +846,6 @@ func (c *Client) TrustClient() trustpb.TrustServiceClient {
return trustpb.NewTrustServiceClient(c.conn)
}

// EmbeddingClient returns an unadorned Embedding client, using the underlying
// Auth gRPC connection.
func (c *Client) EmbeddingClient() assist.AssistEmbeddingServiceClient {
return assist.NewAssistEmbeddingServiceClient(c.conn)
}

// BotServiceClient returns an unadorned client for the bot service.
func (c *Client) BotServiceClient() machineidv1pb.BotServiceClient {
return machineidv1pb.NewBotServiceClient(c.conn)
Expand All @@ -879,6 +872,11 @@ func (c *Client) VnetConfigServiceClient() vnet.VnetConfigServiceClient {
return vnet.NewVnetConfigServiceClient(c.conn)
}

// GetVnetConfig returns the singleton VnetConfig resource.
func (c *Client) GetVnetConfig(ctx context.Context) (*vnet.VnetConfig, error) {
return c.VnetConfigServiceClient().GetVnetConfig(ctx, &vnet.GetVnetConfigRequest{})
}

// Ping gets basic info about the auth server.
func (c *Client) Ping(ctx context.Context) (proto.PingResponse, error) {
rsp, err := c.grpc.Ping(ctx, &proto.PingRequest{})
Expand Down Expand Up @@ -4750,78 +4748,6 @@ func (c *Client) WatchPendingHeadlessAuthentications(ctx context.Context) (types
return w, nil
}

// CreateAssistantConversation creates a new conversation entry in the backend.
func (c *Client) CreateAssistantConversation(ctx context.Context, req *assist.CreateAssistantConversationRequest) (*assist.CreateAssistantConversationResponse, error) {
resp, err := c.grpc.CreateAssistantConversation(ctx, req)
if err != nil {
return nil, trace.Wrap(err)
}

return resp, nil
}

// GetAssistantMessages retrieves assistant messages with given conversation ID.
func (c *Client) GetAssistantMessages(ctx context.Context, req *assist.GetAssistantMessagesRequest) (*assist.GetAssistantMessagesResponse, error) {
messages, err := c.grpc.GetAssistantMessages(ctx, req)
if err != nil {
return nil, trace.Wrap(err)
}
return messages, nil
}

// DeleteAssistantConversation deletes a conversation entry in the backend.
func (c *Client) DeleteAssistantConversation(ctx context.Context, req *assist.DeleteAssistantConversationRequest) error {
_, err := c.grpc.DeleteAssistantConversation(ctx, req)
if err != nil {
return trace.Wrap(err)
}
return nil
}

// IsAssistEnabled returns true if the assist is enabled or not on the auth level.
func (c *Client) IsAssistEnabled(ctx context.Context) (*assist.IsAssistEnabledResponse, error) {
resp, err := c.grpc.IsAssistEnabled(ctx, &assist.IsAssistEnabledRequest{})
if err != nil {
return nil, trace.Wrap(err)
}
return resp, nil
}

// GetAssistantConversations returns all conversations started by a user.
func (c *Client) GetAssistantConversations(ctx context.Context, request *assist.GetAssistantConversationsRequest) (*assist.GetAssistantConversationsResponse, error) {
messages, err := c.grpc.GetAssistantConversations(ctx, request)
if err != nil {
return nil, trace.Wrap(err)
}
return messages, nil
}

// CreateAssistantMessage saves a new conversation message.
func (c *Client) CreateAssistantMessage(ctx context.Context, in *assist.CreateAssistantMessageRequest) error {
_, err := c.grpc.CreateAssistantMessage(ctx, in)
if err != nil {
return trace.Wrap(err)
}
return nil
}

// UpdateAssistantConversationInfo updates conversation info.
func (c *Client) UpdateAssistantConversationInfo(ctx context.Context, in *assist.UpdateAssistantConversationInfoRequest) error {
_, err := c.grpc.UpdateAssistantConversationInfo(ctx, in)
if err != nil {
return trace.Wrap(err)
}
return nil
}

func (c *Client) GetAssistantEmbeddings(ctx context.Context, in *assist.GetAssistantEmbeddingsRequest) (*assist.GetAssistantEmbeddingsResponse, error) {
result, err := c.EmbeddingClient().GetAssistantEmbeddings(ctx, in)
if err != nil {
return nil, trace.Wrap(err)
}
return result, nil
}

// GetUserPreferences returns the user preferences for a given user.
func (c *Client) GetUserPreferences(ctx context.Context, in *userpreferencespb.GetUserPreferencesRequest) (*userpreferencespb.GetUserPreferencesResponse, error) {
resp, err := c.grpc.GetUserPreferences(ctx, in)
Expand Down
3 changes: 3 additions & 0 deletions api/client/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ func configureTLS(c *tls.Config) *tls.Config {
// source of authentication for Client. It does not automatically watch the
// identity file or reload on an interval, this is left as an exercise for the
// consumer.
//
// DynamicIdentityFileCreds is the recommended [Credentials] implementation for
// tools that use Machine ID certificates.
type DynamicIdentityFileCreds struct {
// mu protects the fields that may change if the underlying identity file
// is reloaded.
Expand Down
43 changes: 43 additions & 0 deletions api/client/credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,28 @@ limitations under the License.
package client

import (
"context"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"log"
"math/big"
"os"
"path"
"path/filepath"
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/stretchr/testify/require"
"golang.org/x/crypto/ssh"

"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/api/identityfile"
"github.com/gravitational/teleport/api/profile"
"github.com/gravitational/teleport/api/utils/keys"
Expand Down Expand Up @@ -467,5 +471,44 @@ func TestDynamicIdentityFileCreds(t *testing.T) {
wantTLSCert, err = tls.X509KeyPair(secondTLSCertPem, keyPEM)
require.NoError(t, err)
require.Equal(t, wantTLSCert, *gotTLSCert)
}

func ExampleDynamicIdentityFileCreds() {
// load credentials from identity files on disk
cred, err := NewDynamicIdentityFileCreds("./identity")
if err != nil {
log.Fatal(err)
}

// periodically reload credentials from disk
go func() {
for {
log.Println("reloading credentials")
if err := cred.Reload(); err != nil {
log.Fatal(err)
}
log.Println("reloaded credentials")
time.Sleep(5 * time.Minute)
}
}()

ctx := context.Background()
clt, err := New(ctx, Config{
Addrs: []string{"leaf.tele.ottr.sh:443"},
Credentials: []Credentials{cred},
})
if err != nil {
panic(err)
}

for {
log.Println("Fetching nodes")
_, err := clt.GetNodes(ctx, defaults.Namespace)
if err != nil {
log.Printf("ERROR Fetching nodes: %v", err)
} else {
log.Println("Fetching nodes: OK")
}
time.Sleep(1 * time.Second)
}
}
8 changes: 4 additions & 4 deletions api/client/proto/event.pb.go

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

8 changes: 2 additions & 6 deletions api/client/proxy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (

"github.com/gravitational/teleport/api/breaker"
"github.com/gravitational/teleport/api/client"
authpb "github.com/gravitational/teleport/api/client/proto"
"github.com/gravitational/teleport/api/client/proxy/transport/transportv1"
"github.com/gravitational/teleport/api/defaults"
transportv1pb "github.com/gravitational/teleport/api/gen/proto/go/teleport/transport/v1"
Expand Down Expand Up @@ -431,10 +430,7 @@ func (c *Client) ClusterDetails(ctx context.Context) (ClusterDetails, error) {
func (c *Client) Ping(ctx context.Context) error {
// TODO(tross): Update to call Ping when it is added to the transport service.
// For now we don't really care what method is used we just want to measure
// how long it takes to get a reply. This will always fail with a not implemented
// error since the Proxy gRPC server doesn't serve the auth service proto. However,
// we use it because it's already imported in the api package.
clt := authpb.NewAuthServiceClient(c.grpcConn)
_, _ = clt.Ping(ctx, &authpb.PingRequest{})
// how long it takes to get a reply.
_, _ = c.transport.ClusterDetails(ctx)
return nil
}
2 changes: 0 additions & 2 deletions api/client/webclient/webclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ type ProxySettings struct {
// TLSRoutingEnabled indicates that proxy supports ALPN SNI server where
// all proxy services are exposed on a single TLS listener (Proxy Web Listener).
TLSRoutingEnabled bool `json:"tls_routing_enabled"`
// AssistEnabled is true when Teleport Assist is enabled.
AssistEnabled bool `json:"assist_enabled"`
}

// KubeProxySettings is kubernetes proxy settings
Expand Down
2 changes: 0 additions & 2 deletions api/client/webclient/webconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ type WebConfig struct {
// Eg, v13.4.3
// Only present when AutomaticUpgrades are enabled.
AutomaticUpgradesTargetVersion string `json:"automaticUpgradesTargetVersion,omitempty"`
// AssistEnabled is true when Teleport Assist is enabled.
AssistEnabled bool `json:"assistEnabled"`
// HideInaccessibleFeatures is true when features should be undiscoverable to users without the necessary permissions.
// Usually, in order to encourage discoverability of features, we show UI elements even if the user doesn't have permission to access them,
// this flag disables that behavior.
Expand Down
4 changes: 0 additions & 4 deletions api/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ const (
// BreakerRatioMinExecutions is the minimum number of requests before the ratio tripper
// will consider examining the request pass rate
BreakerRatioMinExecutions = 10

// AssistCommandExecutionWorkers is the number of workers that will
// execute arbitrary remote commands on servers in parallel
AssistCommandExecutionWorkers = 30
)

var (
Expand Down
Loading

0 comments on commit cc8dd82

Please sign in to comment.