Skip to content

Commit

Permalink
cilium/cmd: erroring if cilium monitor runs without root
Browse files Browse the repository at this point in the history
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Mar 22, 2017
1 parent a349533 commit 38b4a13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cilium/cmd/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func receiveEvent(msg *bpf.PerfEventSample, cpu int) {
}

func runMonitor() {
if os.Getuid() != 0 {
fmt.Fprintf(os.Stderr, "Please run the monitor with root privileges.\n")
os.Exit(1)
}

events, err := bpf.NewPerCpuEvents(&eventConfig)
if err != nil {
panic(err)
Expand Down

0 comments on commit 38b4a13

Please sign in to comment.