Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Syslog source (#500)
Bill Richc78120e56f2d
diff --git a/README.md b/README.mdindex e97dc7690..db8e9b687 100644--- a/README.md+++ b/README.md@@ -96,6 +96,7 @@ TruffleHog has a sub-command for each source of data that you may want to scan:- gitlab- S3- filesystem+- syslog- file and stdin (coming soon)Each subcommand can have options that you can see with the `-h` flag provided to the sub command:diff --git a/go.mod b/go.modindex 92de1fa2b..a3ceb04fe 100644--- a/go.mod+++ b/go.mod@@ -13,8 +13,10 @@ require (github.com/aws/aws-sdk-go v1.44.4github.com/aws/aws-sdk-go-v2/credentials v1.12.0github.com/aws/aws-sdk-go-v2/service/sts v1.16.4+ github.com/bill-rich/go-syslog v0.0.0-20220413021637-49edb52a574cgithub.com/bitfinexcom/bitfinex-api-go v0.0.0-20210608095005-9e0b26f200fbgithub.com/bradleyfalzon/ghinstallation/v2 v2.0.4+ github.com/crewjam/rfc5424 v0.1.0github.com/envoyproxy/protoc-gen-validate v0.6.7github.com/fatih/color v1.13.0github.com/felixge/fgprof v0.9.2diff --git a/go.sum b/go.sumindex b8777ec06..3e6fa7ee4 100644--- a/go.sum+++ b/go.sum@@ -116,6 +116,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.16.4/go.mod h1:lfSYenAXtavyX2A1LsViggithub.com/aws/smithy-go v1.11.2 h1:eG/N+CcUMAvsdffgMvjMKwfyDzIkjM6pfxMJ8Mzc6mE=github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM=github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=+github.com/bill-rich/go-syslog v0.0.0-20220413021637-49edb52a574c h1:tSME5FDS02qQll3JYodI6RZR/g4EKOHApGv1wMZT+Z0=+github.com/bill-rich/go-syslog v0.0.0-20220413021637-49edb52a574c/go.mod h1:+sCc6hztur+oZCLOsNk6wCCy+GLrnSNHSRmTnnL+8iQ=github.com/bitfinexcom/bitfinex-api-go v0.0.0-20210608095005-9e0b26f200fb h1:9v7Bzlg+1EBYi2IYcUmOwHReBEfqBbYIj3ZCi9cIe1Q=github.com/bitfinexcom/bitfinex-api-go v0.0.0-20210608095005-9e0b26f200fb/go.mod h1:EkOqCuelvo7DY8vCOoZ09p7pHvAK9B1PHI9GeM4Rdxc=github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=@@ -141,6 +143,8 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Eegithub.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=+github.com/crewjam/rfc5424 v0.1.0 h1:MSeXJm22oKovLzWj44AHwaItjIMUMugYGkEzfa831H8=+github.com/crewjam/rfc5424 v0.1.0/go.mod h1:RCi9M3xHVOeerf6ULZzqv2xOGRO/zYaVUeRyPnBW3gQ=github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=diff --git a/main.go b/main.goindex f290207fc..6e0d9e07d 100644--- a/main.go+++ b/main.go@@ -81,6 +81,13 @@ var (s3ScanSecret = s3Scan.Flag("secret", "S3 secret used to authenticate.").String()s3ScanCloudEnv = s3Scan.Flag("cloud-environment", "Use IAM credentials in cloud environment.").Bool()s3ScanBuckets = s3Scan.Flag("bucket", "Name of S3 bucket to scan. You can repeat this flag.").Strings()++ syslogScan = cli.Command("syslog", "Scan syslog")+ syslogAddress = syslogScan.Flag("address", "Address and port to listen on for syslog. Example: 127.0.0.1:514").String()+ syslogProtocol = syslogScan.Flag("protocol", "Protocol to listen on. udp or tcp").String()+ syslogTLSCert = syslogScan.Flag("cert", "Path to TLS cert.").String()+ syslogTLSKey = syslogScan.Flag("key", "Path to TLS key.").String()+ syslogFormat = syslogScan.Flag("format", "Log format. Can be rfc3164 or rfc5424").String())func init() {@@ -204,6 +211,11 @@ func run(state overseer.State) {if err != nil {logrus.WithError(err).Fatal("Failed to scan S3.")}+ case syslogScan.FullCommand():+ err := e.ScanSyslog(ctx, *syslogAddress, *syslogProtocol, *syslogTLSCert, *syslogTLSKey, *syslogFormat, *concurrency)+ if err != nil {+ logrus.WithError(err).Fatal("Failed to scan syslog.")+ }}if !*jsonLegacy && !*jsonOut {diff --git a/pkg/engine/syslog.go b/pkg/engine/syslog.gonew file mode 100644index 000000000..555089ca5--- /dev/null+++ b/pkg/engine/syslog.go@@ -0,0 +1,57 @@+package engine++import (+ "context"+ "github.com/go-errors/errors"+ "github.com/sirupsen/logrus"+ "google.golang.org/protobuf/proto"+ "google.golang.org/protobuf/types/known/anypb"+ "os"++ "github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb"+ "github.com/trufflesecurity/trufflehog/v3/pkg/sources/syslog"+)++func (e *Engine) ScanSyslog(ctx context.Context, address, protocol, certPath, keyPath, format string, concurrency int) error {+ connection := &sourcespb.Syslog{+ Protocol: protocol,+ ListenAddress: address,+ Format: format,+ }++ if certPath != "" && keyPath != "" {+ cert, err := os.ReadFile(certPath)+ if err != nil {+ return errors.WrapPrefix(err, "could not open TLS cert file", 0)+ }+ connection.TlsCert = string(cert)++ key, err := os.ReadFile(keyPath)+ if err != nil {+ return errors.WrapPrefix(err, "could not open TLS key file", 0)+ }+ connection.TlsKey = string(key)+ }++ var conn anypb.Any+ err := anypb.MarshalFrom(&conn, connection, proto.MarshalOptions{})+ if err != nil {+ return errors.WrapPrefix(err, "error unmarshalling connection", 0)+ }+ source := syslog.Source{}+ err = source.Init(ctx, "trufflehog - syslog", 0, 0, false, &conn, concurrency)+ source.InjectConnection(connection)+ if err != nil {+ logrus.WithError(err).Error("failed to initialize syslog source")+ return err+ }++ go func() {+ err := source.Chunks(ctx, e.ChunksChan())+ if err != nil {+ logrus.WithError(err).Fatal("could not scan syslog")+ }+ close(e.ChunksChan())+ }()+ return nil+}diff --git a/pkg/pb/source_metadatapb/source_metadata.pb.go b/pkg/pb/source_metadatapb/source_metadata.pb.goindex 56769f3cf..1c69f3b3e 100644--- a/pkg/pb/source_metadatapb/source_metadata.pb.go+++ b/pkg/pb/source_metadatapb/source_metadata.pb.go@@ -1895,6 +1895,93 @@ func (x *Artifactory) GetEmail() string {return ""}+type Syslog struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"`+ Appname string `protobuf:"bytes,2,opt,name=appname,proto3" json:"appname,omitempty"`+ Procid string `protobuf:"bytes,3,opt,name=procid,proto3" json:"procid,omitempty"`+ Timestamp string `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`+ Client string `protobuf:"bytes,5,opt,name=client,proto3" json:"client,omitempty"`+ Facility string `protobuf:"bytes,6,opt,name=facility,proto3" json:"facility,omitempty"`+}++func (x *Syslog) Reset() {+ *x = Syslog{}+ if protoimpl.UnsafeEnabled {+ mi := &file_source_metadata_proto_msgTypes[22]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *Syslog) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Syslog) ProtoMessage() {}++func (x *Syslog) ProtoReflect() protoreflect.Message {+ mi := &file_source_metadata_proto_msgTypes[22]+ 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 Syslog.ProtoReflect.Descriptor instead.+func (*Syslog) Descriptor() ([]byte, []int) {+ return file_source_metadata_proto_rawDescGZIP(), []int{22}+}++func (x *Syslog) GetHostname() string {+ if x != nil {+ return x.Hostname+ }+ return ""+}++func (x *Syslog) GetAppname() string {+ if x != nil {+ return x.Appname+ }+ return ""+}++func (x *Syslog) GetProcid() string {+ if x != nil {+ return x.Procid+ }+ return ""+}++func (x *Syslog) GetTimestamp() string {+ if x != nil {+ return x.Timestamp+ }+ return ""+}++func (x *Syslog) GetClient() string {+ if x != nil {+ return x.Client+ }+ return ""+}++func (x *Syslog) GetFacility() string {+ if x != nil {+ return x.Facility+ }+ return ""+}+type MetaData struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -1923,13 +2010,14 @@ type MetaData struct {// *MetaData_Jenkins// *MetaData_Teams// *MetaData_Artifactory+ // *MetaData_SyslogData isMetaData_Data `protobuf_oneof:"data"`}func (x *MetaData) Reset() {*x = MetaData{}if protoimpl.UnsafeEnabled {- mi := &file_source_metadata_proto_msgTypes[22]+ mi := &file_source_metadata_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1942,7 +2030,7 @@ func (x *MetaData) String() string {func (*MetaData) ProtoMessage() {}func (x *MetaData) ProtoReflect() protoreflect.Message {- mi := &file_source_metadata_proto_msgTypes[22]+ mi := &file_source_metadata_proto_msgTypes[23]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1955,7 +2043,7 @@ func (x *MetaData) ProtoReflect() protoreflect.Message {// Deprecated: Use MetaData.ProtoReflect.Descriptor instead.func (*MetaData) Descriptor() ([]byte, []int) {- return file_source_metadata_proto_rawDescGZIP(), []int{22}+ return file_source_metadata_proto_rawDescGZIP(), []int{23}}func (m *MetaData) GetData() isMetaData_Data {@@ -2119,6 +2207,13 @@ func (x *MetaData) GetArtifactory() *Artifactory {return nil}+func (x *MetaData) GetSyslog() *Syslog {+ if x, ok := x.GetData().(*MetaData_Syslog); ok {+ return x.Syslog+ }+ return nil+}+type isMetaData_Data interface {isMetaData_Data()}@@ -2211,6 +2306,10 @@ type MetaData_Artifactory struct {Artifactory *Artifactory `protobuf:"bytes,22,opt,name=artifactory,proto3,oneof"`}+type MetaData_Syslog struct {+ Syslog *Syslog `protobuf:"bytes,23,opt,name=syslog,proto3,oneof"`+}+func (*MetaData_Azure) isMetaData_Data() {}func (*MetaData_Bitbucket) isMetaData_Data() {}@@ -2255,6 +2354,8 @@ func (*MetaData_Teams) isMetaData_Data() {}func (*MetaData_Artifactory) isMetaData_Data() {}+func (*MetaData_Syslog) isMetaData_Data() {}+var File_source_metadata_proto protoreflect.FileDescriptorvar file_source_metadata_proto_rawDesc = []byte{@@ -2467,83 +2568,97 @@ var file_source_metadata_proto_rawDesc = []byte{0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72,0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20,- 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0xf4, 0x08, 0x0a, 0x08, 0x4d,- 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x05, 0x61, 0x7a, 0x75, 0x72, 0x65,- 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,- 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x48, 0x00,- 0x52, 0x05, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x62, 0x69, 0x74, 0x62, 0x75,- 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x6f, 0x75,- 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x42, 0x69, 0x74,- 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x00, 0x52, 0x09, 0x62, 0x69, 0x74, 0x62, 0x75, 0x63,- 0x6b, 0x65, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x63, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x63, 0x69, 0x18,- 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d,- 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x43, 0x49,- 0x48, 0x00, 0x52, 0x08, 0x63, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x63, 0x69, 0x12, 0x3d, 0x0a, 0x0a,- 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,- 0x32, 0x1b, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,- 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52,- 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x64,- 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x68, 0x75, 0x62, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,- 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,- 0x2e, 0x44, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x68, 0x75, 0x62, 0x48, 0x00, 0x52, 0x09, 0x64, 0x6f,- 0x63, 0x6b, 0x65, 0x72, 0x68, 0x75, 0x62, 0x12, 0x28, 0x0a, 0x03, 0x65, 0x63, 0x72, 0x18, 0x06,- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65,- 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x45, 0x43, 0x52, 0x48, 0x00, 0x52, 0x03, 0x65, 0x63,- 0x72, 0x12, 0x28, 0x0a, 0x03, 0x67, 0x63, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,- 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,- 0x2e, 0x47, 0x43, 0x53, 0x48, 0x00, 0x52, 0x03, 0x67, 0x63, 0x73, 0x12, 0x31, 0x0a, 0x06, 0x67,- 0x69, 0x74, 0x68, 0x75, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6f,- 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x69,- 0x74, 0x68, 0x75, 0x62, 0x48, 0x00, 0x52, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x12, 0x31,- 0x0a, 0x06, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,- 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,- 0x2e, 0x47, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x48, 0x00, 0x52, 0x06, 0x67, 0x69, 0x74, 0x6c, 0x61,- 0x62, 0x12, 0x2b, 0x0a, 0x04, 0x6a, 0x69, 0x72, 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32,- 0x15, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,- 0x61, 0x2e, 0x4a, 0x69, 0x72, 0x61, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x69, 0x72, 0x61, 0x12, 0x28,- 0x0a, 0x03, 0x6e, 0x70, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x6f,- 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4e, 0x50,- 0x4d, 0x48, 0x00, 0x52, 0x03, 0x6e, 0x70, 0x6d, 0x12, 0x2b, 0x0a, 0x04, 0x70, 0x79, 0x70, 0x69,- 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,- 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x79, 0x50, 0x69, 0x48, 0x00, 0x52,- 0x04, 0x70, 0x79, 0x70, 0x69, 0x12, 0x25, 0x0a, 0x02, 0x73, 0x33, 0x18, 0x0d, 0x20, 0x01, 0x28,- 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64,- 0x61, 0x74, 0x61, 0x2e, 0x53, 0x33, 0x48, 0x00, 0x52, 0x02, 0x73, 0x33, 0x12, 0x2e, 0x0a, 0x05,- 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x6f,- 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x6c,- 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x05, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x3d, 0x0a, 0x0a,- 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b,- 0x32, 0x1b, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,- 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52,- 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x28, 0x0a, 0x03, 0x67,- 0x69, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63,- 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x69, 0x74, 0x48, 0x00,- 0x52, 0x03, 0x67, 0x69, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74, 0x18, 0x11, 0x20,- 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74,- 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x74, 0x65,- 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65, 0x18,- 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d,- 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74,- 0x65, 0x48, 0x00, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65, 0x12, 0x31,- 0x0a, 0x06, 0x67, 0x65, 0x72, 0x72, 0x69, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0xa8, 0x01, 0x0a, 0x06, 0x53,+ 0x79, 0x73, 0x6c, 0x6f, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d,+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d,+ 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70,+ 0x72, 0x6f, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x6f,+ 0x63, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,+ 0x70, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x61, 0x63,+ 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x61, 0x63,+ 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xa7, 0x09, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61,+ 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x05, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,+ 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64,+ 0x61, 0x74, 0x61, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x05, 0x61, 0x7a, 0x75,+ 0x72, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x62, 0x69, 0x74, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18,+ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d,+ 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x42, 0x69, 0x74, 0x62, 0x75, 0x63, 0x6b, 0x65,+ 0x74, 0x48, 0x00, 0x52, 0x09, 0x62, 0x69, 0x74, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x37,+ 0x0a, 0x08, 0x63, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x63, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,+ 0x32, 0x19, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,+ 0x74, 0x61, 0x2e, 0x43, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x43, 0x49, 0x48, 0x00, 0x52, 0x08, 0x63,+ 0x69, 0x72, 0x63, 0x6c, 0x65, 0x63, 0x69, 0x12, 0x3d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x6c,+ 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6f,+ 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f,+ 0x6e, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66,+ 0x6c, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72,+ 0x68, 0x75, 0x62, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x6f, 0x75, 0x72,+ 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x44, 0x6f, 0x63, 0x6b,+ 0x65, 0x72, 0x68, 0x75, 0x62, 0x48, 0x00, 0x52, 0x09, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x68,+ 0x75, 0x62, 0x12, 0x28, 0x0a, 0x03, 0x65, 0x63, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x14, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,+ 0x61, 0x2e, 0x45, 0x43, 0x52, 0x48, 0x00, 0x52, 0x03, 0x65, 0x63, 0x72, 0x12, 0x28, 0x0a, 0x03,+ 0x67, 0x63, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x6f, 0x75, 0x72,+ 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x43, 0x53, 0x48,+ 0x00, 0x52, 0x03, 0x67, 0x63, 0x73, 0x12, 0x31, 0x0a, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,+ 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,+ 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x69, 0x74, 0x68, 0x75, 0x62, 0x48,+ 0x00, 0x52, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x12, 0x31, 0x0a, 0x06, 0x67, 0x69, 0x74,+ 0x6c, 0x61, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6f, 0x75, 0x72,+ 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x69, 0x74, 0x6c,+ 0x61, 0x62, 0x48, 0x00, 0x52, 0x06, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x12, 0x2b, 0x0a, 0x04,+ 0x6a, 0x69, 0x72, 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6f, 0x75,+ 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4a, 0x69, 0x72,+ 0x61, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x69, 0x72, 0x61, 0x12, 0x28, 0x0a, 0x03, 0x6e, 0x70, 0x6d,+ 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,+ 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4e, 0x50, 0x4d, 0x48, 0x00, 0x52, 0x03,+ 0x6e, 0x70, 0x6d, 0x12, 0x2b, 0x0a, 0x04, 0x70, 0x79, 0x70, 0x69, 0x18, 0x0c, 0x20, 0x01, 0x28,+ 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64,+ 0x61, 0x74, 0x61, 0x2e, 0x50, 0x79, 0x50, 0x69, 0x48, 0x00, 0x52, 0x04, 0x70, 0x79, 0x70, 0x69,+ 0x12, 0x25, 0x0a, 0x02, 0x73, 0x33, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73,+ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53,+ 0x33, 0x48, 0x00, 0x52, 0x02, 0x73, 0x33, 0x12, 0x2e, 0x0a, 0x05, 0x73, 0x6c, 0x61, 0x63, 0x6b,+ 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,+ 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x48, 0x00,+ 0x52, 0x05, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x3d, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x73,+ 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6f,+ 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x46, 0x69,+ 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65,+ 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x28, 0x0a, 0x03, 0x67, 0x69, 0x74, 0x18, 0x10, 0x20,+ 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74,+ 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x69, 0x74, 0x48, 0x00, 0x52, 0x03, 0x67, 0x69, 0x74,+ 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15,0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,- 0x2e, 0x47, 0x65, 0x72, 0x72, 0x69, 0x74, 0x48, 0x00, 0x52, 0x06, 0x67, 0x65, 0x72, 0x72, 0x69,- 0x74, 0x12, 0x34, 0x0a, 0x07, 0x6a, 0x65, 0x6e, 0x6b, 0x69, 0x6e, 0x73, 0x18, 0x14, 0x20, 0x01,- 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61,- 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4a, 0x65, 0x6e, 0x6b, 0x69, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07,- 0x6a, 0x65, 0x6e, 0x6b, 0x69, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73,- 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,- 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x48, 0x00,- 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x40, 0x0a, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x66,- 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73,- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x41,- 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x72,- 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74,- 0x61, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,- 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f,- 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x68, 0x6f, 0x67, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b,- 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61,- 0x64, 0x61, 0x74, 0x61, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x2e, 0x54, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x74, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a,+ 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b,+ 0x32, 0x1a, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,+ 0x74, 0x61, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65, 0x48, 0x00, 0x52, 0x09,+ 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x67, 0x65, 0x72,+ 0x72, 0x69, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6f, 0x75, 0x72,+ 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x65, 0x72, 0x72,+ 0x69, 0x74, 0x48, 0x00, 0x52, 0x06, 0x67, 0x65, 0x72, 0x72, 0x69, 0x74, 0x12, 0x34, 0x0a, 0x07,+ 0x6a, 0x65, 0x6e, 0x6b, 0x69, 0x6e, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e,+ 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e,+ 0x4a, 0x65, 0x6e, 0x6b, 0x69, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x6a, 0x65, 0x6e, 0x6b, 0x69,+ 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28,+ 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64,+ 0x61, 0x74, 0x61, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x48, 0x00, 0x52, 0x05, 0x74, 0x65, 0x61,+ 0x6d, 0x73, 0x12, 0x40, 0x0a, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72,+ 0x79, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,+ 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61,+ 0x63, 0x74, 0x6f, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63,+ 0x74, 0x6f, 0x72, 0x79, 0x12, 0x31, 0x0a, 0x06, 0x73, 0x79, 0x73, 0x6c, 0x6f, 0x67, 0x18, 0x17,+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65,+ 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x79, 0x73, 0x6c, 0x6f, 0x67, 0x48, 0x00, 0x52,+ 0x06, 0x73, 0x79, 0x73, 0x6c, 0x6f, 0x67, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42,+ 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72,+ 0x75, 0x66, 0x66, 0x6c, 0x65, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74, 0x72,+ 0x75, 0x66, 0x66, 0x6c, 0x65, 0x68, 0x6f, 0x67, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b, 0x67, 0x2f,+ 0x70, 0x62, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,+ 0x74, 0x61, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -2558,7 +2673,7 @@ func file_source_metadata_proto_rawDescGZIP() []byte {return file_source_metadata_proto_rawDescData}-var file_source_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 23)+var file_source_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 24)var file_source_metadata_proto_goTypes = []interface{}{(*Azure)(nil), // 0: source_metadata.Azure(*Bitbucket)(nil), // 1: source_metadata.Bitbucket@@ -2582,7 +2697,8 @@ var file_source_metadata_proto_goTypes = []interface{}{(*Jenkins)(nil), // 19: source_metadata.Jenkins(*Teams)(nil), // 20: source_metadata.Teams(*Artifactory)(nil), // 21: source_metadata.Artifactory- (*MetaData)(nil), // 22: source_metadata.MetaData+ (*Syslog)(nil), // 22: source_metadata.Syslog+ (*MetaData)(nil), // 23: source_metadata.MetaData}var file_source_metadata_proto_depIdxs = []int32{0, // 0: source_metadata.MetaData.azure:type_name -> source_metadata.Azure@@ -2607,11 +2723,12 @@ var file_source_metadata_proto_depIdxs = []int32{19, // 19: source_metadata.MetaData.jenkins:type_name -> source_metadata.Jenkins20, // 20: source_metadata.MetaData.teams:type_name -> source_metadata.Teams21, // 21: source_metadata.MetaData.artifactory:type_name -> source_metadata.Artifactory- 22, // [22:22] is the sub-list for method output_type- 22, // [22:22] is the sub-list for method input_type- 22, // [22:22] is the sub-list for extension type_name- 22, // [22:22] is the sub-list for extension extendee- 0, // [0:22] is the sub-list for field type_name+ 22, // 22: source_metadata.MetaData.syslog:type_name -> source_metadata.Syslog+ 23, // [23:23] is the sub-list for method output_type+ 23, // [23:23] is the sub-list for method input_type+ 23, // [23:23] is the sub-list for extension type_name+ 23, // [23:23] is the sub-list for extension extendee+ 0, // [0:23] is the sub-list for field type_name}func init() { file_source_metadata_proto_init() }@@ -2885,6 +3002,18 @@ func file_source_metadata_proto_init() {}}file_source_metadata_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Syslog); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_source_metadata_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*MetaData); i {case 0:return &v.state@@ -2897,7 +3026,7 @@ func file_source_metadata_proto_init() {}}}- file_source_metadata_proto_msgTypes[22].OneofWrappers = []interface{}{+ file_source_metadata_proto_msgTypes[23].OneofWrappers = []interface{}{(*MetaData_Azure)(nil),(*MetaData_Bitbucket)(nil),(*MetaData_Circleci)(nil),@@ -2920,6 +3049,7 @@ func file_source_metadata_proto_init() {(*MetaData_Jenkins)(nil),(*MetaData_Teams)(nil),(*MetaData_Artifactory)(nil),+ (*MetaData_Syslog)(nil),}type x struct{}out := protoimpl.TypeBuilder{@@ -2927,7 +3057,7 @@ func file_source_metadata_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_source_metadata_proto_rawDesc,NumEnums: 0,- NumMessages: 23,+ NumMessages: 24,NumExtensions: 0,NumServices: 0,},diff --git a/pkg/pb/source_metadatapb/source_metadata.pb.validate.go b/pkg/pb/source_metadatapb/source_metadata.pb.validate.goindex 44621546d..33a09ca94 100644--- a/pkg/pb/source_metadatapb/source_metadata.pb.validate.go+++ b/pkg/pb/source_metadatapb/source_metadata.pb.validate.go@@ -2452,6 +2452,116 @@ var _ interface {ErrorName() string} = ArtifactoryValidationError{}+// Validate checks the field values on Syslog with the rules defined in the+// proto definition for this message. If any rules are violated, the first+// error encountered is returned, or nil if there are no violations.+func (m *Syslog) Validate() error {+ return m.validate(false)+}++// ValidateAll checks the field values on Syslog with the rules defined in the+// proto definition for this message. If any rules are violated, the result is+// a list of violation errors wrapped in SyslogMultiError, or nil if none found.+func (m *Syslog) ValidateAll() error {+ return m.validate(true)+}++func (m *Syslog) validate(all bool) error {+ if m == nil {+ return nil+ }++ var errors []error++ // no validation rules for Hostname++ // no validation rules for Appname++ // no validation rules for Procid++ // no validation rules for Timestamp++ // no validation rules for Client++ // no validation rules for Facility++ if len(errors) > 0 {+ return SyslogMultiError(errors)+ }++ return nil+}++// SyslogMultiError is an error wrapping multiple validation errors returned by+// Syslog.ValidateAll() if the designated constraints aren't met.+type SyslogMultiError []error++// Error returns a concatenation of all the error messages it wraps.+func (m SyslogMultiError) Error() string {+ var msgs []string+ for _, err := range m {+ msgs = append(msgs, err.Error())+ }+ return strings.Join(msgs, "; ")+}++// AllErrors returns a list of validation violation errors.+func (m SyslogMultiError) AllErrors() []error { return m }++// SyslogValidationError is the validation error returned by Syslog.Validate if+// the designated constraints aren't met.+type SyslogValidationError struct {+ field string+ reason string+ cause error+ key bool+}++// Field function returns field value.+func (e SyslogValidationError) Field() string { return e.field }++// Reason function returns reason value.+func (e SyslogValidationError) Reason() string { return e.reason }++// Cause function returns cause value.+func (e SyslogValidationError) Cause() error { return e.cause }++// Key function returns key value.+func (e SyslogValidationError) Key() bool { return e.key }++// ErrorName returns error name.+func (e SyslogValidationError) ErrorName() string { return "SyslogValidationError" }++// Error satisfies the builtin error interface+func (e SyslogValidationError) Error() string {+ cause := ""+ if e.cause != nil {+ cause = fmt.Sprintf(" | caused by: %v", e.cause)+ }++ key := ""+ if e.key {+ key = "key for "+ }++ return fmt.Sprintf(+ "invalid %sSyslog.%s: %s%s",+ key,+ e.field,+ e.reason,+ cause)+}++var _ error = SyslogValidationError{}++var _ interface {+ Field() string+ Reason() string+ Key() bool+ Cause() error+ ErrorName() string+} = SyslogValidationError{}+// Validate checks the field values on MetaData with the rules defined in the// proto definition for this message. If any rules are violated, the first// error encountered is returned, or nil if there are no violations.@@ -3158,6 +3268,37 @@ func (m *MetaData) validate(all bool) error {}}+ case *MetaData_Syslog:++ if all {+ switch v := interface{}(m.GetSyslog()).(type) {+ case interface{ ValidateAll() error }:+ if err := v.ValidateAll(); err != nil {+ errors = append(errors, MetaDataValidationError{+ field: "Syslog",+ reason: "embedded message failed validation",+ cause: err,+ })+ }+ case interface{ Validate() error }:+ if err := v.Validate(); err != nil {+ errors = append(errors, MetaDataValidationError{+ field: "Syslog",+ reason: "embedded message failed validation",+ cause: err,+ })+ }+ }+ } else if v, ok := interface{}(m.GetSyslog()).(interface{ Validate() error }); ok {+ if err := v.Validate(); err != nil {+ return MetaDataValidationError{+ field: "Syslog",+ reason: "embedded message failed validation",+ cause: err,+ }+ }+ }+}if len(errors) > 0 {diff --git a/pkg/pb/sourcespb/sources.pb.go b/pkg/pb/sourcespb/sources.pb.goindex e5b6dfaad..7ef7100d0 100644--- a/pkg/pb/sourcespb/sources.pb.go+++ b/pkg/pb/sourcespb/sources.pb.go@@ -52,6 +52,7 @@ const (SourceType_SOURCE_TYPE_JENKINS SourceType = 22SourceType_SOURCE_TYPE_TEAMS SourceType = 23SourceType_SOURCE_TYPE_JFROG_ARTIFACTORY SourceType = 24+ SourceType_SOURCE_TYPE_SYSLOG SourceType = 25)// Enum value maps for SourceType.@@ -82,6 +83,7 @@ var (22: "SOURCE_TYPE_JENKINS",23: "SOURCE_TYPE_TEAMS",24: "SOURCE_TYPE_JFROG_ARTIFACTORY",+ 25: "SOURCE_TYPE_SYSLOG",}SourceType_value = map[string]int32{"SOURCE_TYPE_AZURE_STORAGE": 0,@@ -109,6 +111,7 @@ var ("SOURCE_TYPE_JENKINS": 22,"SOURCE_TYPE_TEAMS": 23,"SOURCE_TYPE_JFROG_ARTIFACTORY": 24,+ "SOURCE_TYPE_SYSLOG": 25,})@@ -2233,6 +2236,85 @@ func (*Artifactory_BasicAuth) isArtifactory_Credential() {}func (*Artifactory_AccessToken) isArtifactory_Credential() {}+type Syslog struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Protocol string `protobuf:"bytes,1,opt,name=protocol,proto3" json:"protocol,omitempty"`+ ListenAddress string `protobuf:"bytes,2,opt,name=listenAddress,proto3" json:"listenAddress,omitempty"`+ TlsCert string `protobuf:"bytes,3,opt,name=tlsCert,proto3" json:"tlsCert,omitempty"`+ TlsKey string `protobuf:"bytes,4,opt,name=tlsKey,proto3" json:"tlsKey,omitempty"`+ Format string `protobuf:"bytes,5,opt,name=format,proto3" json:"format,omitempty"`+}++func (x *Syslog) Reset() {+ *x = Syslog{}+ if protoimpl.UnsafeEnabled {+ mi := &file_sources_proto_msgTypes[23]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *Syslog) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*Syslog) ProtoMessage() {}++func (x *Syslog) ProtoReflect() protoreflect.Message {+ mi := &file_sources_proto_msgTypes[23]+ 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 Syslog.ProtoReflect.Descriptor instead.+func (*Syslog) Descriptor() ([]byte, []int) {+ return file_sources_proto_rawDescGZIP(), []int{23}+}++func (x *Syslog) GetProtocol() string {+ if x != nil {+ return x.Protocol+ }+ return ""+}++func (x *Syslog) GetListenAddress() string {+ if x != nil {+ return x.ListenAddress+ }+ return ""+}++func (x *Syslog) GetTlsCert() string {+ if x != nil {+ return x.TlsCert+ }+ return ""+}++func (x *Syslog) GetTlsKey() string {+ if x != nil {+ return x.TlsKey+ }+ return ""+}++func (x *Syslog) GetFormat() string {+ if x != nil {+ return x.Format+ }+ return ""+}+var File_sources_proto protoreflect.FileDescriptorvar file_sources_proto_rawDesc = []byte{@@ -2508,55 +2590,66 @@ var file_sources_proto_rawDesc = []byte{0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f,0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f,0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64,- 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2a, 0xb8, 0x05, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63,- 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41,- 0x47, 0x45, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54,- 0x59, 0x50, 0x45, 0x5f, 0x42, 0x49, 0x54, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x12,- 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43,- 0x49, 0x52, 0x43, 0x4c, 0x45, 0x43, 0x49, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55,- 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x4c, 0x55, 0x45,- 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x20, 0x0a, 0x1c, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x43, 0x4b, 0x45, 0x52, 0x48, 0x55, 0x42, 0x5f, 0x49,- 0x4d, 0x41, 0x47, 0x45, 0x53, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43,- 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x43, 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, 0x0f,- 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x43, 0x53, 0x10,- 0x06, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,- 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x07, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55,- 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f,- 0x47, 0x49, 0x54, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x4c, 0x41, 0x42, 0x10, 0x09, 0x12, 0x14, 0x0a,- 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x49, 0x52,- 0x41, 0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,- 0x50, 0x45, 0x5f, 0x4e, 0x50, 0x4d, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50,- 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0b, 0x12, 0x25, 0x0a, 0x21, 0x53, 0x4f, 0x55,- 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x59, 0x50, 0x49, 0x5f, 0x55, 0x4e,- 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0c,- 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,- 0x53, 0x33, 0x10, 0x0d, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54,- 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b, 0x10, 0x0e, 0x12, 0x1a, 0x0a, 0x16, 0x53,- 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x53,- 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43,- 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x10, 0x10, 0x12, 0x14, 0x0a, 0x10,- 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x53, 0x54,- 0x10, 0x11, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,- 0x45, 0x5f, 0x53, 0x33, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45, 0x44, 0x10, 0x12, 0x12,- 0x2a, 0x0a, 0x26, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47,- 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4e, 0x54, 0x49,- 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x4f, 0x52, 0x47, 0x10, 0x13, 0x12, 0x19, 0x0a, 0x15, 0x53,- 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x44,- 0x4b, 0x49, 0x54, 0x45, 0x10, 0x14, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,- 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x45, 0x52, 0x52, 0x49, 0x54, 0x10, 0x15, 0x12, 0x17,- 0x0a, 0x13, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x45,- 0x4e, 0x4b, 0x49, 0x4e, 0x53, 0x10, 0x16, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43,- 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x41, 0x4d, 0x53, 0x10, 0x17, 0x12, 0x21,- 0x0a, 0x1d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x46,- 0x52, 0x4f, 0x47, 0x5f, 0x41, 0x52, 0x54, 0x49, 0x46, 0x41, 0x43, 0x54, 0x4f, 0x52, 0x59, 0x10,- 0x18, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,- 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f,- 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x68, 0x6f, 0x67, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b,- 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x70, 0x62, 0x62, 0x06,- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x94, 0x01, 0x0a, 0x06, 0x53, 0x79, 0x73, 0x6c, 0x6f,+ 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x24, 0x0a,+ 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72,+ 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x43, 0x65, 0x72, 0x74, 0x18, 0x03,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x43, 0x65, 0x72, 0x74, 0x12, 0x16, 0x0a,+ 0x06, 0x74, 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74,+ 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18,+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2a, 0xd0, 0x05,+ 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19,+ 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x5a, 0x55, 0x52,+ 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53,+ 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x49, 0x54, 0x42, 0x55,+ 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x49, 0x52, 0x43, 0x4c, 0x45, 0x43, 0x49, 0x10, 0x02,+ 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,+ 0x43, 0x4f, 0x4e, 0x46, 0x4c, 0x55, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x20, 0x0a, 0x1c,+ 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x43, 0x4b,+ 0x45, 0x52, 0x48, 0x55, 0x42, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x10, 0x04, 0x12, 0x13,+ 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x43,+ 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,+ 0x50, 0x45, 0x5f, 0x47, 0x43, 0x53, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52,+ 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x07,+ 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,+ 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x47, 0x49, 0x54, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12,+ 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x4c,+ 0x41, 0x42, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54,+ 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x49, 0x52, 0x41, 0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x4f,+ 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x50, 0x4d, 0x5f, 0x55, 0x4e,+ 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0b,+ 0x12, 0x25, 0x0a, 0x21, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,+ 0x50, 0x59, 0x50, 0x49, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50, 0x41, 0x43,+ 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x4f, 0x55, 0x52, 0x43,+ 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x33, 0x10, 0x0d, 0x12, 0x15, 0x0a, 0x11, 0x53,+ 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b,+ 0x10, 0x0e, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,+ 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x0f, 0x12, 0x13,+ 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49,+ 0x54, 0x10, 0x10, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,+ 0x50, 0x45, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10, 0x11, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55,+ 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x33, 0x5f, 0x55, 0x4e, 0x41, 0x55,+ 0x54, 0x48, 0x45, 0x44, 0x10, 0x12, 0x12, 0x2a, 0x0a, 0x26, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x55, 0x4e, 0x41,+ 0x55, 0x54, 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x4f, 0x52, 0x47,+ 0x10, 0x13, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,+ 0x45, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x44, 0x4b, 0x49, 0x54, 0x45, 0x10, 0x14, 0x12, 0x16, 0x0a,+ 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x45, 0x52,+ 0x52, 0x49, 0x54, 0x10, 0x15, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x45, 0x4e, 0x4b, 0x49, 0x4e, 0x53, 0x10, 0x16, 0x12, 0x15,+ 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45,+ 0x41, 0x4d, 0x53, 0x10, 0x17, 0x12, 0x21, 0x0a, 0x1d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x46, 0x52, 0x4f, 0x47, 0x5f, 0x41, 0x52, 0x54, 0x49, 0x46,+ 0x41, 0x43, 0x54, 0x4f, 0x52, 0x59, 0x10, 0x18, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52,+ 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x4c, 0x4f, 0x47, 0x10, 0x19,+ 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74,+ 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74,+ 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x68, 0x6f, 0x67, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b, 0x67,+ 0x2f, 0x70, 0x62, 0x2f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70,+ 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -2572,7 +2665,7 @@ func file_sources_proto_rawDescGZIP() []byte {}var file_sources_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_sources_proto_msgTypes = make([]protoimpl.MessageInfo, 23)+var file_sources_proto_msgTypes = make([]protoimpl.MessageInfo, 24)var file_sources_proto_goTypes = []interface{}{(SourceType)(0), // 0: sources.SourceType(Confluence_GetAllSpacesScope)(0), // 1: sources.Confluence.GetAllSpacesScope@@ -2599,52 +2692,53 @@ var file_sources_proto_goTypes = []interface{}{(*Jenkins)(nil), // 22: sources.Jenkins(*Teams)(nil), // 23: sources.Teams(*Artifactory)(nil), // 24: sources.Artifactory- (*durationpb.Duration)(nil), // 25: google.protobuf.Duration- (*anypb.Any)(nil), // 26: google.protobuf.Any- (*credentialspb.BasicAuth)(nil), // 27: credentials.BasicAuth- (*credentialspb.Unauthenticated)(nil), // 28: credentials.Unauthenticated- (*credentialspb.Oauth2)(nil), // 29: credentials.Oauth2- (*credentialspb.KeySecret)(nil), // 30: credentials.KeySecret- (*credentialspb.GitHubApp)(nil), // 31: credentials.GitHubApp- (*credentialspb.CloudEnvironment)(nil), // 32: credentials.CloudEnvironment- (*credentialspb.Header)(nil), // 33: credentials.Header- (*credentialspb.AccessToken)(nil), // 34: credentials.AccessToken- (*credentialspb.ClientCredentials)(nil), // 35: credentials.ClientCredentials+ (*Syslog)(nil), // 25: sources.Syslog+ (*durationpb.Duration)(nil), // 26: google.protobuf.Duration+ (*anypb.Any)(nil), // 27: google.protobuf.Any+ (*credentialspb.BasicAuth)(nil), // 28: credentials.BasicAuth+ (*credentialspb.Unauthenticated)(nil), // 29: credentials.Unauthenticated+ (*credentialspb.Oauth2)(nil), // 30: credentials.Oauth2+ (*credentialspb.KeySecret)(nil), // 31: credentials.KeySecret+ (*credentialspb.GitHubApp)(nil), // 32: credentials.GitHubApp+ (*credentialspb.CloudEnvironment)(nil), // 33: credentials.CloudEnvironment+ (*credentialspb.Header)(nil), // 34: credentials.Header+ (*credentialspb.AccessToken)(nil), // 35: credentials.AccessToken+ (*credentialspb.ClientCredentials)(nil), // 36: credentials.ClientCredentials}var file_sources_proto_depIdxs = []int32{- 25, // 0: sources.LocalSource.scan_interval:type_name -> google.protobuf.Duration- 26, // 1: sources.LocalSource.connection:type_name -> google.protobuf.Any- 27, // 2: sources.AzureStorage.basic_auth:type_name -> credentials.BasicAuth- 28, // 3: sources.AzureStorage.unauthenticated:type_name -> credentials.Unauthenticated- 29, // 4: sources.Bitbucket.oauth:type_name -> credentials.Oauth2- 27, // 5: sources.Bitbucket.basic_auth:type_name -> credentials.BasicAuth- 28, // 6: sources.Confluence.unauthenticated:type_name -> credentials.Unauthenticated- 27, // 7: sources.Confluence.basic_auth:type_name -> credentials.BasicAuth+ 26, // 0: sources.LocalSource.scan_interval:type_name -> google.protobuf.Duration+ 27, // 1: sources.LocalSource.connection:type_name -> google.protobuf.Any+ 28, // 2: sources.AzureStorage.basic_auth:type_name -> credentials.BasicAuth+ 29, // 3: sources.AzureStorage.unauthenticated:type_name -> credentials.Unauthenticated+ 30, // 4: sources.Bitbucket.oauth:type_name -> credentials.Oauth2+ 28, // 5: sources.Bitbucket.basic_auth:type_name -> credentials.BasicAuth+ 29, // 6: sources.Confluence.unauthenticated:type_name -> credentials.Unauthenticated+ 28, // 7: sources.Confluence.basic_auth:type_name -> credentials.BasicAuth1, // 8: sources.Confluence.spaces_scope:type_name -> sources.Confluence.GetAllSpacesScope- 28, // 9: sources.DockerHub.unauthenticated:type_name -> credentials.Unauthenticated- 30, // 10: sources.ECR.access_key:type_name -> credentials.KeySecret- 27, // 11: sources.Git.basic_auth:type_name -> credentials.BasicAuth- 28, // 12: sources.Git.unauthenticated:type_name -> credentials.Unauthenticated- 29, // 13: sources.GitLab.oauth:type_name -> credentials.Oauth2- 27, // 14: sources.GitLab.basic_auth:type_name -> credentials.BasicAuth- 31, // 15: sources.GitHub.github_app:type_name -> credentials.GitHubApp- 28, // 16: sources.GitHub.unauthenticated:type_name -> credentials.Unauthenticated- 27, // 17: sources.JIRA.basic_auth:type_name -> credentials.BasicAuth- 28, // 18: sources.JIRA.unauthenticated:type_name -> credentials.Unauthenticated- 29, // 19: sources.JIRA.oauth:type_name -> credentials.Oauth2- 28, // 20: sources.NPMUnauthenticatedPackage.unauthenticated:type_name -> credentials.Unauthenticated- 28, // 21: sources.PyPIUnauthenticatedPackage.unauthenticated:type_name -> credentials.Unauthenticated- 30, // 22: sources.S3.access_key:type_name -> credentials.KeySecret- 28, // 23: sources.S3.unauthenticated:type_name -> credentials.Unauthenticated- 32, // 24: sources.S3.cloud_environment:type_name -> credentials.CloudEnvironment- 27, // 25: sources.Gerrit.basic_auth:type_name -> credentials.BasicAuth- 28, // 26: sources.Gerrit.unauthenticated:type_name -> credentials.Unauthenticated- 27, // 27: sources.Jenkins.basic_auth:type_name -> credentials.BasicAuth- 33, // 28: sources.Jenkins.header:type_name -> credentials.Header- 34, // 29: sources.Teams.token:type_name -> credentials.AccessToken- 35, // 30: sources.Teams.authenticated:type_name -> credentials.ClientCredentials- 27, // 31: sources.Artifactory.basic_auth:type_name -> credentials.BasicAuth- 34, // 32: sources.Artifactory.access_token:type_name -> credentials.AccessToken+ 29, // 9: sources.DockerHub.unauthenticated:type_name -> credentials.Unauthenticated+ 31, // 10: sources.ECR.access_key:type_name -> credentials.KeySecret+ 28, // 11: sources.Git.basic_auth:type_name -> credentials.BasicAuth+ 29, // 12: sources.Git.unauthenticated:type_name -> credentials.Unauthenticated+ 30, // 13: sources.GitLab.oauth:type_name -> credentials.Oauth2+ 28, // 14: sources.GitLab.basic_auth:type_name -> credentials.BasicAuth+ 32, // 15: sources.GitHub.github_app:type_name -> credentials.GitHubApp+ 29, // 16: sources.GitHub.unauthenticated:type_name -> credentials.Unauthenticated+ 28, // 17: sources.JIRA.basic_auth:type_name -> credentials.BasicAuth+ 29, // 18: sources.JIRA.unauthenticated:type_name -> credentials.Unauthenticated+ 30, // 19: sources.JIRA.oauth:type_name -> credentials.Oauth2+ 29, // 20: sources.NPMUnauthenticatedPackage.unauthenticated:type_name -> credentials.Unauthenticated+ 29, // 21: sources.PyPIUnauthenticatedPackage.unauthenticated:type_name -> credentials.Unauthenticated+ 31, // 22: sources.S3.access_key:type_name -> credentials.KeySecret+ 29, // 23: sources.S3.unauthenticated:type_name -> credentials.Unauthenticated+ 33, // 24: sources.S3.cloud_environment:type_name -> credentials.CloudEnvironment+ 28, // 25: sources.Gerrit.basic_auth:type_name -> credentials.BasicAuth+ 29, // 26: sources.Gerrit.unauthenticated:type_name -> credentials.Unauthenticated+ 28, // 27: sources.Jenkins.basic_auth:type_name -> credentials.BasicAuth+ 34, // 28: sources.Jenkins.header:type_name -> credentials.Header+ 35, // 29: sources.Teams.token:type_name -> credentials.AccessToken+ 36, // 30: sources.Teams.authenticated:type_name -> credentials.ClientCredentials+ 28, // 31: sources.Artifactory.basic_auth:type_name -> credentials.BasicAuth+ 35, // 32: sources.Artifactory.access_token:type_name -> credentials.AccessToken33, // [33:33] is the sub-list for method output_type33, // [33:33] is the sub-list for method input_type33, // [33:33] is the sub-list for extension type_name@@ -2934,6 +3028,18 @@ func file_sources_proto_init() {return nil}}+ file_sources_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*Syslog); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }}file_sources_proto_msgTypes[1].OneofWrappers = []interface{}{(*AzureStorage_ConnectionString)(nil),@@ -3021,7 +3127,7 @@ func file_sources_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_sources_proto_rawDesc,NumEnums: 2,- NumMessages: 23,+ NumMessages: 24,NumExtensions: 0,NumServices: 0,},diff --git a/pkg/pb/sourcespb/sources.pb.validate.go b/pkg/pb/sourcespb/sources.pb.validate.goindex a21938fb6..f007fbe0d 100644--- a/pkg/pb/sourcespb/sources.pb.validate.go+++ b/pkg/pb/sourcespb/sources.pb.validate.go@@ -3553,3 +3553,111 @@ var _ interface {Cause() errorErrorName() string} = ArtifactoryValidationError{}++// Validate checks the field values on Syslog with the rules defined in the+// proto definition for this message. If any rules are violated, the first+// error encountered is returned, or nil if there are no violations.+func (m *Syslog) Validate() error {+ return m.validate(false)+}++// ValidateAll checks the field values on Syslog with the rules defined in the+// proto definition for this message. If any rules are violated, the result is+// a list of violation errors wrapped in SyslogMultiError, or nil if none found.+func (m *Syslog) ValidateAll() error {+ return m.validate(true)+}++func (m *Syslog) validate(all bool) error {+ if m == nil {+ return nil+ }++ var errors []error++ // no validation rules for Protocol++ // no validation rules for ListenAddress++ // no validation rules for TlsCert++ // no validation rules for TlsKey++ // no validation rules for Format++ if len(errors) > 0 {+ return SyslogMultiError(errors)+ }++ return nil+}++// SyslogMultiError is an error wrapping multiple validation errors returned by+// Syslog.ValidateAll() if the designated constraints aren't met.+type SyslogMultiError []error++// Error returns a concatenation of all the error messages it wraps.+func (m SyslogMultiError) Error() string {+ var msgs []string+ for _, err := range m {+ msgs = append(msgs, err.Error())+ }+ return strings.Join(msgs, "; ")+}++// AllErrors returns a list of validation violation errors.+func (m SyslogMultiError) AllErrors() []error { return m }++// SyslogValidationError is the validation error returned by Syslog.Validate if+// the designated constraints aren't met.+type SyslogValidationError struct {+ field string+ reason string+ cause error+ key bool+}++// Field function returns field value.+func (e SyslogValidationError) Field() string { return e.field }++// Reason function returns reason value.+func (e SyslogValidationError) Reason() string { return e.reason }++// Cause function returns cause value.+func (e SyslogValidationError) Cause() error { return e.cause }++// Key function returns key value.+func (e SyslogValidationError) Key() bool { return e.key }++// ErrorName returns error name.+func (e SyslogValidationError) ErrorName() string { return "SyslogValidationError" }++// Error satisfies the builtin error interface+func (e SyslogValidationError) Error() string {+ cause := ""+ if e.cause != nil {+ cause = fmt.Sprintf(" | caused by: %v", e.cause)+ }++ key := ""+ if e.key {+ key = "key for "+ }++ return fmt.Sprintf(+ "invalid %sSyslog.%s: %s%s",+ key,+ e.field,+ e.reason,+ cause)+}++var _ error = SyslogValidationError{}++var _ interface {+ Field() string+ Reason() string+ Key() bool+ Cause() error+ ErrorName() string+} = SyslogValidationError{}diff --git a/pkg/sources/syslog/syslog.go b/pkg/sources/syslog/syslog.gonew file mode 100644index 000000000..2731879a5--- /dev/null+++ b/pkg/sources/syslog/syslog.go@@ -0,0 +1,286 @@+package syslog++import (+ "context"+ "crypto/tls"+ "fmt"+ "github.com/trufflesecurity/trufflehog/v3/pkg/common"+ "io"+ "net"+ "runtime"+ "strconv"+ "time"++ "github.com/bill-rich/go-syslog/pkg/syslogparser/rfc3164"+ "github.com/crewjam/rfc5424"+ "github.com/go-errors/errors"+ "github.com/sirupsen/logrus"+ "golang.org/x/sync/semaphore"+ "google.golang.org/protobuf/proto"+ "google.golang.org/protobuf/types/known/anypb"++ "github.com/trufflesecurity/trufflehog/v3/pkg/pb/source_metadatapb"+ "github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb"+ "github.com/trufflesecurity/trufflehog/v3/pkg/sources"+)++const nilString = ""++type Source struct {+ name string+ sourceId int64+ jobId int64+ verify bool+ syslog *Syslog+ aCtx context.Context+ sources.Progress+ conn *sourcespb.Syslog+}++type Syslog struct {+ sourceType sourcespb.SourceType+ sourceName string+ sourceID int64+ jobID int64+ sourceMetadataFunc func(hostname, appname, procid, timestamp, facility, client string) *source_metadatapb.MetaData+ verify bool+ concurrency *semaphore.Weighted+}++func NewSyslog(sourceType sourcespb.SourceType, jobID, sourceID int64, sourceName string, verify bool, concurrency int,+ sourceMetadataFunc func(hostname, appname, procid, timestamp, facility, client string) *source_metadatapb.MetaData,+) *Syslog {+ return &Syslog{+ sourceType: sourceType,+ sourceName: sourceName,+ sourceID: sourceID,+ jobID: jobID,+ sourceMetadataFunc: sourceMetadataFunc,+ verify: verify,+ concurrency: semaphore.NewWeighted(int64(concurrency)),+ }+}++// Ensure the Source satisfies the interface at compile time.+var _ sources.Source = (*Source)(nil)++// Type returns the type of source.+// It is used for matching source types in configuration and job input.+func (s *Source) Type() sourcespb.SourceType {+ return sourcespb.SourceType_SOURCE_TYPE_SYSLOG+}++func (s *Source) SourceID() int64 {+ return s.sourceId+}++func (s *Source) JobID() int64 {+ return s.jobId+}++func (s *Source) InjectConnection(conn *sourcespb.Syslog) {+ s.conn = conn+}++// Init returns an initialized Syslog source.+func (s *Source) Init(aCtx context.Context, name string, jobId, sourceId int64, verify bool, connection *anypb.Any, concurrency int) error {++ s.aCtx = aCtx+ s.name = name+ s.sourceId = sourceId+ s.jobId = jobId+ s.verify = verify++ var conn sourcespb.Syslog+ err := anypb.UnmarshalTo(connection, &conn, proto.UnmarshalOptions{})+ if err != nil {+ return errors.WrapPrefix(err, "error unmarshalling connection", 0)+ }++ s.conn = &conn++ err = s.verifyConnectionConfig()+ if err != nil {+ return errors.WrapPrefix(err, "invalid configuration", 0)+ }++ s.syslog = NewSyslog(s.Type(), s.jobId, s.sourceId, s.name, s.verify, runtime.NumCPU(),+ func(hostname, appname, procID, timestamp, facility, client string) *source_metadatapb.MetaData {+ return &source_metadatapb.MetaData{+ Data: &source_metadatapb.MetaData_Syslog{+ Syslog: &source_metadatapb.Syslog{+ Hostname: hostname,+ Appname: appname,+ Procid: procID,+ Timestamp: timestamp,+ Facility: facility,+ Client: client,+ },+ },+ }+ })+ return nil+}++func (s *Source) verifyConnectionConfig() error {+ tlsEnabled := s.conn.TlsCert != nilString || s.conn.TlsKey != nilString+ if s.conn.Protocol == nilString {+ if tlsEnabled {+ s.conn.Protocol = "tcp"+ } else {+ s.conn.Protocol = "udp"+ }+ }++ if s.conn.Protocol == "udp" && tlsEnabled {+ return fmt.Errorf("TLS is not supported over UDP")+ }++ if s.conn.ListenAddress == nilString {+ s.conn.ListenAddress = ":5140"+ }++ if s.conn.Format == nilString {+ s.conn.Format = "rfc3164"+ }+ return nil+}++// Chunks emits chunks of bytes over a channel.+func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk) error {+ switch {+ case s.conn.TlsCert != nilString || s.conn.TlsKey != nilString:+ cert, err := tls.X509KeyPair([]byte(s.conn.TlsCert), []byte(s.conn.TlsKey))+ if err != nil {+ return errors.WrapPrefix(err, "could not load key pair", 0)+ }+ cfg := &tls.Config{Certificates: []tls.Certificate{cert}}+ lis, err := tls.Listen(s.conn.Protocol, s.conn.ListenAddress, cfg)+ if err != nil {+ return errors.WrapPrefix(err, "error creating TLS listener", 0)+ }+ defer lis.Close()++ return s.acceptTCPConnections(ctx, lis, chunksChan)+ case s.conn.Protocol == "tcp":+ lis, err := net.Listen(s.conn.Protocol, s.conn.ListenAddress)+ if err != nil {+ return errors.WrapPrefix(err, "error creating TCP listener", 0)+ }+ defer lis.Close()++ return s.acceptTCPConnections(ctx, lis, chunksChan)+ case s.conn.Protocol == "udp":+ lis, err := net.ListenPacket(s.conn.Protocol, s.conn.ListenAddress)+ if err != nil {+ return errors.WrapPrefix(err, "error creating UDP listener", 0)+ }+ err = lis.SetDeadline(time.Now().Add(time.Second))+ if err != nil {+ return errors.WrapPrefix(err, "could not set UDP deadline", 0)+ }+ defer lis.Close()++ return s.acceptUDPConnections(ctx, lis, chunksChan)+ default:+ return fmt.Errorf("unknown connection type")+ }+}++func (s *Source) parseSyslogMetadata(input []byte, remote string) (*source_metadatapb.MetaData, error) {+ var metadata *source_metadatapb.MetaData+ switch s.conn.Format {+ case "rfc5424":+ message := &rfc5424.Message{}+ err := message.UnmarshalBinary(input)+ if err != nil {+ return metadata, errors.WrapPrefix(err, "could not parse syslog as rfc5424", 0)+ }+ metadata = s.syslog.sourceMetadataFunc(message.Hostname, message.AppName, message.ProcessID, message.Timestamp.String(), nilString, remote)+ case "rfc3164":+ parser := rfc3164.NewParser(input)+ err := parser.Parse()+ if err != nil {+ return metadata, errors.WrapPrefix(err, "could not parse syslog as rfc3164", 0)+ }+ data := parser.Dump()+ metadata = s.syslog.sourceMetadataFunc(data["hostname"].(string), nilString, nilString, data["timestamp"].(time.Time).String(), strconv.Itoa(data["facility"].(int)), remote)+ }+ return metadata, nil+}++func (s *Source) monitorConnection(ctx context.Context, conn net.Conn, chunksChan chan *sources.Chunk) {+ for {+ if common.IsDone(ctx) {+ return+ }+ err := conn.SetDeadline(time.Now().Add(time.Second))+ if err != nil {+ logrus.WithError(err).Debug("could not set connection deadline deadline")+ }+ input := make([]byte, 8096)+ remote := conn.RemoteAddr()+ _, err = conn.Read(input)+ if err != nil {+ if errors.Is(err, io.EOF) {+ return+ }+ continue+ }+ logrus.Trace(string(input))+ metadata, err := s.parseSyslogMetadata(input, remote.String())+ if err != nil {+ logrus.WithError(err).Debug("failed to generate metadata")+ }+ chunksChan <- &sources.Chunk{+ SourceName: s.syslog.sourceName,+ SourceID: s.syslog.sourceID,+ SourceType: s.syslog.sourceType,+ SourceMetadata: metadata,+ Data: input,+ Verify: s.verify,+ }+ }+}++func (s *Source) acceptTCPConnections(ctx context.Context, netListener net.Listener, chunksChan chan *sources.Chunk) error {+ for {+ if common.IsDone(ctx) {+ return nil+ }+ conn, err := netListener.Accept()+ if err != nil {+ logrus.WithError(err).Debug("failed to accept TCP connection")+ continue+ }+ go s.monitorConnection(ctx, conn, chunksChan)+ }+}++func (s *Source) acceptUDPConnections(ctx context.Context, netListener net.PacketConn, chunksChan chan *sources.Chunk) error {+ for {+ if common.IsDone(ctx) {+ return nil+ }+ input := make([]byte, 65535)+ _, remote, err := netListener.ReadFrom(input)+ if err != nil {+ if errors.Is(err, io.EOF) {+ return nil+ }+ continue+ }+ metadata, err := s.parseSyslogMetadata(input, remote.String())+ if err != nil {+ logrus.WithError(err).Debug("failed to parse metadata")+ }+ chunksChan <- &sources.Chunk{+ SourceName: s.syslog.sourceName,+ SourceID: s.syslog.sourceID,+ SourceType: s.syslog.sourceType,+ SourceMetadata: metadata,+ Data: input,+ Verify: s.verify,+ }+ }+}diff --git a/proto/source_metadata.proto b/proto/source_metadata.protoindex b147cd5fd..48228d8da 100644--- a/proto/source_metadata.proto+++ b/proto/source_metadata.proto@@ -198,6 +198,15 @@ message Artifactory {string email = 6;}+message Syslog {+ string hostname = 1;+ string appname = 2;+ string procid = 3;+ string timestamp = 4;+ string client = 5;+ string facility = 6;+}+message MetaData {oneof data {Azure azure = 1;@@ -222,5 +231,6 @@ message MetaData {Jenkins jenkins = 20;Teams teams = 21;Artifactory artifactory = 22;+ Syslog syslog = 23;}}diff --git a/proto/sources.proto b/proto/sources.protoindex 6a9f6e49e..a70944f53 100644--- a/proto/sources.proto+++ b/proto/sources.proto@@ -36,6 +36,7 @@ enum SourceType {SOURCE_TYPE_JENKINS = 22;SOURCE_TYPE_TEAMS = 23;SOURCE_TYPE_JFROG_ARTIFACTORY = 24;+ SOURCE_TYPE_SYSLOG = 25;}message LocalSource {@@ -236,3 +237,11 @@ message Artifactory {}repeated string repositories = 4;}++message Syslog {+ string protocol = 1;+ string listenAddress = 2;+ string tlsCert = 3;+ string tlsKey = 4;+ string format = 5;+}