Remove connection idle timeout seconds for now (#379)
This commit is contained in:
1 parent
e002326293
commit
5bf555cca2
27 files changed
+296
-480
No files matched your search
@@ -353,16 +353,15 @@ HOST_GATHERING_DONE:
|
||||
expTime := timestamppb.Now()
|
||||
expTime.Seconds += int64(t.GetSessionMaxSeconds())
|
||||
sessionComposition := session.ComposedOf{
|
||||
UserId: authResults.UserId,
|
||||
HostId: chosenId.hostId,
|
||||
TargetId: t.GetPublicId(),
|
||||
HostSetId: chosenId.hostSetId,
|
||||
AuthTokenId: authResults.AuthTokenId,
|
||||
ScopeId: authResults.Scope.Id,
|
||||
Endpoint: endpointUrl.String(),
|
||||
ExpirationTime: ×tamp.Timestamp{Timestamp: expTime},
|
||||
ConnectionLimit: t.GetSessionConnectionLimit(),
|
||||
ConnectionIdleTimeoutSeconds: t.GetConnectionIdleTimeoutSeconds(),
|
||||
UserId: authResults.UserId,
|
||||
HostId: chosenId.hostId,
|
||||
TargetId: t.GetPublicId(),
|
||||
HostSetId: chosenId.hostSetId,
|
||||
AuthTokenId: authResults.AuthTokenId,
|
||||
ScopeId: authResults.Scope.Id,
|
||||
Endpoint: endpointUrl.String(),
|
||||
ExpirationTime: ×tamp.Timestamp{Timestamp: expTime},
|
||||
ConnectionLimit: t.GetSessionConnectionLimit(),
|
||||
}
|
||||
|
||||
sess, err := session.New(sessionComposition)
|
||||
@@ -441,9 +440,6 @@ func (s Service) createInRepo(ctx context.Context, item *pb.Target) (*pb.Target,
|
||||
if item.GetSessionConnectionLimit() != nil {
|
||||
opts = append(opts, target.WithSessionConnectionLimit(item.GetSessionConnectionLimit().GetValue()))
|
||||
}
|
||||
if item.GetConnectionIdleTimeoutSeconds() != nil {
|
||||
opts = append(opts, target.WithConnectionIdleTimeoutSeconds(item.GetConnectionIdleTimeoutSeconds().GetValue()))
|
||||
}
|
||||
tcpAttrs := &pb.TcpTargetAttributes{}
|
||||
if err := handlers.StructToProto(item.GetAttributes(), tcpAttrs); err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Provided attributes don't match expected format.")
|
||||
@@ -483,9 +479,6 @@ func (s Service) updateInRepo(ctx context.Context, scopeId, id string, mask []st
|
||||
if item.GetSessionConnectionLimit() != nil {
|
||||
opts = append(opts, target.WithSessionConnectionLimit(item.GetSessionConnectionLimit().GetValue()))
|
||||
}
|
||||
if item.GetConnectionIdleTimeoutSeconds() != nil {
|
||||
opts = append(opts, target.WithConnectionIdleTimeoutSeconds(item.GetConnectionIdleTimeoutSeconds().GetValue()))
|
||||
}
|
||||
tcpAttrs := &pb.TcpTargetAttributes{}
|
||||
if err := handlers.StructToProto(item.GetAttributes(), tcpAttrs); err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Provided attributes don't match expected format.")
|
||||
@@ -652,15 +645,14 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth.
|
||||
|
||||
func toProto(in target.Target, m []*target.TargetSet) (*pb.Target, error) {
|
||||
out := pb.Target{
|
||||
Id: in.GetPublicId(),
|
||||
ScopeId: in.GetScopeId(),
|
||||
CreatedTime: in.GetCreateTime().GetTimestamp(),
|
||||
UpdatedTime: in.GetUpdateTime().GetTimestamp(),
|
||||
Version: in.GetVersion(),
|
||||
Type: target.TcpTargetType.String(),
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: in.GetSessionMaxSeconds()},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: in.GetSessionConnectionLimit()},
|
||||
ConnectionIdleTimeoutSeconds: &wrapperspb.UInt32Value{Value: in.GetConnectionIdleTimeoutSeconds()},
|
||||
Id: in.GetPublicId(),
|
||||
ScopeId: in.GetScopeId(),
|
||||
CreatedTime: in.GetCreateTime().GetTimestamp(),
|
||||
UpdatedTime: in.GetUpdateTime().GetTimestamp(),
|
||||
Version: in.GetVersion(),
|
||||
Type: target.TcpTargetType.String(),
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: in.GetSessionMaxSeconds()},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: in.GetSessionConnectionLimit()},
|
||||
}
|
||||
if in.GetDescription() != "" {
|
||||
out.Description = wrapperspb.String(in.GetDescription())
|
||||
|
||||
@@ -68,18 +68,17 @@ func TestGet(t *testing.T) {
|
||||
tar := target.TestTcpTarget(t, conn, proj.GetPublicId(), "test", target.WithHostSets([]string{hs[0].GetPublicId(), hs[1].GetPublicId()}))
|
||||
|
||||
pTar := &pb.Target{
|
||||
Id: tar.GetPublicId(),
|
||||
ScopeId: proj.GetPublicId(),
|
||||
Name: wrapperspb.String("test"),
|
||||
CreatedTime: tar.CreateTime.GetTimestamp(),
|
||||
UpdatedTime: tar.UpdateTime.GetTimestamp(),
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
Type: target.TcpTargetType.String(),
|
||||
HostSetIds: []string{hs[0].GetPublicId(), hs[1].GetPublicId()},
|
||||
Attributes: new(structpb.Struct),
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 28800},
|
||||
ConnectionIdleTimeoutSeconds: &wrapperspb.UInt32Value{Value: 3600},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: 1},
|
||||
Id: tar.GetPublicId(),
|
||||
ScopeId: proj.GetPublicId(),
|
||||
Name: wrapperspb.String("test"),
|
||||
CreatedTime: tar.CreateTime.GetTimestamp(),
|
||||
UpdatedTime: tar.UpdateTime.GetTimestamp(),
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
Type: target.TcpTargetType.String(),
|
||||
HostSetIds: []string{hs[0].GetPublicId(), hs[1].GetPublicId()},
|
||||
Attributes: new(structpb.Struct),
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 28800},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: 1},
|
||||
}
|
||||
for _, ihs := range hs {
|
||||
pTar.HostSets = append(pTar.HostSets, &pb.HostSet{Id: ihs.GetPublicId(), HostCatalogId: ihs.GetCatalogId()})
|
||||
@@ -149,18 +148,17 @@ func TestList(t *testing.T) {
|
||||
name := fmt.Sprintf("tar%d", i)
|
||||
tar := target.TestTcpTarget(t, conn, proj.GetPublicId(), name, target.WithHostSets([]string{hss[0].GetPublicId(), hss[1].GetPublicId()}))
|
||||
wantTars = append(wantTars, &pb.Target{
|
||||
Id: tar.GetPublicId(),
|
||||
ScopeId: proj.GetPublicId(),
|
||||
Name: wrapperspb.String(name),
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
CreatedTime: tar.GetCreateTime().GetTimestamp(),
|
||||
UpdatedTime: tar.GetUpdateTime().GetTimestamp(),
|
||||
Version: tar.GetVersion(),
|
||||
Type: target.TcpTargetType.String(),
|
||||
Attributes: new(structpb.Struct),
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 28800},
|
||||
ConnectionIdleTimeoutSeconds: &wrapperspb.UInt32Value{Value: 3600},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: 1},
|
||||
Id: tar.GetPublicId(),
|
||||
ScopeId: proj.GetPublicId(),
|
||||
Name: wrapperspb.String(name),
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
CreatedTime: tar.GetCreateTime().GetTimestamp(),
|
||||
UpdatedTime: tar.GetUpdateTime().GetTimestamp(),
|
||||
Version: tar.GetVersion(),
|
||||
Type: target.TcpTargetType.String(),
|
||||
Attributes: new(structpb.Struct),
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 28800},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: 1},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -310,9 +308,8 @@ func TestCreate(t *testing.T) {
|
||||
Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"default_port": structpb.NewNumberValue(2),
|
||||
}},
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 28800},
|
||||
ConnectionIdleTimeoutSeconds: &wrapperspb.UInt32Value{Value: 3600},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: 1},
|
||||
SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 28800},
|
||||
SessionConnectionLimit: &wrapperspb.UInt32Value{Value: 1},
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -455,14 +452,13 @@ func TestUpdate(t *testing.T) {
|
||||
name: "Update an Existing Target",
|
||||
req: &pbs.UpdateTargetRequest{
|
||||
UpdateMask: &field_mask.FieldMask{
|
||||
Paths: []string{"name", "description", "session_max_seconds", "connection_idle_timeout_seconds", "session_connection_limit"},
|
||||
Paths: []string{"name", "description", "session_max_seconds", "session_connection_limit"},
|
||||
},
|
||||
Item: &pb.Target{
|
||||
Name: wrapperspb.String("name"),
|
||||
Description: wrapperspb.String("desc"),
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
ConnectionIdleTimeoutSeconds: wrapperspb.UInt32(180),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
Name: wrapperspb.String("name"),
|
||||
Description: wrapperspb.String("desc"),
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
},
|
||||
},
|
||||
res: &pbs.UpdateTargetResponse{
|
||||
@@ -476,12 +472,11 @@ func TestUpdate(t *testing.T) {
|
||||
Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"default_port": structpb.NewNumberValue(2),
|
||||
}},
|
||||
CreatedTime: tar.GetCreateTime().GetTimestamp(),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
ConnectionIdleTimeoutSeconds: wrapperspb.UInt32(180),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
CreatedTime: tar.GetCreateTime().GetTimestamp(),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -509,11 +504,10 @@ func TestUpdate(t *testing.T) {
|
||||
Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"default_port": structpb.NewNumberValue(2),
|
||||
}},
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
ConnectionIdleTimeoutSeconds: wrapperspb.UInt32(180),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -595,11 +589,10 @@ func TestUpdate(t *testing.T) {
|
||||
Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"default_port": structpb.NewNumberValue(2),
|
||||
}},
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
ConnectionIdleTimeoutSeconds: wrapperspb.UInt32(180),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -627,11 +620,10 @@ func TestUpdate(t *testing.T) {
|
||||
Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"default_port": structpb.NewNumberValue(2),
|
||||
}},
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
ConnectionIdleTimeoutSeconds: wrapperspb.UInt32(180),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -658,12 +650,11 @@ func TestUpdate(t *testing.T) {
|
||||
Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{
|
||||
"default_port": structpb.NewNumberValue(2),
|
||||
}},
|
||||
Type: target.TcpTargetType.String(),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
ConnectionIdleTimeoutSeconds: wrapperspb.UInt32(180),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
Type: target.TcpTargetType.String(),
|
||||
HostSetIds: hsIds,
|
||||
HostSets: hostSets,
|
||||
SessionMaxSeconds: wrapperspb.UInt32(3600),
|
||||
SessionConnectionLimit: wrapperspb.UInt32(5),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
|
||||
@@ -99,11 +99,10 @@ func (ws *workerServiceServer) LookupSession(ctx context.Context, req *pbs.Looku
|
||||
SessionId: sessionInfo.GetPublicId(),
|
||||
Certificate: sessionInfo.Certificate,
|
||||
},
|
||||
Version: sessionInfo.Version,
|
||||
TofuToken: base64.StdEncoding.EncodeToString(sessionInfo.TofuToken),
|
||||
Endpoint: sessionInfo.Endpoint,
|
||||
Expiration: sessionInfo.ExpirationTime.Timestamp,
|
||||
ConnectionIdleTimeoutSeconds: sessionInfo.ConnectionIdleTimeoutSeconds,
|
||||
Version: sessionInfo.Version,
|
||||
TofuToken: base64.StdEncoding.EncodeToString(sessionInfo.TofuToken),
|
||||
Endpoint: sessionInfo.Endpoint,
|
||||
Expiration: sessionInfo.ExpirationTime.Timestamp,
|
||||
}
|
||||
|
||||
wrapper, err := ws.kms.GetWrapper(ctx, sessionInfo.ScopeId, kms.KeyPurposeSessions)
|
||||
|
||||
Reference in new issue
Block a user