eunomia-bpf / bpf-developer-tutorial

eBPF Developer Tutorial: Learning eBPF Step by Step with Examples
https://eunomia.dev/tutorials/
MIT License
2.37k stars 341 forks source link

[BUG] 30-sslsniff: make: *** [Makefile:86: /home/pegasus/Documents/bpf-developer-tutorial/src/30-sslsniff/.output/libbpf.a] Error 2 #121

Open NobinPegasus opened 3 months ago

NobinPegasus commented 3 months ago

Describe the bug When I'm trying to build the sslsniff tool from lesson 30 I face the following error: make: *** [Makefile:86: /home/pegasus/Documents/bpf-developer-tutorial/src/30-sslsniff/.output/libbpf.a] Error 2

To Reproduce

use make from the 30-sslsniff directory.

pegasus@pegasus:~/Documents/bpf-developer-tutorial/src/30-sslsniff$ make
  MKDIR    .output
  MKDIR    .output/libbpf
  LIB      libbpf.a
make[1]: *** /home/pegasus/Documents/bpf-developer-tutorial/src/third_party/libbpf/src: No such file or directory.  Stop.
make: *** [Makefile:86: /home/pegasus/Documents/bpf-developer-tutorial/src/30-sslsniff/.output/libbpf.a] Error 2

Expected behavior It should build the tool properly

Screenshots image

Desktop (please complete the following information):

pegasus@pegasus:~$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
pegasus@pegasus:~$ uname -a
Linux pegasus 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
oluceps commented 3 months ago

Seems to miss submodules. Try

git submodule init --update --recursive
NobinPegasus commented 3 months ago

I already have my libbpf inside the 30-sslsniff directory and built it there. Where should I have it?

image

oluceps commented 3 months ago

Where should I have it?

git submodule update --init --recursive

Run this under the top-level of bpf-developer-tutorial directory. This will init the git submodule in ./src/thirdparty/libbpf

NobinPegasus commented 3 months ago

The output

pegasus@pegasus:~/Documents/bpf-developer-tutorial$ git submodule init --update --recursive
usage: git submodule [--quiet] [--cached]
   or: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
   or: git submodule [--quiet] update [--init [--filter=<filter-spec>]] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] [--] [<path>...]
   or: git submodule [--quiet] set-branch (--default|--branch <branch>) [--] <path>
   or: git submodule [--quiet] set-url [--] <path> <newurl>
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
   or: git submodule [--quiet] absorbgitdirs [--] [<path>...]
oluceps commented 3 months ago

Or clone the entire repo with --recursive arg

oluceps commented 3 months ago

The output

pegasus@pegasus:~/Documents/bpf-developer-tutorial$ git submodule init --update --recursive
usage: git submodule [--quiet] [--cached]
   or: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
   or: git submodule [--quiet] update [--init [--filter=<filter-spec>]] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] [--] [<path>...]
   or: git submodule [--quiet] set-branch (--default|--branch <branch>) [--] <path>
   or: git submodule [--quiet] set-url [--] <path> <newurl>
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
   or: git submodule [--quiet] absorbgitdirs [--] [<path>...]

sry it should be git submodule update --init --recursive I made a typo

NobinPegasus commented 3 months ago

@oluceps Thanks I was able to run it. Following the suggestions you provided. But sslsniff is unable to provide any output. image

oluceps commented 3 months ago

@oluceps Thanks I was able to run it. Following the suggestions you provided. But sslsniff is unable to provide any output.

Try curl --tlsv1.2 https://example.com/

NobinPegasus commented 3 months ago

@oluceps same result. image

Officeyutong commented 3 months ago

@oluceps same result. image

Try use the same user as sslsniff when running curl

NobinPegasus commented 3 months ago

They are the same user. What do you mean? @Officeyutong

Officeyutong commented 3 months ago

They are the same user.

What do you mean?

@Officeyutong

You are using root to run sslsniff but using pegasus to run curl

NobinPegasus commented 3 months ago

Without using sudo ./sslsniff It doesn't work. image

The documentation also suggests to use sudo sslsniff in one terminal and in another terminal use curl. image

It works fine with sudo curl though. But I want to also capture normal firefox or curl traffic from sslsniff. Without using sudo. How can I achieve it?

Officeyutong commented 3 months ago

Without using sudo ./sslsniff It doesn't work. image

The documentation also suggests to use sudo sslsniff in one terminal and in another terminal use curl. image

It works fine with sudo curl though. But I want to also capture normal firefox or curl traffic from sslsniff. Without using sudo. How can I achieve it?

It's an issue to be solved...I don't know how to capture traffic by other users. If you are interested in it, you may try to research on it

yunwei37 commented 6 days ago

It should be able to capture traffic by other users. Let's see what happend.

yunwei37 commented 4 days ago

The cilium slack has some discussion about that. Maybe we can add them in the tutorial.