Skip to content

Commit 5ded2a9

Browse files
authored
Merge pull request #51 from NationalSecurityAgency/create-release
Create release
2 parents 99a8d62 + eb42240 commit 5ded2a9

File tree

17 files changed

+219
-70
lines changed

17 files changed

+219
-70
lines changed

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,34 @@
3131
"argjson",
3232
"batcat",
3333
"bindgen",
34+
"binprm",
3435
"BPFFS",
3536
"bpftool",
37+
"bprm",
3638
"distro",
3739
"Dockerfiles",
3840
"Doxygen",
3941
"ebpf",
4042
"EOPNOTSUPP",
4143
"FIPS",
4244
"fontawesome",
45+
"iattr",
46+
"IDMAP",
4347
"journalctl",
4448
"karmor",
49+
"kexec",
4550
"keylist",
4651
"kmod",
4752
"kubearmor",
4853
"libbpf",
4954
"libtest",
55+
"lockdown",
5056
"mkdocs",
5157
"nationalsecurityagency",
58+
"newsk",
5259
"NLMSG",
5360
"nlmsghdr",
61+
"pathbuf",
5462
"Pkey",
5563
"prctl",
5664
"printk",
@@ -69,8 +77,13 @@
6977
"syscall",
7078
"syscalls",
7179
"tempdir",
80+
"tracee",
81+
"traceme",
82+
"Unlabel",
7283
"uprobe",
84+
"userns",
7385
"userspace",
86+
"vfsmount",
7487
"vmlinux",
7588
"walkdir"
7689
],

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ edition = "2021"
2424
license = "Apache-2.0"
2525
readme = "README.md"
2626
rust-version = "1.79"
27-
version = "1.1.0"
27+
version = "1.2.0"
28+
repository = "https://github.com/NationalSecurityAgency/seabee"
29+
homepage = "https://code.nsa.gov/seabee/"
30+
description = "Hardens eBPF tools against privileged attackers via policy-based access controls"

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ or subvert security controls implemented in eBPF.
1313

1414
For an overview, see our [presentation about SeaBee](https://www.youtube.com/watch?v=4bWpTKK7Mlw) from the 2025 Linux Security Summit NA
1515

16-
To try out SeaBee, see [Getting Started with SeaBee](./docs/docs/getting_started.md). Then try our [tutorial](./docs/docs/tutorial.md).
16+
To try out SeaBee, see [Getting Started with SeaBee](https://code.nsa.gov/seabee/getting_started/). Then try our [tutorial](https://code.nsa.gov/seabee/tutorial/).
1717

1818
Don't hesitate to create an issue or a PR. See [CONTRIBUTING.md](./CONTRIBUTING.md)
1919

@@ -28,9 +28,9 @@ The different elements of SeaBee are highlighted in blue.
2828
The other elements show how users interact with SeaBee and
2929
how other processes interact with SeaBee.
3030

31-
- `seabeectl` is a command line interface for SeaBee. See [`seabeectl` docs](./docs/docs/seabeectl.md)
32-
- The SeaBee userspace manages loading eBPF, tracking [policy](./docs/docs/policy.md) updates,
33-
and [logging](./docs/docs/logging.md).
31+
- `seabeectl` is a command line interface for SeaBee. See [`seabeectl` docs](https://code.nsa.gov/seabee/seabeectl/)
32+
- The SeaBee userspace manages loading eBPF, tracking [policy](https://code.nsa.gov/seabee/policy/) updates,
33+
and [logging](https://code.nsa.gov/seabee/logging/).
3434
- eBPF maps are used to store SeaBee policy in the kernel
3535
- eBPF LSM programs are used to enforce SeaBee policies on processes
3636
when they take a particular action that SeaBee cares about.
@@ -44,14 +44,12 @@ Examples include accessing eBPF maps or files associated with a SeaBee policy.
4444

4545
## Documentation
4646

47-
Documentation is found under `docs/docs/`
47+
Documentation is found under `docs/docs/` and is hosted at [code.nsa.gov/seabee](https://code.nsa.gov/seabee).
4848

49-
- To build the documentation:
50-
- Reload the shell `source ~/.bashrc`
51-
- `make docs` and then `make -C docs build`
52-
- To view the documentation in a browser: `make -C docs serve-build`
49+
To build and view the documentation locally in a browser:
5350

54-
TODO: move docs to github pages
51+
- `make update`
52+
- `make -C docs serve-build`
5553

5654
## Disclaimer of Endorsement
5755

bpf/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ license.workspace = true
55
readme.workspace = true
66
rust-version.workspace = true
77
version.workspace = true
8+
description.workspace = true
9+
repository.workspace = true
10+
homepage.workspace = true
811

912
[dependencies]
1013
anyhow.workspace = true

bpf/src/seabee/seabee.bpf.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,10 @@ int BPF_PROG(seabee_kernel_module_request, char *kmod_name)
484484
log_kernel_module_request(LOG_LEVEL_WARN, LOG_REASON_DENY,
485485
(const unsigned char *)kmod_name);
486486
return DENY;
487+
} else if (kmod_modification == (u32)SECURITY_AUDIT) {
488+
log_kernel_module_request(LOG_LEVEL_INFO, LOG_REASON_AUDIT,
489+
(const unsigned char *)kmod_name);
487490
}
488-
log_kernel_module_request(LOG_LEVEL_INFO, LOG_REASON_ALLOW,
489-
(const unsigned char *)kmod_name);
490491
return ALLOW;
491492
}
492493

@@ -495,7 +496,7 @@ int BPF_PROG(seabee_kernel_module_request, char *kmod_name)
495496
*
496497
* lsm/kernel_read_file is invoked when the kernel is about to directly read
497498
* from a file or the file system specified by userspace for some purpose
498-
* including but not limited to kernel modules laoded via finit_module()
499+
* including but not limited to kernel modules loaded via finit_module()
499500
*
500501
* enum kernel_load_data_id is the same as __kernel_read_file_id defined in
501502
* https://elixir.bootlin.com/linux/latest/source/include/linux/kernel_read_file.h#L9
@@ -514,13 +515,14 @@ SEC("lsm/kernel_read_file")
514515
int BPF_PROG(seabee_kernel_read_file, struct file *file,
515516
enum kernel_read_file_id id, bool contents)
516517
{
517-
if (id == READING_MODULE) {
518+
if (id == READING_MODULE && kmod_modification == (u32)SECURITY_BLOCK) {
518519
log_kernel_read_file(LOG_LEVEL_WARN, LOG_REASON_DENY, id,
519520
file->f_path.dentry->d_name.name);
520521
return DENY;
522+
} else if (kmod_modification == (u32)SECURITY_AUDIT) {
523+
log_kernel_read_file(LOG_LEVEL_INFO, LOG_REASON_AUDIT, id,
524+
file->f_path.dentry->d_name.name);
521525
}
522-
log_kernel_read_file(LOG_LEVEL_INFO, LOG_REASON_ALLOW, id,
523-
file->f_path.dentry->d_name.name);
524526
return ALLOW;
525527
}
526528

@@ -547,11 +549,12 @@ SEC("lsm/kernel_load_data")
547549
int BPF_PROG(seabee_kernel_load_data, enum kernel_load_data_id id,
548550
bool contents)
549551
{
550-
if (id == LOADING_MODULE) {
552+
if (id == LOADING_MODULE && kmod_modification == (u32)SECURITY_BLOCK) {
551553
log_kernel_load_data(LOG_LEVEL_WARN, LOG_REASON_DENY, id);
552554
return DENY;
555+
} else if (kmod_modification == (u32)SECURITY_AUDIT) {
556+
log_kernel_load_data(LOG_LEVEL_INFO, LOG_REASON_AUDIT, id);
553557
}
554-
log_kernel_load_data(LOG_LEVEL_INFO, LOG_REASON_ALLOW, id);
555558
return ALLOW;
556559
}
557560

@@ -821,9 +824,9 @@ int BPF_PROG(seabee_start_pin, int cmd, union bpf_attr *attr, unsigned int size,
821824
}
822825

823826
/**
824-
* @brief Label an inode associted with a bpf pin
827+
* @brief Label an inode associated with a bpf pin
825828
*
826-
* This hook is called when a dentry becomes associted with an inode.
829+
* This hook is called when a dentry becomes associated with an inode.
827830
*/
828831
SEC("lsm/d_instantiate")
829832
int BPF_PROG(seabee_label_pin, struct dentry *dentry, struct inode *inode)

0 commit comments

Comments
 (0)