mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 00:24:40 +01:00
clean dns ebpf hooks on exit
We were not reacting to common exit signals, only to kill/interrupt signals, so the DNS uprobes were never properly removed. Each uprobe has the PID of the daemon in the identifier, so in theory, there shouldn't be conflicts, but better clean our probes on exit. previous to this commit with the daemon running (and lot of starts/stops): ~ # cat /sys/kernel/debug/tracing/uprobe_events |wc -l 367 after stopping the daemon: ~ # cat /sys/kernel/debug/tracing/uprobe_events |wc -l 364 ~ # > /sys/kernel/debug/tracing/uprobe_events ~ # cat /sys/kernel/debug/tracing/uprobe_events |wc -l 0 ~ # cp opensnitchd-new /usr/bin/opensnitchd ; service opensnitchd start ~ # cat /sys/kernel/debug/tracing/uprobe_events |wc -l 3 ~ # service opensnitchd stop ~ # cat /sys/kernel/debug/tracing/uprobe_events |wc -l 0
This commit is contained in:
parent
c118058dd8
commit
785500cd08
1 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/evilsocket/opensnitch/daemon/core"
|
||||
|
@ -149,7 +150,12 @@ func ListenerEbpf(ebpfModPath string) error {
|
|||
}
|
||||
sig := make(chan os.Signal, 1)
|
||||
exitChannel := make(chan bool)
|
||||
signal.Notify(sig, os.Interrupt, os.Kill)
|
||||
signal.Notify(sig,
|
||||
syscall.SIGHUP,
|
||||
syscall.SIGINT,
|
||||
syscall.SIGTERM,
|
||||
syscall.SIGKILL,
|
||||
syscall.SIGQUIT)
|
||||
|
||||
for i := 0; i < 5; i++ {
|
||||
go spawnDNSWorker(i, channel, exitChannel)
|
||||
|
|
Loading…
Add table
Reference in a new issue