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

change grpc-liste-addr flag to grpc, add suport for unix and tcp ontop #4399

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/tracee/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func initCmd() error {
rootCmd.Flags().String(
server.GRPCListenEndpointFlag,
"", // disabled by default
"<protocol:addr>\t\t\tListening address of the grpc server eg: tcp:4466, unix:/tmp/tracee.sock (default: disabled)",
"<protocol:addr>\t\t\tListening address of the grpc server eg: tcp or tcp:4466, unix or unix:/tmp/tracee.sock (default: disabled)",
)
err = viper.BindPFlag(server.GRPCListenEndpointFlag, rootCmd.Flags().Lookup(server.GRPCListenEndpointFlag))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/install/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ A complete config file with all available options can be found [here](https://gi
metrics-endpoint: true
```

- **`--grpc-listen-addr`**: Specifies the address for the gRPC server.
- **`--grpc`**: Specifies the address for the gRPC server.

YAML:
```yaml
grpc-listen-addr: tcp:50051
grpc: tcp:50051
```


Expand Down
2 changes: 1 addition & 1 deletion examples/config/global_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ capabilities:

metrics-endpoint: true

grpc-listen-addr: tcp:50051
grpc: tcp:50051

dnscache: enable

Expand Down
7 changes: 7 additions & 0 deletions pkg/cmd/flags/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ import (
"github.com/aquasecurity/tracee/pkg/server/grpc"
)

var defaultUNIXAddr = "unix:/tmp/tracee.sock"
var defaultTCPAddr = "tcp:4466"

func PrepareGRPCServer(listenAddr string) (*grpc.Server, error) {
if len(listenAddr) == 0 {
return nil, nil
} else if listenAddr == "unix" {
listenAddr = defaultUNIXAddr
} else if listenAddr == "tcp" {
listenAddr = defaultTCPAddr
}

addr := strings.SplitN(listenAddr, ":", 2)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/flags/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
HealthzEndpointFlag = "healthz"
PProfEndpointFlag = "pprof"
HTTPListenEndpointFlag = "http-listen-addr"
GRPCListenEndpointFlag = "grpc-listen-addr"
GRPCListenEndpointFlag = "grpc"
PyroscopeAgentFlag = "pyroscope"
)

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-inst-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ for TEST in $TESTS; do
--signatures-dir "$SIG_DIR" \
--scope comm=echo,mv,ls,tracee,proctreetester,ping,ds_writer,fsnotify_tester,process_execute,tracee-ebpf,writev,set_fs_pwd.sh \
--dnscache enable \
--grpc-listen-addr unix:/tmp/tracee.sock \
--grpc unix:/tmp/tracee.sock \
--events "$TEST" &

# Wait tracee to start
Expand Down