Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
script to fix ebpf permission issues under selinux
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Juchem committed Oct 21, 2020
1 parent fb1d6cd commit cff9ca3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bin/selinux_bpf.sh
@@ -0,0 +1,28 @@
#!/bin/sh

if [ $EUID -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi

selinuxenabled
if [ $? -ne 0 ]
then
echo "SELinux is not enabled"
exit 1
fi

FLOWMILL_TEMP=$(mktemp -d -t flowmill-XXXXX)

cat > $FLOWMILL_TEMP/spc_bpf_allow.te <<END
module spc_bpf_allow 1.0;
require {
type spc_t;
class bpf {map_create map_read map_write prog_load prog_run};
}
#============= spc_t ==============
allow spc_t self:bpf { map_create map_read map_write prog_load prog_run };
END
checkmodule -M -m -o $FLOWMILL_TEMP/spc_bpf_allow.mod $FLOWMILL_TEMP/spc_bpf_allow.te
semodule_package -o $FLOWMILL_TEMP/spc_bpf_allow.pp -m $FLOWMILL_TEMP/spc_bpf_allow.mod
semodule -i $FLOWMILL_TEMP/spc_bpf_allow.pp

0 comments on commit cff9ca3

Please sign in to comment.