README
This commit is contained in:
parent
5415afe3e1
commit
1da5206101
|
|
@ -0,0 +1,46 @@
|
|||
# 拦截execve系统调用,以达到对用户命令执行检查的功能
|
||||
|
||||
## 前置依赖:
|
||||
|
||||
- jsonc:
|
||||
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install libjson-c-dev
|
||||
|
||||
# CentOS/RHEL
|
||||
sudo yum install json-c-devel
|
||||
|
||||
```
|
||||
|
||||
## 编译:
|
||||
|
||||
- cd execve_hook && make
|
||||
|
||||
## 测试:
|
||||
|
||||
- ./test_bash.sh
|
||||
|
||||
## 配置文件格式:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"cmd": "nvidia-smi", // 将匹配的命令
|
||||
"type": "warn", // 如果为warn,则会提示是否继续执行
|
||||
"msg": "在沐曦环境下请执行mx-smi" // 提示信息
|
||||
},
|
||||
{
|
||||
"cmd": "rm", // 匹配的命令
|
||||
"type": "error", // 如果为error,则会拦截命令执行
|
||||
"msg": "Error: rm command is forbidden" // 提示信息
|
||||
},
|
||||
{
|
||||
"cmd": "pip", // 匹配的命令
|
||||
"type": "warn",
|
||||
"msg": "使用pip安装torch时,请注意使用厂家支持版本",
|
||||
"args": ["install", "torch"] //当存在args,则这里的参数必须全部存在
|
||||
}
|
||||
]
|
||||
|
||||
```
|
||||
|
|
@ -13,6 +13,6 @@
|
|||
"cmd": "pip",
|
||||
"type": "warn",
|
||||
"msg": "使用pip安装torch时,请注意使用厂家支持版本",
|
||||
"params": ["install", "torch"]
|
||||
"args": ["install", "torch"]
|
||||
}
|
||||
]
|
||||
Loading…
Reference in New Issue