Skip to content

eBPF-based security platform

seal: label a symlink itself rather than its target

Daniel Borkmann4563d47d4ee0
diff --git a/util/seal.c b/util/seal.c
index 844d1a9b..d03a054b 100644
--- a/util/seal.c
+++ b/util/seal.c
@@ -20,8 +20,8 @@
int shirudo_seal_label(const char *path)
{
- if (setxattr(path, SHIRUDO_XATTR_NAME, SHIRUDO_SEAL_LABEL,
- sizeof(SHIRUDO_SEAL_LABEL) - 1, 0) != 0)
+ if (lsetxattr(path, SHIRUDO_XATTR_NAME, SHIRUDO_SEAL_LABEL,
+ sizeof(SHIRUDO_SEAL_LABEL) - 1, 0) != 0)
return -errno;
return 0;
}
diff --git a/util/seal.h b/util/seal.h
index b8d624cf..76cefcda 100644
--- a/util/seal.h
+++ b/util/seal.h
@@ -17,9 +17,10 @@
"94442b45cfcdc59aabc2a91364ed2ae129418e05a5c1985231b9c032e673f469"
/*
- * Set security.bpf.shirudo = SHIRUDO_SEAL_LABEL on one path. Idempotent
- * (create-or-replace). Call after creating any regular-fs file under
- * /var/lib/shirudo/ so the seal LSM protects it. Returns 0 or -errno.
+ * Set security.bpf.shirudo = SHIRUDO_SEAL_LABEL on one inode, a
+ * symlink's own rather than its target's. Idempotent (create-or-replace).
+ * Call after creating any regular-fs file under /var/lib/shirudo/ so the
+ * seal LSM protects it. Returns 0 or -errno.
*/
int shirudo_seal_label(const char *path);