eBPF-based security platform
testing: consolidate kernel observability privilege cases
John Fastabend2e5c258ae856
diff --git a/testing/upatch/kernel-obs/network/kernel_obs_events.py b/testing/upatch/kernel-obs/network/kernel_obs_events.pyindex 7dc7d4f1..1a449f92 100755--- a/testing/upatch/kernel-obs/network/kernel_obs_events.py+++ b/testing/upatch/kernel-obs/network/kernel_obs_events.py@@ -92,19 +92,6 @@ def listen_event():receiver.close()-def priv_event():- pid = os.fork()- if pid == 0:- os.unshare(os.CLONE_NEWUSER)- os._exit(0)- _, status = os.waitpid(pid, 0)- if os.waitstatus_to_exitcode(status) != 0:- raise RuntimeError("user namespace creation failed")- with tempfile.TemporaryDirectory() as mountpoint:- subprocess.run(["mount", "-t", "tmpfs", "none", mountpoint], check=True)- subprocess.run(["umount", mountpoint], check=True)--def file_event():with open("/etc/shadow", "rb") as shadow:shadow.read(1)@@ -233,13 +220,12 @@ EVENTS = {"udp": udp_event,"dns": dns_event,"listen": listen_event,- "priv": priv_event,"file": file_event,"watch": watch_event,"dns-long": dns_long_event,"dns-many": dns_many_answers_event,}-ALL = ("exec", "tcp", "udp", "dns", "listen", "priv", "file")+ALL = ("exec", "tcp", "udp", "dns", "listen", "file")def main():diff --git a/testing/upatch/kernel-obs/network/t1210-kernel-obs.sh b/testing/upatch/kernel-obs/network/t1210-kernel-obs.shindex 4d730322..6f201be3 100755--- a/testing/upatch/kernel-obs/network/t1210-kernel-obs.sh+++ b/testing/upatch/kernel-obs/network/t1210-kernel-obs.sh@@ -173,10 +173,6 @@ assert any(n["name"] == long_nameassert any(r["address"] == "203.0.113.75" andany(n["name"] == "many.example" for n in r["names"])for r in tables["dns"]), tables["dns"]-assert any(r["kind"] == "userns_create"- for r in tables["priv"]), tables["priv"]-assert any(r["kind"] == "mount" and r["name"] == "tmpfs"- for r in tables["priv"]), tables["priv"]assert any(r["path"] == "/etc/shadow" and r["mode"] == "r"for r in tables["file"]), tables["file"]assert any(r["path"].endswith("/environ")