Giter Club home page Giter Club logo

openssl_tracer's Introduction

openssl_tracer

openssl_tracer: 基于eBPF技术实现TLS加密的明文捕获。

该样例项目是基于eBPF来追踪OpenSSL动态库的例子,使用 libbpf 进行追踪。在eBPF 程序中, 由于 libbpf 方法内核已经支持了 BTF,不再需要引入众多的内核头文件来获取内核数据结构的定义, 取而代之的是 bpftool 生成的 vmlinux.h 头文件,其中包含内核数据结构的定义。

这个样例是为了配合“使用eBPF跟踪 SSL/TLS 连接” 这个 Blog

OpenSSL Tracer using BPF

This is a basic example of how to trace the OpenSSL library using eBPF. This tracer uses BCC to deploy the eBPF probes. This demo was created to accompany the "Debugging with eBPF Part 3: Tracing SSL/TLS connections" blog post.

eBPF 程序能够加载到 trace points、内核及用户空间应用程序中的 probe points, 这种能力使我们对应用程序的运行时行为(runtime behavior)和系统本身 (system itself)提供了史无前例的可观测性。

Prerequisites

操作系统版本最好大于 5.x,本样例运行于 ubuntu 5.15.x 版本。 一些5.4版本以下的内核还会存在些许问题,详见 iovisor/bcc#2948

$ uname -r
5.15.0-30-generic

CONFIG_DEBUG_INFO_BTF = y,新的 BPF 二进制文件仅在设置了此内核配置选项后才可用,Ubuntu 20.10 已经将此配置选项设置为默认选项

需要安装 libbpf 工具,在Ubuntu 上执行以下命令,

$ sudo apt install libbpf-dev

其他操作系统有类似的命令。

Build

执行以下命令

make ebpf
make build

Run Demo Application

该 Demo 包含一个 ssl_client_server 的 ssl 通信的小程序。运行该小程序可以稳定的运行 ssl 通信数据。

cd ssl_client_server; python3 ./server.py
cd ssl_client_server; python3 ./client.py

Run Tracer

以下方式

sudo ./openssl_tracer <pid>

如果是追踪小程序,则可以

sudo ./openssl_tracer $(pgrep -f "./client.py")

openssl_tracer's People

Contributors

kiosk404 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.