-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (58 loc) · 2.63 KB
/
Makefile
File metadata and controls
73 lines (58 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.PHONY: help all build install build-ebpf build-loader install-loader build-all clean-ebpf run test clippy fmt
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
all: install build-ebpf install-loader ## Full install: build and install everything (main binary, eBPF programs, loader)
build: ## Build the jail-ai binary (release)
cargo build --release
install: build ## Build and install the jail-ai binary
cargo install --path .
build-ebpf: ## Build eBPF programs in a container (reuses container if exists)
@echo "Building eBPF programs..."
./build-ebpf.sh
build-loader: ## Build the eBPF loader helper binary
@echo "Building jail-ai-ebpf-loader..."
cargo build --release -p jail-ai-ebpf-loader
@echo "✓ Helper binary built at: target/release/jail-ai-ebpf-loader"
install-loader: build-loader ## Install the eBPF loader helper binary with capabilities
@echo "Installing jail-ai-ebpf-loader..."
cargo install --path jail-ai-ebpf-loader --force
@echo "✓ Helper binary installed"
@echo ""
@echo "⚠️ SECURITY NOTICE: Granting capabilities to helper binary"
@echo "This gives CAP_BPF and CAP_NET_ADMIN to the small (~400 LOC) helper binary."
@echo "The main jail-ai binary remains unprivileged."
@echo ""
sudo setcap cap_bpf,cap_net_admin+ep $$(which jail-ai-ebpf-loader)
@echo "✓ Capabilities granted to helper binary"
@echo ""
@echo "Verification:"
@echo " Helper capabilities: $$(getcap $$(which jail-ai-ebpf-loader))"
build-all: build-ebpf build build-loader ## Build everything (eBPF programs, main binary, and loader)
clean-ebpf: ## Remove the eBPF build container
@echo "Removing eBPF build container..."
@if command -v podman &> /dev/null; then \
podman rm -f build-ebpf 2>/dev/null || true; \
elif command -v docker &> /dev/null; then \
docker rm -f build-ebpf 2>/dev/null || true; \
fi
@echo "eBPF build container removed."
run: ## Run jail-ai (use ARGS="..." to pass arguments)
cargo run -- $(ARGS)
test: ## Run tests
cargo test
clippy: ## Run clippy lints
cargo clippy -- -D warnings
fmt: ## Format code
cargo fmt
update-cloud-versions: ## Update cloud provider tool versions to latest
@echo "Updating cloud provider tool versions..."
./scripts/update-cloud-versions.sh
@echo ""
@echo "Review changes with: git diff containerfiles/"
@echo "Rebuild with: make rebuild-cloud-layers"
rebuild-cloud-layers: ## Force rebuild cloud layers with updated versions
@echo "Rebuilding cloud layers..."
cargo run -- claude --cloud --upgrade --force-layers aws,gcp --verbose