Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring AppArmor and Seccomp audit events from a log file #125

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
chmod +x /tmp/llvm.sh
sudo /tmp/llvm.sh 17
sudo ln -s $(which llvm-strip-17) /usr/local/bin/llvm-strip
sudo apt -y install libapparmor-dev libseccomp-dev libsystemd-dev
sudo apt -y install libapparmor-dev libseccomp-dev
8 changes: 4 additions & 4 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img src="docs/img/logo-dark.svg" alt="Logo" width="400">
</picture>
</div>
<br>
<br />

![BHArsenalUSA2024](docs/img/BlackHat-Arsenal-USA-2024.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/bytedance/vArmor)](https://goreportcard.com/report/github.com/bytedance/vArmor)
Expand Down Expand Up @@ -42,8 +42,8 @@ vArmorは、ByteDanceのエンドポイントセキュリティ部門の**Elkeid

|エンフォーサー|要件|推奨|
|------------|--------------------------------------------|--------|
|AppArmor |1. Linux Kernel 4.15以上<br>2. AppArmor LSMが有効化されていること|GKE with Container-Optimized OS<br>AKS with Ubuntu 22.04 LTS<br>[VKE](https://www.volcengine.com/product/vke) with veLinux 1.0<br>Debian 10以上<br>Ubuntu 18.04.0 LTS以上<br>[veLinux 1.0](https://www.volcengine.com/docs/6396/74967)など|
|BPF |1. Linux Kernel 5.10以上 (x86_64)<br>2. containerd v1.6.0以上<br>3. BPF LSMが有効化されていること|EKS with Amazon Linux 2<br>GKE with Container-Optimized OS<br>[VKE](https://www.volcengine.com/product/vke) with veLinux 1.0 (with 5.10 kernel)<br>AKS with Ubuntu 22.04 LTS <sup>\*</sup><br>ACK with Alibaba Cloud Linux 3 <sup>\*</sup><br>OpenSUSE 15.4 <sup>\*</sup><br>Debian 11 <sup>\*</sup><br>Fedora 37 <br>[veLinux 1.0 with 5.10 kernel](https://www.volcengine.com/docs/6396/74967)など<br><br>* *BPF LSMの手動有効化が必要です*|
|AppArmor |1. Linux Kernel 4.15以上<br />2. AppArmor LSMが有効化されていること|GKE with Container-Optimized OS<br />AKS with Ubuntu 22.04 LTS<br />[VKE](https://www.volcengine.com/product/vke) with veLinux 1.0<br />Debian 10以上<br />Ubuntu 18.04.0 LTS以上<br />[veLinux 1.0](https://www.volcengine.com/docs/6396/74967)など|
|BPF |1. Linux Kernel 5.10以上 (x86_64)<br />2. containerd v1.6.0以上<br />3. BPF LSMが有効化されていること|EKS with Amazon Linux 2<br />GKE with Container-Optimized OS<br />[VKE](https://www.volcengine.com/product/vke) with veLinux 1.0 (with 5.10 kernel)<br />AKS with Ubuntu 22.04 LTS <sup>\*</sup><br />ACK with Alibaba Cloud Linux 3 <sup>\*</sup><br />OpenSUSE 15.4 <sup>\*</sup><br />Debian 11 <sup>\*</sup><br />Fedora 37 <br />[veLinux 1.0 with 5.10 kernel](https://www.volcengine.com/docs/6396/74967)など<br /><br />* *BPF LSMの手動有効化が必要です*|
|Seccomp |1. Kubernetes v1.19以上|すべてのLinuxディストリビューション|

## ポリシーモードと組み込みルール
Expand Down Expand Up @@ -123,7 +123,7 @@ vArmorは、eBPFプログラムを管理および操作するために[cilium/eb
vArmorは、[Nirmata](https://nirmata.com/)によって開発された[kyverno](https://github.com/kyverno/kyverno)の一部のコードを参照しています。

## デモ
以下は、vArmorを使用してDeploymentを強化し、CVE-2021-22555に対抗するデモンストレーションです。(エクスプロイトは[cve-2021-22555](https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555)から変更されています)<br>
以下は、vArmorを使用してDeploymentを強化し、CVE-2021-22555に対抗するデモンストレーションです。(エクスプロイトは[cve-2021-22555](https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555)から変更されています)<br />
![image](test/demos/CVE-2021-22555/demo.gif)

## 404Starlink
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img src="docs/img/logo-dark.svg" alt="Logo" width="400">
</picture>
</div>
<br>
<br />

![BHArsenalUSA2024](docs/img/BlackHat-Arsenal-USA-2024.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/bytedance/vArmor)](https://goreportcard.com/report/github.com/bytedance/vArmor)
Expand Down Expand Up @@ -74,7 +74,7 @@ vArmor references part of the code of [kyverno](https://github.com/kyverno/kyver


## Demo
Below is a demonstration of using vArmor to harden a Deployment and defend against CVE-2021-22555. (The exploit is modified from [cve-2021-22555](https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555))<br>
Below is a demonstration of using vArmor to harden a Deployment and defend against CVE-2021-22555. (The exploit is modified from [cve-2021-22555](https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555))<br />
![image](test/demos/CVE-2021-22555/demo.gif)


Expand Down
4 changes: 2 additions & 2 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img src="docs/img/logo-dark.svg" alt="Logo" width="400">
</picture>
</div>
<br>
<br />

![BHArsenalUSA2024](docs/img/BlackHat-Arsenal-USA-2024.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/bytedance/vArmor)](https://goreportcard.com/report/github.com/bytedance/vArmor)
Expand Down Expand Up @@ -74,7 +74,7 @@ vArmor 在研发初期参考了 [Nirmata](https://nirmata.com/) 开发的 [kyver


## 演示
下面是一个使用 vArmor 对 Deployment 进行加固,防御 CVE-2021-22555 攻击的演示(Exploit 修改自 [cve-2021-22555](https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555))。<br>
下面是一个使用 vArmor 对 Deployment 进行加固,防御 CVE-2021-22555 攻击的演示(Exploit 修改自 [cve-2021-22555](https://github.com/google/security-research/tree/master/pocs/linux/cve-2021-22555))。<br />
![image](test/demos/CVE-2021-22555/demo.zh_CN.gif)


Expand Down
2 changes: 1 addition & 1 deletion cmd/varmor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ COPY --from=vArmor-ebpf-builder /varmor/vArmor-ebpf/pkg/bpfenforcer/bpf_bpfel.go
COPY --from=vArmor-ebpf-builder /varmor/vArmor-ebpf/pkg/bpfenforcer/bpf_bpfel.o /varmor/pkg/lsm/bpfenforcer

RUN apt-get update
RUN apt-get install -y libseccomp2 libseccomp-dev libsystemd-dev
RUN apt-get install -y libseccomp2 libseccomp-dev
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2)
RUN go env
Expand Down
3 changes: 3 additions & 0 deletions cmd/varmor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var (
webhookMatchLabel string
bpfExclusiveMode bool
statusUpdateCycle time.Duration
auditLogPaths string
setupLog = log.Log.WithName("SETUP")
)

Expand All @@ -86,6 +87,7 @@ func main() {
flag.StringVar(&webhookMatchLabel, "webhookMatchLabel", "sandbox.varmor.org/enable=true", "Configure the matchLabel of webhook configuration, the valid format is key=value or nil")
flag.BoolVar(&bpfExclusiveMode, "bpfExclusiveMode", false, "Set this flag to enable exclusive mode for the BPF enforcer. It will disable the AppArmor confinement when using the BPF enforcer.")
flag.DurationVar(&statusUpdateCycle, "statusUpdateCycle", time.Hour*2, "Configure the status update cycle for VarmorPolicy and ArmorProfile")
flag.StringVar(&auditLogPaths, "auditLogPaths", "/var/log/audit/audit.log|/var/log/kern.log", "Configure the file search list to select the audit log file and read the AppArmor and Seccomp audit events. Please use a vertical bar to separate the file paths, the first valid file will be used to track the audit events.")
flag.Parse()

// Set the webhook matchLabels configuration.
Expand Down Expand Up @@ -157,6 +159,7 @@ func main() {
managerIP,
config.StatusServicePort,
config.ClassifierServicePort,
auditLogPaths,
stopCh,
log.Log.WithName("AGENT"),
)
Expand Down
17 changes: 0 additions & 17 deletions config/manifest/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ spec:
name: seccomp-dir
- mountPath: /var/log
name: var-log-dir
- mountPath: /run/log
name: run-log-dir
- mountPath: /etc/machine-id
name: machine-id
readOnly: true
- mountPath: /var/run/secrets/tokens
name: bound-token
readinessProbe:
Expand All @@ -82,10 +77,6 @@ spec:
path: /run/containerd
type: Directory
name: containerd
- hostPath:
path: /proc
type: Directory
name: procfs
- hostPath:
path: /var/run/varmor/audit
type: DirectoryOrCreate
Expand All @@ -106,14 +97,6 @@ spec:
path: /var/log
type: Directory
name: var-log-dir
- hostPath:
path: /run/log
type: Directory
name: run-log-dir
- hostPath:
path: /etc/machine-id
type: File
name: machine-id
- projected:
sources:
- serviceAccountToken:
Expand Down
Loading
Loading