Skip to content

Commit 147a184

Browse files
authored
Add parameters for TLS interception in libssl custom names (#64)
1 parent c7e762c commit 147a184

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
_ "net/http/pprof" // Blank import to pprof
88
"os"
9+
"strings"
910
"time"
1011

1112
"github.com/kubeshark/tracer/misc"
@@ -29,9 +30,22 @@ var globCbuf = flag.Int("cbuf", 0, fmt.Sprintf("Keep last N packets in circular
2930

3031
var disableEbpfCapture = flag.Bool("disable-ebpf", false, "Disable capture packet via eBPF")
3132

33+
type sslListArray []string
34+
35+
func (i *sslListArray) String() string {
36+
return strings.Join((*i)[:], ",")
37+
}
38+
func (i *sslListArray) Set(value string) error {
39+
*i = append(*i, value)
40+
return nil
41+
}
42+
43+
var sslLibsGlobal sslListArray
44+
3245
var tracer *Tracer
3346

3447
func main() {
48+
flag.Var(&sslLibsGlobal, "ssl-libname", "Custom libssl library name")
3549
flag.Parse()
3650

3751
zerolog.SetGlobalLevel(zerolog.InfoLevel)

ssllib_finder.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ func findLibraryByPid(procfs string, pid uint32, libraryName string) (string, er
4646

4747
fpath := parts[5]
4848

49-
if libraryName != "" && !strings.Contains(fpath, libraryName) {
50-
continue
49+
if libraryName != "" {
50+
found := strings.Contains(fpath, libraryName)
51+
52+
for _, name := range sslLibsGlobal {
53+
if found {
54+
break
55+
}
56+
found = strings.Contains(fpath, name)
57+
}
58+
if !found {
59+
continue
60+
}
5161
}
5262

5363
fullpath := fmt.Sprintf("%v/%v/root%v", procfs, pid, fpath)

0 commit comments

Comments
 (0)