mirror of https://github.com/subgraph/fw-daemon
Added changes for fw-daemon to check sandboxed processes' oz-init /proc/[pid]/net/tcp with procsnitch. fw-daemon IPC accepts "register-init" command to register new oz-init process instance alerts. fw-daemon also checks for existing oz-init processes on startup. Updated vendor-bundled go-procsnitch to latest dev version that includes findTCPSocketAll().shw_dev
parent
30482bf15b
commit
7a1851419c
@ -0,0 +1,47 @@
|
||||
package sgfw
|
||||
|
||||
import (
|
||||
"github.com/subgraph/ozipc"
|
||||
)
|
||||
|
||||
type ListSandboxesMsg struct {
|
||||
_ string "ListSandboxes"
|
||||
}
|
||||
|
||||
type SandboxInfo struct {
|
||||
Id int
|
||||
Address string
|
||||
Profile string
|
||||
Mounts []string
|
||||
InitPid int
|
||||
}
|
||||
|
||||
type ListSandboxesResp struct {
|
||||
Sandboxes []SandboxInfo "ListSandboxesResp"
|
||||
}
|
||||
|
||||
const socketPath = "@oz-control"
|
||||
|
||||
var ozCtrlFactory = ipc.NewMsgFactory(
|
||||
new(ListSandboxesMsg),
|
||||
new(ListSandboxesResp),
|
||||
)
|
||||
|
||||
func getSandboxes() ([]SandboxInfo, error) {
|
||||
c, err := ipc.Connect(socketPath, ozCtrlFactory, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Error connecting to oz control socket: ", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer c.Close()
|
||||
rr, err := c.ExchangeMsg(&ListSandboxesMsg{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := <-rr.Chan()
|
||||
rr.Done()
|
||||
sboxes := resp.Body.(*ListSandboxesResp)
|
||||
return sboxes.Sandboxes, nil
|
||||
}
|
Loading…
Reference in new issue