diff --git a/actions/proto/vql.pb.go b/actions/proto/vql.pb.go index 30e1fb9b009..71bd52cd2db 100644 --- a/actions/proto/vql.pb.go +++ b/actions/proto/vql.pb.go @@ -29,7 +29,9 @@ type VQLRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + // DEPRECATED: Will be populated for compatibility with older clients. + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + // DEPRECATED: Not used any more. Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` VQL string `protobuf:"bytes,1,opt,name=VQL,proto3" json:"VQL,omitempty"` } diff --git a/actions/proto/vql.proto b/actions/proto/vql.proto index af07304199e..9d63187a227 100644 --- a/actions/proto/vql.proto +++ b/actions/proto/vql.proto @@ -10,9 +10,11 @@ package proto; option go_package = "www.velocidex.com/golang/velociraptor/actions/proto"; message VQLRequest { + // DEPRECATED: Will be populated for compatibility with older clients. string Name = 2 [(sem_type) = { description: "The name of this query. This should be descriptive to indicate what type of informaiton the query retrieves.", }]; + // DEPRECATED: Not used any more. string Description = 3 [(sem_type) = { description: "What this query is supposed to do.", }]; diff --git a/api/proto/api.pb.gw.go b/api/proto/api.pb.gw.go index 851003c7da1..7272b57185c 100644 --- a/api/proto/api.pb.gw.go +++ b/api/proto/api.pb.gw.go @@ -22,8 +22,8 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" - proto_5 "www.velocidex.com/golang/velociraptor/artifacts/proto" - proto_0 "www.velocidex.com/golang/velociraptor/flows/proto" + proto_6 "www.velocidex.com/golang/velociraptor/artifacts/proto" + proto_2 "www.velocidex.com/golang/velociraptor/flows/proto" ) // Suppress "imported and not used" errors @@ -739,7 +739,7 @@ var ( ) func request_API_VFSListDirectory_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.VFSListRequest + var protoReq proto_2.VFSListRequest var metadata runtime.ServerMetadata var ( @@ -772,7 +772,7 @@ func request_API_VFSListDirectory_0(ctx context.Context, marshaler runtime.Marsh } func local_request_API_VFSListDirectory_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.VFSListRequest + var protoReq proto_2.VFSListRequest var metadata runtime.ServerMetadata var ( @@ -843,7 +843,7 @@ var ( ) func request_API_VFSStatDirectory_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.VFSListRequest + var protoReq proto_2.VFSListRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -859,7 +859,7 @@ func request_API_VFSStatDirectory_0(ctx context.Context, marshaler runtime.Marsh } func local_request_API_VFSStatDirectory_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.VFSListRequest + var protoReq proto_2.VFSListRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -879,7 +879,7 @@ var ( ) func request_API_VFSStatDownload_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.VFSStatDownloadRequest + var protoReq proto_2.VFSStatDownloadRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -895,7 +895,7 @@ func request_API_VFSStatDownload_0(ctx context.Context, marshaler runtime.Marsha } func local_request_API_VFSStatDownload_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.VFSStatDownloadRequest + var protoReq proto_2.VFSStatDownloadRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -947,7 +947,7 @@ func local_request_API_GetTable_0(ctx context.Context, marshaler runtime.Marshal } func request_API_CollectArtifact_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.ArtifactCollectorArgs + var protoReq proto_2.ArtifactCollectorArgs var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -964,7 +964,7 @@ func request_API_CollectArtifact_0(ctx context.Context, marshaler runtime.Marsha } func local_request_API_CollectArtifact_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.ArtifactCollectorArgs + var protoReq proto_2.ArtifactCollectorArgs var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1283,7 +1283,7 @@ var ( ) func request_API_GetToolInfo_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_5.Tool + var protoReq proto_6.Tool var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -1299,7 +1299,7 @@ func request_API_GetToolInfo_0(ctx context.Context, marshaler runtime.Marshaler, } func local_request_API_GetToolInfo_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_5.Tool + var protoReq proto_6.Tool var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -1315,7 +1315,7 @@ func local_request_API_GetToolInfo_0(ctx context.Context, marshaler runtime.Mars } func request_API_SetToolInfo_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_5.Tool + var protoReq proto_6.Tool var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1332,7 +1332,7 @@ func request_API_SetToolInfo_0(ctx context.Context, marshaler runtime.Marshaler, } func local_request_API_SetToolInfo_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_5.Tool + var protoReq proto_6.Tool var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1401,7 +1401,7 @@ func local_request_API_GetServerMonitoringState_0(ctx context.Context, marshaler } func request_API_SetServerMonitoringState_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.ArtifactCollectorArgs + var protoReq proto_2.ArtifactCollectorArgs var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1418,7 +1418,7 @@ func request_API_SetServerMonitoringState_0(ctx context.Context, marshaler runti } func local_request_API_SetServerMonitoringState_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.ArtifactCollectorArgs + var protoReq proto_2.ArtifactCollectorArgs var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1453,7 +1453,7 @@ func local_request_API_GetClientMonitoringState_0(ctx context.Context, marshaler } func request_API_SetClientMonitoringState_0(ctx context.Context, marshaler runtime.Marshaler, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.ClientEventTable + var protoReq proto_2.ClientEventTable var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -1470,7 +1470,7 @@ func request_API_SetClientMonitoringState_0(ctx context.Context, marshaler runti } func local_request_API_SetClientMonitoringState_0(ctx context.Context, marshaler runtime.Marshaler, server APIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq proto_0.ClientEventTable + var protoReq proto_2.ClientEventTable var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) diff --git a/artifacts/proto/artifact.pb.go b/artifacts/proto/artifact.pb.go index 7212b01b264..e13b084f732 100644 --- a/artifacts/proto/artifact.pb.go +++ b/artifacts/proto/artifact.pb.go @@ -343,6 +343,8 @@ type Artifact struct { Author string `protobuf:"bytes,12,opt,name=author,proto3" json:"author,omitempty"` Reference []string `protobuf:"bytes,5,rep,name=reference,proto3" json:"reference,omitempty"` RequiredPermissions []string `protobuf:"bytes,13,rep,name=required_permissions,json=requiredPermissions,proto3" json:"required_permissions,omitempty"` + // Default resource limits. + Resources *Resources `protobuf:"bytes,19,opt,name=resources,proto3" json:"resources,omitempty"` // An optional list of tool descriptions. These are only used to // initialize Velociraptor if there is no previous tool // definition. It will not override existing tools. The user may @@ -435,6 +437,13 @@ func (x *Artifact) GetRequiredPermissions() []string { return nil } +func (x *Artifact) GetResources() *Resources { + if x != nil { + return x.Resources + } + return nil +} + func (x *Artifact) GetTools() []*Tool { if x != nil { return x.Tools @@ -775,6 +784,79 @@ func (x *ThirdParty) GetVersion() uint64 { return 0 } +type Resources struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Default timeout for this artifact + Timeout uint64 `protobuf:"varint,1,opt,name=timeout,proto3" json:"timeout,omitempty"` + OpsPerSecond float32 `protobuf:"fixed32,4,opt,name=ops_per_second,json=opsPerSecond,proto3" json:"ops_per_second,omitempty"` + // Default resource use for the entire collection. + MaxRows uint64 `protobuf:"varint,2,opt,name=max_rows,json=maxRows,proto3" json:"max_rows,omitempty"` + MaxUploadBytes uint64 `protobuf:"varint,3,opt,name=max_upload_bytes,json=maxUploadBytes,proto3" json:"max_upload_bytes,omitempty"` +} + +func (x *Resources) Reset() { + *x = Resources{} + if protoimpl.UnsafeEnabled { + mi := &file_artifact_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Resources) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resources) ProtoMessage() {} + +func (x *Resources) ProtoReflect() protoreflect.Message { + mi := &file_artifact_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Resources.ProtoReflect.Descriptor instead. +func (*Resources) Descriptor() ([]byte, []int) { + return file_artifact_proto_rawDescGZIP(), []int{8} +} + +func (x *Resources) GetTimeout() uint64 { + if x != nil { + return x.Timeout + } + return 0 +} + +func (x *Resources) GetOpsPerSecond() float32 { + if x != nil { + return x.OpsPerSecond + } + return 0 +} + +func (x *Resources) GetMaxRows() uint64 { + if x != nil { + return x.MaxRows + } + return 0 +} + +func (x *Resources) GetMaxUploadBytes() uint64 { + if x != nil { + return x.MaxUploadBytes + } + return 0 +} + var File_artifact_proto protoreflect.FileDescriptor var file_artifact_proto_rawDesc = []byte{ @@ -880,7 +962,7 @@ var file_artifact_proto_rawDesc = []byte{ 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x2e, 0x22, 0x92, 0x0c, 0x0a, 0x08, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, + 0x74, 0x65, 0x78, 0x74, 0x2e, 0x22, 0xc2, 0x0c, 0x0a, 0x08, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0xb1, 0x01, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x9c, 0x01, 0xe2, 0xfc, 0xe3, 0xc4, 0x01, 0x95, 0x01, 0x12, 0x92, 0x01, 0x54, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x72, @@ -912,7 +994,10 @@ var file_artifact_proto_rawDesc = []byte{ 0x65, 0x64, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x2e, 0x52, 0x13, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, + 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, + 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x05, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x6f, 0x6f, 0x6c, 0x52, 0x05, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x12, 0x68, 0x0a, 0x0c, 0x70, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, @@ -1010,11 +1095,20 @@ var file_artifact_proto_rawDesc = []byte{ 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x6f, 0x6f, 0x6c, 0x52, 0x05, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x37, 0x5a, 0x35, 0x77, 0x77, 0x77, - 0x2e, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x64, 0x65, 0x78, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, - 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x72, 0x61, 0x70, 0x74, - 0x6f, 0x72, 0x2f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x90, 0x01, 0x0a, 0x09, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x6f, 0x70, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x6f, 0x70, 0x73, 0x50, 0x65, + 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x72, + 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x52, 0x6f, + 0x77, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x61, + 0x78, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x37, 0x5a, 0x35, + 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x64, 0x65, 0x78, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x72, + 0x61, 0x70, 0x74, 0x6f, 0x72, 0x2f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1029,7 +1123,7 @@ func file_artifact_proto_rawDescGZIP() []byte { return file_artifact_proto_rawDescData } -var file_artifact_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_artifact_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_artifact_proto_goTypes = []interface{}{ (*ColumnType)(nil), // 0: proto.ColumnType (*ArtifactParameter)(nil), // 1: proto.ArtifactParameter @@ -1039,21 +1133,23 @@ var file_artifact_proto_goTypes = []interface{}{ (*ArtifactDescriptors)(nil), // 5: proto.ArtifactDescriptors (*Tool)(nil), // 6: proto.Tool (*ThirdParty)(nil), // 7: proto.third_party + (*Resources)(nil), // 8: proto.Resources } var file_artifact_proto_depIdxs = []int32{ 1, // 0: proto.Report.parameters:type_name -> proto.ArtifactParameter - 6, // 1: proto.Artifact.tools:type_name -> proto.Tool - 1, // 2: proto.Artifact.parameters:type_name -> proto.ArtifactParameter - 2, // 3: proto.Artifact.sources:type_name -> proto.ArtifactSource - 3, // 4: proto.Artifact.reports:type_name -> proto.Report - 0, // 5: proto.Artifact.column_types:type_name -> proto.ColumnType - 4, // 6: proto.ArtifactDescriptors.items:type_name -> proto.Artifact - 6, // 7: proto.third_party.tools:type_name -> proto.Tool - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 8, // 1: proto.Artifact.resources:type_name -> proto.Resources + 6, // 2: proto.Artifact.tools:type_name -> proto.Tool + 1, // 3: proto.Artifact.parameters:type_name -> proto.ArtifactParameter + 2, // 4: proto.Artifact.sources:type_name -> proto.ArtifactSource + 3, // 5: proto.Artifact.reports:type_name -> proto.Report + 0, // 6: proto.Artifact.column_types:type_name -> proto.ColumnType + 4, // 7: proto.ArtifactDescriptors.items:type_name -> proto.Artifact + 6, // 8: proto.third_party.tools:type_name -> proto.Tool + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_artifact_proto_init() } @@ -1158,6 +1254,18 @@ func file_artifact_proto_init() { return nil } } + file_artifact_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Resources); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1165,7 +1273,7 @@ func file_artifact_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_artifact_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/artifacts/proto/artifact.proto b/artifacts/proto/artifact.proto index c37a406cc23..4721546d236 100644 --- a/artifacts/proto/artifact.proto +++ b/artifacts/proto/artifact.proto @@ -118,6 +118,9 @@ message Artifact { description: "A list of required permissions to collect this artifact." }]; + // Default resource limits. + Resources resources = 19; + // An optional list of tool descriptions. These are only used to // initialize Velociraptor if there is no previous tool // definition. It will not override existing tools. The user may @@ -242,3 +245,14 @@ message third_party { repeated Tool tools = 1; uint64 version = 2; } + + +message Resources { + // Default timeout for this artifact + uint64 timeout = 1; + float ops_per_second = 4; + + // Default resource use for the entire collection. + uint64 max_rows = 2; + uint64 max_upload_bytes = 3; +} \ No newline at end of file diff --git a/flows/artifacts_test.go b/flows/artifacts_test.go index 2936ac6cefb..5ed50045190 100644 --- a/flows/artifacts_test.go +++ b/flows/artifacts_test.go @@ -329,7 +329,7 @@ func (self *TestSuite) TestResourceLimits() { self.client_id, flow_id) assert.NoError(self.T(), err) - // Collection has 1 row and it is still in the running state. + // Collection has 2 rows and it is still in the running state. assert.Equal(self.T(), collection_context.TotalCollectedRows, uint64(2)) assert.Equal(self.T(), collection_context.State, flows_proto.ArtifactCollectorContext_RUNNING) @@ -347,7 +347,7 @@ func (self *TestSuite) TestResourceLimits() { self.client_id, flow_id) assert.NoError(self.T(), err) - // Collection has 1 row and it is still in the running state. + // Collection has 7 rows and it is still in the running state. assert.Equal(self.T(), collection_context.TotalCollectedRows, uint64(7)) assert.Equal(self.T(), collection_context.State, flows_proto.ArtifactCollectorContext_ERROR) diff --git a/gui/velociraptor/src/components/flows/new-collection.js b/gui/velociraptor/src/components/flows/new-collection.js index 93268c7e3e2..e3ceda4cf2b 100644 --- a/gui/velociraptor/src/components/flows/new-collection.js +++ b/gui/velociraptor/src/components/flows/new-collection.js @@ -344,6 +344,7 @@ class NewCollectionConfigParameters extends React.Component { class NewCollectionResources extends React.Component { static propTypes = { + artifacts: PropTypes.array, resources: PropTypes.object, setResources: PropTypes.func, paginator: PropTypes.object, @@ -356,6 +357,24 @@ class NewCollectionResources extends React.Component { this.state.invalid_3 || this.state.invalid_4; } + getTimeout = (artifacts) => { + let timeout = 0; + _.each(artifacts, (definition) => { + let def_timeout = definition.resources && definition.resources.timeout; + def_timeout = def_timeout || 0; + + if (def_timeout > timeout) { + timeout = def_timeout; + } + }); + + if (timeout === 0) { + timeout = 600; + } + + return timeout + "s per artifact"; + } + render() { let resources = this.props.resources || {}; return ( @@ -380,7 +399,7 @@ class NewCollectionResources extends React.Component {