• Stars
    star
    270
  • Rank 149,016 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust library for writing Linux security policies using eBPF

Deepfence Logo

GitHub license GitHub stars Workflow Status GitHub issues Slack

ROSS Index - Fastest Growing Open-Source Startups | Runa Capital

Ebpfguard

Ebpfguard is a library for managing Linux security policies. It is based on LSM hooks, but without necessity to write any kernel modules or eBPF programs directly. It allows to write policies in Rust (or YAML) in user space.

It's based on eBPF and Aya library, but takes away the need to use them directly.

Usage example

Deny mount operation for all users.

    const BPF_MAPS_PATH: &str = "/sys/fs/bpf/example_sb_mount";

    // Create a directory where ebpfguard policy manager can store its BPF
    // objects (maps).
    std::fs::create_dir_all(BPF_MAPS_PATH)?;

    // Create a policy manager.
    let mut policy_manager = PolicyManager::new(BPF_MAPS_PATH)?;

    // Attach the policy manager to the mount LSM hook.
    let mut sb_mount = policy_manager.attach_sb_mount()?;

    // Get the receiver end of the alerts channel (for the `file_open` LSM
    // hook).
    let mut sb_mount_rx = sb_mount.alerts().await?;

    // Define policies which deny mount operations for all processes (except
    // for the specified subject, if defined).
    sb_mount
        .add_policy(SbMount {
            subject: PolicySubject::All,
            allow: false,
        })
        .await?;

    if let Some(alert) = sb_mount_rx.recv().await {
        info!(
            "sb_mount alert: pid={} subject={}",
            alert.pid, alert.subject
        );
    }

Imports and cargo file are available in example source code. For more check out examples doc.

Supported LSM hooks

LSM hooks supported by Ebpfguard are:

Prerequisites

Check prerequisites doc to set up your environment.

Development

Check development doc for compillation and testing commands.

Get in touch

Thank you for using Ebpfguard. Please feel welcome to participate in the Deepfence community.

  • Deepfence Community Website
  • Got a question, need some help? Find the Deepfence team on Slack
  • GitHub issues Got a feature request or found a bug? Raise an issue

License

Ebpfguard's userspace part is licensed under Apache License, version 2.0.

eBPF programs inside ebpfguard-ebpf directory are licensed under GNU General Public License, version 2.

More Repositories

1

ThreatMapper

Open Source Cloud Native Application Protection Platform (CNAPP)
TypeScript
4,685
star
2

SecretScanner

πŸ”“ πŸ”“ Find secrets and passwords in container images and file systems πŸ”“ πŸ”“
Go
2,987
star
3

PacketStreamer

⭐ ⭐ Distributed tcpdump for cloud native environments ⭐ ⭐
Go
1,857
star
4

YaraHunter

πŸ”πŸ” Malware scanner for cloud-native, as part of CI/CD and at Runtime πŸ”πŸ”
Go
1,233
star
5

FlowMeter

⭐ ⭐ Use ML to classify flows and packets as benign or malicious. ⭐ ⭐
Go
1,101
star
6

community

Deepfence Community
69
star
7

deepfence_runtime_api

Deepfence Runtime API & code samples
HTML
50
star
8

vessel

Vessel is the Go based utility that autodetects underlying Container Runtime in Kubernetes
Go
44
star
9

ThreatStryker-docs

ThreatStryker Documentation
42
star
10

package-scanner

Go
40
star
11

DocumentationWebsite

JavaScript
36
star
12

terraform-gcp-cloud-scanner

Deepfence Cloud Scanner runs in your cloud environment, gathering inventory and compliance information for the assets deployed in that environment. It submits that information to your Deepfence ThreatMapper or ThreatStryker Management Console
HCL
35
star
13

yara-rules

YARA
35
star
14

terraform-aws-cloud-scanner

Deepfence Cloud Scanner runs in your cloud environment, gathering inventory and compliance information for the assets deployed in that environment. It submits that information to your Deepfence ThreatMapper or ThreatStryker Management Console
HCL
35
star
15

helm-charts

Smarty
34
star
16

terraform-azure-cloud-scanner

Deepfence Cloud Scanner runs in your cloud environment, gathering inventory and compliance information for the assets deployed in that environment. It submits that information to your Deepfence ThreatMapper or ThreatStryker Management Console
HCL
33
star
17

CI-CD-Integrations

CI/CD plugins for image scanning, integrations with AWS ECR, Google Container Registry
HCL
32
star
18

secretscanner-docker-extension

⛴️ Docker extension for deepfence/SecretScanner πŸ”
JavaScript
24
star
19

terraform-aws-threatmapper

ThreatMapper Terraform module for AWS
HCL
24
star
20

yarahunter-docker-extension

⛴️Docker extension for deepfence/YaraHunterπŸ”Ž
JavaScript
23
star
21

pcap-tools

C
22
star
22

compliance

Compliance Scripts Handler
Shell
21
star
23

agent-plugins-grpc

Agent plugins' gRPC definitions
Makefile
20
star
24

apache-struts

This repository contains sample attacks that can be used to exploit vulnerabilities in the Jakarta Multipart Parser of Apache Struts
Java
20
star
25

.github

18
star
26

sock-app-canary

Shell
17
star
27

golang_deepfence_sdk

Golang deepfence SDK
Go
15
star
28

kubernetes-scanner

Kubernetes Security Posture Management
Go
14
star
29

open-tracer

Open tracer that uses eBPF kernel features
Rust
3
star
30

threatmapper-python-client

ThreatMapper python client
Python
3
star
31

ebpfguard-blog-example

Sample of eBPFGuard capabilities for upcoming blogpost.
Rust
3
star
32

ThreatMapperWorkshop

CNAPP Security Workshop using ThreatMapper
3
star
33

deepfence-playground

Deepfence's Sandbox on killercoda Platform
Shell
2
star
34

terraform-provider-deepfence

Deepfence Terraform provider
2
star
35

CommunityThreatIntel

Threat Intelligence by and for the community
1
star
36

cloud-scanner

Deepfence Cloud Scanner runs in your cloud environment, gathering inventory and compliance information for the assets deployed in that environment. It submits that information to your Deepfence ThreatMapper or ThreatStryker Management Console.
Go
1
star
37

http2viewer

HTTP2 message viewer
Go
1
star