Giter VIP home page Giter VIP logo

dongtai-agent-go's Issues

[Bug]: golang的agent在grpc中使用了一元拦截器(UnaryInterceptor)的时候报错

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.

Version

1.8.1

Installation Type

Official Docker Compose

Service Name

DongTai-Core

Describe the details of the bug and the steps to reproduce it

在项目中已经使用了grpc一元拦截器(grpc.UnaryInterceptor)的情况下,dongtai agent再注册拦截器会导致报错

代码路径:
https://github.com/HXSecurity/DongTai-agent-go/blob/v0.4.2/core/grpc/newServer/replacement.go#L25

报错:

panic: The unary server interceptor was already set and may not be reset

Additional Information

No response

Logs

2022-07-13 19:13:43.840 error ******[-]: panic: The unary server interceptor was already set and may not be reset. 
	/usr/local/go/src/runtime/panic.go:844
google.golang.org/grpc.UnaryInterceptor.func1
	/***/go/pkg/mod/google.golang.org/[email protected]/server.go:382
google.golang.org/grpc.(*funcServerOption).apply
	/***/go/pkg/mod/google.golang.org/[email protected]/server.go:201
google.golang.org/grpc.NewServer
	/***/go/pkg/mod/google.golang.org/[email protected]/server.go:564
github.com/HXSecurity/DongTai-agent-go/core/grpc/newServer.NewServer
	/***/go/pkg/mod/github.com/!h!x!security/!dong![email protected]/core/grpc/newServer/replacement.go:26

运行的时候报错,还没发起请求,用的main分支

GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\john\go #gosetup
"C:\Program Files\Go\bin\go.exe" build -o C:\Users\john\AppData\Local\Temp\GoLand___1go_build_example_com_mod.exe example.com/mod #gosetup
C:\Users\john\AppData\Local\Temp\GoLand___1go_build_example_com_mod.exe
open dongtai-go-agent-config.yaml: The system cannot find the file specified.
等待当前程序http启动完成
SqlDBQuery
Sprintf
JsonUnmarshal
JsonDecoderDecode
JsonNewDecoder
RuntimeConcatstrings
ExecCommand
execCmdRun
BufioWriterWrite
BufioWriterWriteString
RuntimesSringtoslicebyte
HtmlTemplateExecuteTemplate
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
syscall.UTF16PtrFromString(...)
C:/Program Files/Go/src/syscall/syscall_windows.go:101
syscall.LoadDLL({0x9b573b, 0x28})
C:/Program Files/Go/src/syscall/dll_windows.go:73 +0x2a5
syscall.(*LazyDLL).Load(0xc0001237e0)
C:/Program Files/Go/src/syscall/dll_windows.go:248 +0xa5
syscall.(*LazyProc).Find(0xc000300300)
C:/Program Files/Go/src/syscall/dll_windows.go:303 +0xa5
github.com/mattn/go-isatty.init.0()
E:/GO/hello/vendor/github.com/mattn/go-isatty/isatty_windows.go:31 +0x25

Process finished with the exit code 2

[Bug]: Not support go version < 1.16beta1

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.

Version

1.8.2

Installation Type

Official Docker Compose

Service Name

Doc(DongTai-Doc)

Describe the details of the bug and the steps to reproduce it

  1. Go Agent Guide ,the guide says to support Go1.12+
  2. But Go agent uses io/fs: service/auxiliarylt18.go, service/auxiliarylt18.go
  3. io/fs only supports >=1.16beta1 io/fs
    image

Env:

go version go1.12.1 linux/amd64

Steps:

  1. import dependencies
    _ "github.com/HXSecurity/DongTai-agent-go/run/base"
    _ "github.com/HXSecurity/DongTai-agent-go/run/http"
    
  2. run
go mod init dongtai_test
go mod tidy
go run -gcflags "all=-N -l" app.go
  1. get error
    build command-line-arguments: cannot load io/fs: cannot find module providing package io/fs
    

Additional Information

No response

Logs

No response

agent 注册失败

image
当容器内没有netstat 命令时,命令执行 err != nil ,导致agent注册失败

[Bug]: go agent装配启动参数与本身服务参数冲突导致无法装配bug

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.

Version

1.8.5

Installation Type

Official Docker Compose

Service Name

Doc(DongTai-Doc), DongTai-Core

Describe the details of the bug and the steps to reproduce it

go agent装配命令go run -gcflags "all=-N -l" main.go -DongtaiGoProjectVersion="版本" -DongtaiGoProjectName="项目名" -DongtaiGoProjectCreate="true",当需装配agent的应用服务本身需要添加额外参数时,参数无法被识别;即为需要检测的服务A中运行时需要解析输入的参数a,但是在IAST服务中已经解析了参数flag.Parse(),因此不会再重新解析,运行A时输入参数会报错,无法解析参数a;

lQLPJxa5adTRF-zMu80BxbA-gD4xaCG9fwMw2P6DwDYA_453_187

Additional Information

建议解决方案:
在github.com/HXSecurity/DongTai-agent-go/run/base包中的Inint函数中把flag.Parse()去掉,只在A服务中调用一次;
lQLPJxa5adTRGF_M2s0D77ChF_yqYJwU9wMw2P6BAJEA_1007_218

Logs

No response

是否能兼容grpc 1.42之前的版本

dongtai agent在0.3.3版本加入了grpc(github.com/HXSecurity/DongTai-agent-go/run/grpc)支持,引入的grpc版本是1.45,而grpc在1.42版本改了一个函数(attributes.New)的传参格式:

  • 之前版本的调用方式是:func New(kvs ...interface{}) *Attributes
  • 1.42之后是:func New(key, value interface{}) *Attributes

我们框架使用的grpc1.40,在引入dongtai agent(0.3.3之后版本)之后go mod会自动更新grpc版本到1.45,导致运行时候报错:

too many arguments in call to attributes.New
	have (string, string, string)
	want (interface{}, interface{}) 

框架代码没法改动,想问下有没有什么兼容的方式

agent-go 用法

quit start 中没有介绍 agent-go 的用法,如何在go项目中使用 go-agent呢

mac 环境下报错

等待当前程序http启动完成
panic: permission denied

goroutine 1 [running]:
github.com/brahma-adshonor/gohook.setPageWritable(0x464b235, 0x5, 0x7)
/Users/xiao/go/pkg/mod/github.com/brahma-adshonor/[email protected]/utility_unix.go:19 +0xf7

添加agent以后,程序无法正常使用

我自己写的go项目,加入以后,程序就无法正常使用了。
如下图是正常情况下的日志
image

但是加入agent以后,程序就会卡在这里,后面的就卡住了。
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.