mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-02-08 21:03:37 +08:00
rename README to chinese documents
This commit is contained in:
@@ -1,25 +1,23 @@
|
||||
# 使用 eBPF 添加 sudo 用户
|
||||
# Using eBPF to add sudo user
|
||||
|
||||
本文完整的源代码:<https://github.com/eunomia-bpf/bpf-developer-tutorial/tree/main/src/26-sudo>
|
||||
The full source code for this article can be found at <https://github.com/eunomia-bpf/bpf-developer-tutorial/tree/main/src/26-sudo>
|
||||
|
||||
关于如何安装依赖,请参考:<https://eunomia.dev/tutorials/11-bootstrap/>
|
||||
|
||||
编译:
|
||||
Compilation:
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
使用方式:
|
||||
Usage:
|
||||
|
||||
```sh
|
||||
sudo ./sudoadd --username lowpriv-user
|
||||
```
|
||||
|
||||
这个程序允许一个通常权限较低的用户使用 `sudo` 成为 root。
|
||||
This program allows a user with lower privileges to become root using `sudo`.
|
||||
|
||||
它通过拦截 `sudo` 读取 `/etc/sudoers` 文件,并将第一行覆盖为 `<username> ALL=(ALL:ALL) NOPASSWD:ALL #` 的方式工作。这欺骗了 sudo,使其认为用户被允许成为 root。其他程序如 `cat` 或 `sudoedit` 不受影响,所以对于这些程序来说,文件未改变,用户并没有这些权限。行尾的 `#` 确保行的其余部分被当作注释处理,因此不会破坏文件的逻辑。
|
||||
It works by intercepting `sudo` reading the `/etc/sudoers` file and overwriting the first line with `<username> ALL=(ALL:ALL) NOPASSWD:ALL #`. This tricks `sudo` into thinking that the user is allowed to become root. Other programs like `cat` or `sudoedit` are not affected, so the file remains unchanged and the user does not have these permissions. The `#` at the end of the line ensures that the rest of the line is treated as a comment, so it does not break the logic of the file.
|
||||
|
||||
## 参考资料
|
||||
## References
|
||||
|
||||
- <https://github.com/pathtofile/bad-bpf>
|
||||
- [https://github.com/pathtofile/bad-bpf](https://github.com/pathtofile/bad-bpf)
|
||||
25
src/26-sudo/README.zh.md
Normal file
25
src/26-sudo/README.zh.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# 使用 eBPF 添加 sudo 用户
|
||||
|
||||
本文完整的源代码:<https://github.com/eunomia-bpf/bpf-developer-tutorial/tree/main/src/26-sudo>
|
||||
|
||||
关于如何安装依赖,请参考:<https://eunomia.dev/tutorials/11-bootstrap/>
|
||||
|
||||
编译:
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
使用方式:
|
||||
|
||||
```sh
|
||||
sudo ./sudoadd --username lowpriv-user
|
||||
```
|
||||
|
||||
这个程序允许一个通常权限较低的用户使用 `sudo` 成为 root。
|
||||
|
||||
它通过拦截 `sudo` 读取 `/etc/sudoers` 文件,并将第一行覆盖为 `<username> ALL=(ALL:ALL) NOPASSWD:ALL #` 的方式工作。这欺骗了 sudo,使其认为用户被允许成为 root。其他程序如 `cat` 或 `sudoedit` 不受影响,所以对于这些程序来说,文件未改变,用户并没有这些权限。行尾的 `#` 确保行的其余部分被当作注释处理,因此不会破坏文件的逻辑。
|
||||
|
||||
## 参考资料
|
||||
|
||||
- <https://github.com/pathtofile/bad-bpf>
|
||||
@@ -1,23 +0,0 @@
|
||||
# Using eBPF to add sudo user
|
||||
|
||||
The full source code for this article can be found at <https://github.com/eunomia-bpf/bpf-developer-tutorial/tree/main/src/26-sudo>
|
||||
|
||||
Compilation:
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
Usage:
|
||||
|
||||
```sh
|
||||
sudo ./sudoadd --username lowpriv-user
|
||||
```
|
||||
|
||||
This program allows a user with lower privileges to become root using `sudo`.
|
||||
|
||||
It works by intercepting `sudo` reading the `/etc/sudoers` file and overwriting the first line with `<username> ALL=(ALL:ALL) NOPASSWD:ALL #`. This tricks `sudo` into thinking that the user is allowed to become root. Other programs like `cat` or `sudoedit` are not affected, so the file remains unchanged and the user does not have these permissions. The `#` at the end of the line ensures that the rest of the line is treated as a comment, so it does not break the logic of the file.
|
||||
|
||||
## References
|
||||
|
||||
- [https://github.com/pathtofile/bad-bpf](https://github.com/pathtofile/bad-bpf)
|
||||
Reference in New Issue
Block a user