rename README to chinese documents

This commit is contained in:
Yusheng Zheng
2024-10-20 04:26:42 +00:00
parent 25ab494ccc
commit 049b40d222
143 changed files with 14546 additions and 14533 deletions

View File

@@ -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
View 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>

View File

@@ -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)