All Projects → mrtc0 → bouheki

mrtc0 / bouheki

Licence: MIT License
Tool for Preventing Data Exfiltration with eBPF

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to bouheki

Polycube
eBPF/XDP-based software framework for fast network services running in the Linux kernel.
Stars: ✭ 217 (+675%)
Mutual labels:  firewall, ebpf
XDP-Firewall
An XDP firewall that is capable of filtering specific packets based off of filtering rules specified in a config file. IPv6 is supported!
Stars: ✭ 129 (+360.71%)
Mutual labels:  firewall, ebpf
packiffer
lightweight cross-platform networking toolkit
Stars: ✭ 52 (+85.71%)
Mutual labels:  firewall, ebpf
OpenBSDFirewall
Simple OpenBSD Home Firewall Config for ALIX Board
Stars: ✭ 41 (+46.43%)
Mutual labels:  firewall
noddos
Noddos client
Stars: ✭ 78 (+178.57%)
Mutual labels:  firewall
changelog
Security router changelog
Stars: ✭ 15 (-46.43%)
Mutual labels:  firewall
libebpf
Experiemental userspace eBPF library
Stars: ✭ 14 (-50%)
Mutual labels:  ebpf
pixie
Instant Kubernetes-Native Application Observability
Stars: ✭ 3,238 (+11464.29%)
Mutual labels:  ebpf
WindowsFirewallRuleset
Windows firewall PowerShell scripts
Stars: ✭ 94 (+235.71%)
Mutual labels:  firewall
revshfuzz
A tool for fuzzing for ports that allow outgoing connections
Stars: ✭ 18 (-35.71%)
Mutual labels:  firewall
oxdpus
A toy tool that leverages the super powers of XDP to bring in-kernel IP filtering
Stars: ✭ 59 (+110.71%)
Mutual labels:  ebpf
astlinux
AstLinux is a "Network Appliance for Communications" x86_64 Linux distribution
Stars: ✭ 23 (-17.86%)
Mutual labels:  firewall
firewall
Python Firewall Library
Stars: ✭ 46 (+64.29%)
Mutual labels:  firewall
sockdump
Dump unix domain socket traffic with bpf
Stars: ✭ 160 (+471.43%)
Mutual labels:  ebpf
OPNsensePIAWireguard
This script automates the process of getting Wireguard setup on OPNsense to connect to PIA's NextGen Wireguard servers. It will create Wireguard Instance(Local) and Peer(Endpoint) on your OPNsense setup.
Stars: ✭ 59 (+110.71%)
Mutual labels:  firewall
ehids
A Linux Host-based Intrusion Detection System based on eBPF.
Stars: ✭ 210 (+650%)
Mutual labels:  ebpf
asa cleanup
Cisco ASA Firewall Cleanup Script.
Stars: ✭ 40 (+42.86%)
Mutual labels:  firewall
pwru
Packet, where are you? -- Linux kernel networking debugger
Stars: ✭ 694 (+2378.57%)
Mutual labels:  ebpf
bpflock
bpflock - eBPF driven security for locking and auditing Linux machines
Stars: ✭ 54 (+92.86%)
Mutual labels:  ebpf
btfhub
BTFHub, together with BTFHub Archive repository, provides BTF files for existing published kernels that don't support embedded BTF.
Stars: ✭ 100 (+257.14%)
Mutual labels:  ebpf

bouheki: Tool for Preventing Data Exfiltration with eBPF

bouheki is a KSRI implementation using LSM Hook by eBPF. Flexibility to apply restricted network policies to specific resources such as processes and containers.

Features and Network Restrictions

  • While firewalls such as iptables apply to the entire machine, bouheki can be restricted on a per-container or per-process basis.
  • bouheki does not restrict ingress, only egress.

Getting Started

0. Requirements

  • Linux Kernel >= 5.8.0
    • BTF(CONFIG_DEBUG_INFO_BTF) must be enabled.
    • BPF LSM(CONFIG_LSM with bpf) must be enabled. This parameter can also be changed in the boot parameter.

See INSTALL.md for details on installation.

Linux distributions and supported kernels

Distro Name Distro Version Kernel Version
Ubuntu "Groovy Gorilla" 20.10 5.8+
Fedora 33 5.8+

1. Install

Download latest released binary from https://github.com/mrtc0/bouheki/releases

2. Configuration

Write the network restriction policy in YAML.
This policy allows access to 10.0.1.1/24 only, but does not allow access to 10.0.1.10/32.

See config directory for more configuration examples.

# block.yml
network:
  # Block or monitor the network.
  # If block is specified, communication that matches the policy will be blocked.
  mode: block # monitor or block. Default: monitor
  # Restriction to the whole host or to a container
  # If a container is specified, only the container's communication will be restricted. This is determined by the value of namespace
  target: host # host or container. Default: host
  cidr:
    allow:
      - 10.0.1.1/24
      # - 127.0.0.1/24
    # Override "allow" list with exceptions. Default: []
    deny: # []
      - 10.0.1.10/32
  # Restrictions by command name (optional).
  command:
    # Default: empty. All command will be allowed.
    allow: []
    # - curl
    # Default: empty. All command will be allowed.
    deny: []
    #  - wget
    #  - nc
  # Restrictions by UID (optional).
  uid:
    allow: []
    deny: []
  # Restrictions by GID (optional).
  gid:
    allow: []
      # - 0
    deny: []
      # 1000
log:
  # Log format(json or text). Default: json
  format: json
  # Specified log file location. Default: stdout
  # output: /var/log/bouheki.log.json
  # Maximum size to rotate (MB)
  # max_size: 100
  # Period for which logs are kept
  # max_age: 365

Run with the policy.

$ sudo bouheki --config block.yaml

3. Test

$ curl -k -I https://10.0.1.1
HTTP/1.1 200 OK

$ curl -k -I https://10.0.1.10
curl: (7) Couldn't connect to server

$ curl -k -I https://example.com
curl: (7) Couldn't connect to server

4. Inspect Logs

The log will record the blocked events.

{
  "Action": "BLOCKED",
  "Addr": "10.0.1.71",
  "Comm": "curl",
  "Hostname": "sandbox",
  "PID": 790791,
  "ParentComm": "bash",
  "Port": 443,
  "Protocol": "TCP",
  "level": "info",
  "msg": "Traffic is trapped in the filter.",
  "time": "2021-09-23T12:47:55Z"
}
{
  "Action": "BLOCKED",
  "Addr": "93.184.216.34",
  "Comm": "curl",
  "Hostname": "sandbox",
  "PID": 790823,
  "ParentComm": "bash",
  "Port": 443,
  "Protocol": "TCP",
  "level": "info",
  "msg": "Traffic is trapped in the filter.",
  "time": "2021-09-23T12:49:29Z"
}

Development

$ vagrant up && vagrant reload
$ vagrant ssh

$ cd /opt/go/src/github.com/mrtc0/bouheki/
$ make build

Test

$ make test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].