Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grpc server #3390

Merged
merged 1 commit into from Aug 16, 2023
Merged

Conversation

josedonizetti
Copy link
Collaborator

@josedonizetti josedonizetti commented Aug 15, 2023

1. Explain what the PR does

This PR is part of the work to support a v1 for GRPC. It adds the base grpc server, implementing the version endpoint defined on the tracee rpc proto, the grpc server can be start to listen on TCP or UDS.

2. Explain how to test it

./dist/tracee --grpc-listen-addr=tcp:4466

A simple GRPC client if you want to test it:

package main

import (
	"context"
	"log"

	pb "github.com/aquasecurity/tracee/types/api/v1beta1"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

func main() {

	var opts []grpc.DialOption
	opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))

	conn, err := grpc.Dial(":4466", opts...)
	if err != nil {
		log.Fatalf("fail to dial: %v", err)
	}

	client := pb.NewTraceeServiceClient(conn)

	version, err := client.GetVersion(context.Background(), &pb.GetVersionRequest{})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("version: %+v\n", version.Version)
}

3. Other comments

depends on #3389

go.mod Outdated Show resolved Hide resolved
Copy link
Member

@geyslan geyslan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Tested with TCP and Unix socket:

sudo ./dist/tracee --grpc-listen-addr=tcp:4466

image

sudo ./dist/tracee --grpc-listen-addr=unix:unix_sock

image

@josedonizetti josedonizetti force-pushed the add-grpc-server branch 2 times, most recently from a0235f9 to 366b1a9 Compare August 16, 2023 11:33
@josedonizetti josedonizetti merged commit f5adbf3 into aquasecurity:main Aug 16, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants