赞
踩
ubuntu18.04安装Python3.8.3
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
sudo apt-get install openssl-devel
sudo apt-get install bzip2-devel
sudo apt-get install expat-devel
sudo apt-get install gdbm-devel
sudo apt-get install readline-devel
sudo apt-get install sqlite-devel
sudo apt-get install zlib-devel
sudo apt-get install libffi-devel -y
sudo apt-get install -y gcc
sudo apt-get -y install zlib*
tar -xvf Python-3.8.3.tgz
cd Python-3.8.3
创建安装的文件夹,配置安装目录
mkdir /usr/local/python3.8.3
./configure --prefix=/usr/local/python3.8.3
编译和安装
make && make install
配置软连接
rm -rf /usr/bin/python3
rm -rf /usr/bin/pip3
ln -s /usr/local/python3.8.3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3.8.3/bin/pip3 /usr/bin/pip3
https://github.com/r3nt0n/wiper
用于安全销毁敏感虚拟数据、临时文件和交换内存的工具包。
usage: wiper.py [-h] [-i] [-f path] [-p path] [-r path] [-t] [-u] [-T] [-U] [-s]
optional arguments:
-h, --help show this help message and exit
-i, --interactive interactive mode, the script will guide you
-f path, --free path wipe all free space on given path
-p path, --path path path to dir/file you want to wipe
-m ozr, --method ozr overwrite methods to apply (o: ones, z: zeros, r: random),
you can combine it and choose the order
-r path, --root path set a custom root path if you want to wipe with auto-search modes
an unbooted system (e.g. /media/drive)
-u, --home auto-search mode: locate actual user home directory and wipes it
-U, --home-all auto-search mode: locate all users home directory and wipes it
-s, --swaps auto-search mode: locate swap partitions/pagefiles and wipes it
(be careful: UUID swap partitions also will be wiped)
wiper.py -f /home
wiper.py -p /home/user/Documents -m zozzr
/home/media/
仅使用 zeros 方法在未启动的操作系统(安装在 上)中定位和擦除分页文件:wiper.py -r /home/media -s -m z
方法 | 作用 |
---|---|
bytearray(random.getrandbits(8) for i in range(n)) | 创建一个8字节长的随机字符串。数组里的元素是可以被修改,并且元素的取值范围为 [0, 255]。 |
random.getrandbits(k) | 返回具有 k 个随机比特位的非负 Python 整数。 0~2^k-1范围内的一个随机整数,k表示的是2进制的位数 |
for _ in range( ): | “-”只是一个占位符,可以把它理解为i 或者j 等等任意的字母。 |
#关键代码
with open(path, mode) as dummy_file:
#while size_to_write > 0:
for j in progressBar(range(1,size_to_write), prefix='Progress:', suffix='Complete', length=50):
if m == 'r':
overwritebyte = bytearray(getrandbits(8) for _ in range(1))
dummy_file.write(overwritebyte)
[expression for iter_val in iterable] [expression for iter_val in iterable if cond_expr] #用例1 将 1-10 每个数乘以 2 放入一个列表: >>> li = [] >>> for i in range(1, 11): li.append(i*2) >>> print(li) [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] #用例2 >>> li1 = ['A', 'B', 'C'] >>> li2 = ['1', '2', '3'] >>> li3 = [] >>> for m in li1: for n in li2: li3.append((m,n)) >>> print(li3) [('A', '1'), ('A', '2'), ('A', '3'), ('B', '1'), ('B', '2'), ('B', '3'), ('C', '1'), ('C', '2'), ('C', '3')] >>> li1 = ['A', 'B', 'C'] >>> li2 = ['1', '2', '3'] >>> li3 = [(m,n) for m in li1 for n in li2] >>> print(li3) [('A', '1'), ('A', '2'), ('A', '3'), ('B', '1'), ('B', '2'), ('B', '3'), ('C', '1'), ('C', '2'), ('C', '3')] #用例3 >>> a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> b = set() # 创建一个空集合 >>> for i in a: if i > 5: b.add(i) >>> print(b) {6, 7, 8, 9, 10} >>> a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> b = {i for i in a if i > 5} >>> print(b) {6, 7, 8, 9, 10}
auditd(或 auditd 守护进程)是Linux审计系统中用户空间的一个组件,其负责将审计记录写入磁盘。其可以跟踪到改变该文件的相关进程。在启动过程中**,/etc/audit/audit.rules**中的规则由auditctl读取并加载到内核。另外,还有一个augenrules程序,它读取位于/etc/audit/rules.d/中的规则,并将其编译成audit.rules文件。审计守护程序本身有一些配置选项,管理员可能希望对其进行自定义。它们可以在 auditd.conf 文件中找到。
默认安装完成后,没有规则存在,可以通过如下命令查看:
[root@361way ~]# apt-get install auditd [root@361way ~]# service auditd start //开启auditd服务 [root@361way ~]# service auditd status //查看当前auditd服务状态 [root@361way ~]# auditctl -s //查看当前auditd服务状态 [root@361way ~]# service auditd restart //重启auditd服务 [root@361way ~]# service auditd reload //重启auditd服务 [root@361way ~]# auditctl -l //查看规则 No rules [root@361way ~]# auditctl -s //查看状态 enabled 1 failure 1 pid 87418 rate_limit 0 backlog_limit 8192 lost 0 backlog 0 backlog_wait_time 0
标志 | 含义 [可能的值] | 命令 |
---|---|---|
enabled | 设置启用标志。[0…2] 0=禁用,1=启用,2=启用并锁定配置。请注意,此标志只禁用日志记录系统调用,系统仍会记录其他事件。(请参见以下主题中的 man 3 audit_set_enabled : audit-devel。) | auditctl `-e [0 |
flag | 设置故障标志。[0…2] 0=静默,1=printk,2=恐慌(立即暂停且不将等待中数据同步到磁盘) | auditctl `-f [0 |
pid | 正在运行 auditd 的进程 ID。 | — |
rate_limit | 设置每秒消息数上限。如果该值不为零且每秒消息数超过该上限,将触发故障标志中指定的操作。 | auditctl -r *RATE* |
backlog_limit | 指定允许的未处理审计缓冲区的最大数目。如果所有缓冲区已满,将触发故障标志中指定的操作。 | auditctl -b *BACKLOG* |
lost | 统计当前丢失的审计消息数。 | — |
backlog | 统计当前未处理的审计缓冲区数。 | — |
同样通过auditctl 命令配置rule规则,如下:
[root@CentOS-7-2 /var/log/test]# auditctl -w /etc/passwd -p rwxa
[root@CentOS-7-2 /var/log/test]# auditctl -w /data/ -p wx
[root@CentOS-7-2 /var/log/test]# auditctl -w /etc/passwd -p wa -k passwd_change
设置规则所有对passwd文件的写、属性修改操作都会被记录审计日志
[root@CentOS-7-2 /var/log/test]# auditctl -w /etc/selinux/ -p wa -k selinux_change
设置规则,监控/etc/selinux目录
[root@CentOS-7-2 /var/log/test]# auditctl -w /usr/sbin/fdisk -p x -k disk_partition
//设置规则,监控fdisk程序
auditctl [option] filter,action -S syscall -F condition -k label
用于监视由任何进程或特定用户进行的系统调用,option 参数比较多,具体的可以man auditctl
To see all syscalls made by a specific program:
[root@CentOS-7-2 /var/log/test]# auditctl -a always,exit -S all -F pid=1005
To see files opened by a specific user:
[root@CentOS-7-2 /var/log/test]# auditctl -a always,exit -S openat -F auid=510
To see unsuccessful openat calls:
[root@CentOS-7-2 /var/log/test]# auditctl -a always,exit -S openat -F success=0
项目 | 可选参数 | 说明 |
---|---|---|
filter -F | user,exit,task,exclude | filter 详细说明哪个内核规则匹配过滤器应用在事件中。以下是其中之一的与规则匹配的过滤器: task、exit、user 以及 exclude |
action | always, never | 是否审核事件(always 表示是)(never 表示否) |
syscall -S | all, 2, open 等 | 所有的系统调用都可以在/usr/include/asm/unistd_64.h 文件中找到。许多系统调用都能形成一个规则 |
condition | euid=0, arch=b64 | 详细说明其他选项,进一步修改规则来与以特定架构、组 ID、进程 ID 和其他内容为基础的事件相匹配 |
label | 任意文字 | 标记审核事件并检索日志 |
比如我要监控/var/log/test这个目录,可以这样新增一个监控项,
[root@CentOS-7-2 /var/log/test]# auditctl -w /var/log/test
[root@CentOS-7-2 /var/log/test]# auditctl -l
-w /var/log/test/ -p rwxa
如果需要删除这条规格,可以使用以下命令,
[root@CentOS-7-2 /var/log/test]# auditctl -l 查看定义的规则
-w /var/log/test/ -p rwxa
[root@CentOS-7-2 /var/log/test]# auditctl -D 清空定义的规则和监控
[root@CentOS-7-2 /var/log/test]# auditctl -W /var/log/test
-W: 删除指定path的规则和-w对应,参数都要一样才能删除
[root@CentOS-7-2 /var/log/test]# auditctl -l
No rules
[root@CentOS-7-2 /var/log/test]#
也就是使用小写的w添加规则,大写的W删除规则。
不过上面的操作方法是立即生效的,一旦重启服务后,规则就不存在了。可以将规则写入到配置 /etc/audit/rules.d/audit.rules 中永久生效。类似如下:
[root@svr5 ~]# vim /etc/audit/rules.d/audit.rules
-w /etc/passwd -p wa -k passwd_changes
-w /usr/sbin/fdisk -p x -k partition_disks
-w /dir1/ -p wa
-a exit,always -F dir=/dir2/ -F perm=wa
-a exit,never -F dir=/directory/directory-to-exclude/
-a exit,never -F path=/directory/file-to-exclude
-a exit,always -F dir=/directory/ -F perm=wa
修改之后要重启auditd服务。
使用aureport命令可以生成审计信息的报表,必须以root用户执行。如果执行aureport命令时没有使用任何选项,那么会显示汇总报表。
常用参数 -t,–log 日志时间范围报告 -x,–executable 可执行文件名报告 -r,–response 响应异常报告 -te,–end [结束日期] [结束时间] 报告的结束日期和时间 -l,–login 登录报告 -au 关于身份验证的报表 -c 关于配置更改的报表 -cr 关于加密事件的报表 -e 关于事件的报表 -f 关于文件的报表 -i 解释模式 -if<输入文件名> 使用文件作为输入 -h 关于主机的报表 -l 有关登录的报表 -k 关于key的报表 -m 关于账户修改的报表 -ma 关于强制访问控制(MAC)事件的报表 -p 关于进程的报表 -s 关于系统调用的报表 -tm 关于终端的报表 --node<节点名> 特定节点的事件 --success 在报表中只显示成功的事件 --failed 在报表中只显示失败的事件 -n 关于异常事件的报表 --summary 在报表中为主要对象排序总数 -r 关于异常事件响应的报表 -t 日志时间范围报表 -te<结束日期><结束时间> 报表结束时间 -ts<开始日期><开始时间> 报表起始时间 --tty 关于tty的报表 -u 关于用户的报表 -x 关于可执行文件的报表
[root@CentOS-7-2 /var/log/test]# aureport 生成报简要报告 root@uuu-virtual-machine:~/桌面/xuan_shan# aureport Summary Report ====================== Range of time in logs: 2022年06月18日 18:11:02.237 - 2022年06月19日 11:15:23.525 Selected time for report: 2022年06月18日 18:11:02 - 2022年06月19日 11:15:23.525 Number of changes in configuration: 19 Number of changes to accounts, groups, or roles: 0 Number of logins: 0 Number of failed logins: 0 Number of authentications: 4 Number of failed authentications: 0 Number of users: 2 Number of terminals: 6 Number of host names: 2 Number of executables: 13 Number of commands: 9 Number of files: 42 Number of AVC's: 0 Number of MAC events: 0 Number of failed syscalls: 8 Number of anomaly events: 0 Number of responses to anomaly events: 0 Number of crypto events: 0 Number of integrity events: 0 Number of virt events: 0 Number of keys: 2 Number of process IDs: 28 Number of events: 272 [root@VM-0-15-centos ~]# aureport -t Log Time Range Report ===================== /var/log/audit/audit.log.2: 02/14/2022 02:47:30.301 - 02/14/2022 09:09:13.506 /var/log/audit/audit.log.1: 02/14/2022 09:09:13.506 - 02/14/2022 13:00:10.180 /var/log/audit/audit.log: 02/14/2022 13:00:10.180 - 02/14/2022 15:35:57.426 [root@VM-0-15-centos ~]# aureport -l | head -n 10 Login Report ============================================ # date time auid host term exe success event ============================================ 1. 02/13/2022 15:21:55 root 112.85.42.124 ssh /usr/sbin/sshd no 8478563 2. 02/13/2022 15:22:01 root 112.85.42.124 ssh /usr/sbin/sshd no 8478580 3. 02/13/2022 15:22:35 root 87.107.87.82 ssh /usr/sbin/sshd no 8478593
创建失败事件的摘要报告
如果您要将单纯的 aureport
命令所提供的总体统计细分为失败事件的统计,请使用 aureport
--failed
:
tux > sudo aureport --failed Failed Summary Report ====================== Range of time in logs: 03/02/09 14:13:38.225 - 17/02/09 14:57:35.183 Selected time for report: 03/02/09 14:13:38 - 17/02/09 14:57:35.183 Number of changes in configuration: 0 Number of changes to accounts, groups, or roles: 0 Number of logins: 0 Number of failed logins: 13 Number of authentications: 0 Number of failed authentications: 574 Number of users: 1 Number of terminals: 5 Number of host names: 4 Number of executables: 11 Number of files: 77 Number of AVC's: 0 Number of MAC events: 0 Number of failed syscalls: 994 Number of anomaly events: 0 Number of responses to anomaly events: 0 Number of crypto events: 0 Number of keys: 2 Number of process IDs: 708 Number of events: 1583
创建成功事件的摘要报告
如果您要将单纯的 aureport
命令所提供的总体统计细分为成功事件的统计,请使用 aureport
--success
:
tux > sudo aureport --success Success Summary Report ====================== Range of time in logs: 03/02/09 14:13:38.225 - 17/02/09 15:00:01.535 Selected time for report: 03/02/09 14:13:38 - 17/02/09 15:00:01.535 Number of changes in configuration: 13 Number of changes to accounts, groups, or roles: 0 Number of logins: 6 Number of failed logins: 0 Number of authentications: 7 Number of failed authentications: 0 Number of users: 1 Number of terminals: 7 Number of host names: 3 Number of executables: 16 Number of files: 215 Number of AVC's: 0 Number of MAC events: 0 Number of failed syscalls: 0 Number of anomaly events: 0 Number of responses to anomaly events: 0 Number of crypto events: 0 Number of keys: 2 Number of process IDs: 558 Number of events: 3739
创建摘要报告
除了专用摘要报告(主要事件摘要,以及失败和成功事件摘要),还可以将 --summary
选项与大多数其他选项结合使用,以仅创建特定关注方面的摘要报告。不过,并非所有报告都支持此选项。下面的示例创建了用户登录事件的摘要报告:
tux > sudo aureport -u -i --summary
User Summary Report
===========================
total auid
===========================
5640 root
13 tux
3 wilber
要了解审计记录的事件,请使用 aureport
-e
命令。此命令会生成所有事件的带编号列表,其中包含日期、时间、事件编号、事件类型和审计 ID。
tux > sudo aureport -e -ts 14:00 -te 14:21 Event Report =================================== # date time event type auid success =================================== 1. 17/02/09 14:20:27 7462 DAEMON_START 0 yes 2. 17/02/09 14:20:27 7715 CONFIG_CHANGE 0 yes 3. 17/02/09 14:20:57 7716 USER_END 0 yes 4. 17/02/09 14:20:57 7717 CRED_DISP 0 yes 5. 17/02/09 14:21:09 7718 USER_LOGIN -1 no 6. 17/02/09 14:21:15 7719 USER_AUTH -1 yes 7. 17/02/09 14:21:15 7720 USER_ACCT -1 yes 8. 17/02/09 14:21:15 7721 CRED_ACQ -1 yes 9. 17/02/09 14:21:15 7722 LOGIN 0 yes 10. 17/02/09 14:21:15 7723 USER_START 0 yes 11. 17/02/09 14:21:15 7724 USER_LOGIN 0 yes 12. 17/02/09 14:21:15 7725 CRED_REFR 0 yes
要从进程的角度分析日志,请使用 aureport
-p
命令。此命令会生成所有进程事件的带编号列表,其中包含日期、时间、进程 ID、可执行文件的名称、系统调用、审计 ID 和事件编号。
aureport -p
Process ID Report
======================================
# date time pid exe syscall auid event
======================================
1. 13/02/09 15:30:01 32742 /usr/sbin/cron 0 0 35
2. 13/02/09 15:30:01 32742 /usr/sbin/cron 0 0 36
3. 13/02/09 15:38:34 32734 /usr/lib/gdm/gdm-session-worker 0 -1 37
要从系统调用的角度分析审计日志,请使用 aureport
-s
命令。此命令会生成所有系统调用事件的带编号列表,其中包含日期、时间、系统调用的编号、进程 ID、使用此调用的命令的名称、审计 ID 和事件编号。
tux > sudo aureport -s
Syscall Report
=======================================
# date time syscall pid comm auid event
=======================================
1. 16/02/09 17:45:01 2 20343 cron -1 2279
2. 16/02/09 17:45:02 83 20350 mktemp 0 2284
3. 16/02/09 17:45:02 83 20351 mkdir 0 2285
要从可执行文件的角度分析审计日志,请使用 aureport
-x
命令。此命令会生成所有可执行文件事件的带编号列表,其中包含日期、时间、可执行文件的名称、运行可执行文件的终端、执行可执行文件的主机、审计 ID 和事件编号。
aureport -x
Executable Report
====================================
# date time exe term host auid event
====================================
1. 13/02/09 15:08:26 /usr/sbin/sshd sshd 192.168.2.100 -1 12
2. 13/02/09 15:08:28 /usr/lib/gdm/gdm-session-worker :0 ? -1 13
3. 13/02/09 15:08:28 /usr/sbin/sshd ssh 192.168.2.100 -1 14
要基于审计日志生成侧重于文件访问的报告,请使用 aureport
-f
命令。此命令会生成所有文件相关事件的带编号列表,其中包含日期、时间、所访问的文件的名称、访问文件的系统调用的编号、命令的成功或失败结果、访问文件的可执行文件、审计 ID 和事件编号。
tux > sudo aureport -f
File Report
===============================================
# date time file syscall success exe auid event
===============================================
1. 16/02/09 17:45:01 /etc/shadow 2 yes /usr/sbin/cron -1 2279
2. 16/02/09 17:45:02 /tmp/ 83 yes /bin/mktemp 0 2284
3. 16/02/09 17:45:02 /var 83 no /bin/mkdir 0 2285
要基于审计日志生成用于说明哪些用户正在您的系统上运行哪些可执行文件的报告,请使用 aureport
-u
命令。此命令会生成所有用户相关事件的带编号列表,其中包含日期、时间、审计 ID、使用的终端、主机、可执行文件的名称和事件 ID。
aureport -u
User ID Report
====================================
# date time auid term host exe event
====================================
1. 13/02/09 15:08:26 -1 sshd 192.168.2.100 /usr/sbin/sshd 12
2. 13/02/09 15:08:28 -1 :0 ? /usr/lib/gdm/gdm-session-worker 13
3. 14/02/09 08:25:39 -1 ssh 192.168.2.101 /usr/sbin/sshd 14
要创建重点统计登录您计算机的尝试的报告,请运行 aureport
-l
命令。此命令会生成所有登录相关事件的带编号列表,其中包含日期、时间、审计 ID、使用的主机和终端、可执行文件的名称、尝试的成功或失败结果,以及事件 ID。
tux > sudo aureport -l -i
Login Report
============================================
# date time auid host term exe success event
============================================
1. 13/02/09 15:08:31 tux: 192.168.2.100 sshd /usr/sbin/sshd no 19
2. 16/02/09 12:39:05 root: 192.168.2.101 sshd /usr/sbin/sshd no 2108
3. 17/02/09 15:29:07 geeko: ? tty3 /bin/login yes 7809
将报告范围限制在特定的时间范围
要分析特定时间范围的日志(例如,仅分析 2009 年 2 月 16 日工作时间的日志),请先运行 aureport
-t
来确定这些数据是否包含在当前的 audit.log
中,或者日志是否已进行了轮换:
aureport -t
Log Time Range Report
=====================
/var/log/audit/audit.log: 03/02/09 14:13:38.225 - 17/02/09 15:30:01.636
当前的 audit.log
包含所有所需的数据。如果情况并非如此,请使用 -if
选项将 aureport
命令指向包含所需数据的日志文件。
然后指定所需时间范围的开始与结束日期和时间,并将其与所需的报告选项结合使用。本示例重点统计登录尝试:
tux > sudo aureport -ts 02/16/09 8:00 -te 02/16/09 18:00 -l
Login Report
============================================
# date time auid host term exe success event
============================================
1. 16/02/09 12:39:05 root: 192.168.2.100 sshd /usr/sbin/sshd no 2108
2. 16/02/09 12:39:12 0 192.168.2.100 /dev/pts/1 /usr/sbin/sshd yes 2114
3. 16/02/09 13:09:28 root: 192.168.2.100 sshd /usr/sbin/sshd no 2131
4. 16/02/09 13:09:32 root: 192.168.2.100 sshd /usr/sbin/sshd no 2133
5. 16/02/09 13:09:37 0 192.168.2.100 /dev/pts/2 /usr/sbin/sshd yes 2139
开始日期和时间是使用 -ts
选项指定的。时戳等于或晚于给定开始时间的任何事件都会显示在报告中。如果省略日期,aureport
将假设您指的是今天。如果省略时间,它会假设开始时间是指定日期的午夜。
使用 -te
选项指定结束日期和时间。时戳等于或早于给定事件时间的任何事件都会显示在报告中。如果省略日期,aureport
将假设您指的是今天。如果省略时间,它会假设结束时间是现在。请使用与 -ts
相同的日期和时间格式。
aureport
工具可帮助您创建有关系统上发生的情况的总体摘要,但如果您要了解特定事件的细节,可以使用 ausearch
工具。
默认审计日志存放的位置为**/var/log/audit/audit.log**,可以使用ausearch这个配套命令来查找相关记录,命令如下,必须以root用户身份执行ausearch命令。
常用参数: -f,–file <文件名> 根据文件名搜索 -c,–comm 根据命令行名称搜索 -ui,–uid <用户id> 根据用户id搜索 -p,–pid <进程id> 根据进程id搜索 -k,–key 根据key字段搜索 -te,–end [结束日期] [结束时间] 搜索的结束日期和时间 -ts,–start [开始日期] [开始时间] 开始数据和搜索时间 ausearch -a 5207 搜寻当前audit服务中event ID等于5207的log ausearch –k xx 按指定别名查看审计内容 ausearch –i 格式化输出 ausearch –f 根据指定的审计目录或文件查看审计内容 ausearch -m #按消息类型查找 ausearch -ul #按登陆ID查找 ausearch -ua #按uid和euid查找 ausearch -ui #按uid查找 ausearch -ue #按euid查找 ausearch -ga #按gid和egid查找 ausearch -gi #按gid查找 ausearch -ge #按egid查找 ausearch -c #按cmd查找 ausearch -x #按exe查找 ausearch -sc #按syscall查找 ausearch -p #按pid查找 ausearch -sv #按syscall的返回值查找(yes/no) ausearch -f #按文件名查找 ausearch -tm #按连接终端查找(term/ssh/tty) ausearch -hn #按主机名查找 ausearch -k #按特定的key值查找 ausearch -w #按在audit rule设定的字符串查找
[root@CentOS-7-2 /var/log/test]# ausearch -i -k auth_key 查找key字段搜索审计日志
[root@CentOS-7-2 /var/log/test]# ausearch -f file_name 根据文件名搜索审计日志
[root@CentOS-7-2 /var/log/test]#
[root@361way data]# ausearch -f /data
----
time->Thu Jan 12 20:24:51 2017
type=PATH msg=audit(1484223891.733:40): item=1 name="testfile" inode=668372 dev=ca:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=CREATE
type=PATH msg=audit(1484223891.733:40): item=0 name="/data" inode=655797 dev=ca:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT
type=CWD msg=audit(1484223891.733:40): cwd="/data"
type=SYSCALL msg=audit(1484223891.733:40): arch=c000003e syscall=2 success=yes exit=3 a0=7fff796768aa a1=941 a2=1b6 a3=3596b8f14c items=2 ppid=29386 pid=29408 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=18292 comm="touch" exe="/bin/touch" key=(null)
----
time->Thu Jan 12 20:24:59 2017
type=PATH msg=audit(1484223899.143:41): item=1 name="testfile" inode=668372 dev=ca:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE
type=PATH msg=audit(1484223899.143:41): item=0 name="/data" inode=655797 dev=ca:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT
type=CWD msg=audit(1484223899.143:41): cwd="/data"
type=SYSCALL msg=audit(1484223899.143:41): arch=c000003e syscall=263 success=yes exit=0 a0=ffffffffffffff9c a1=6c40c0 a2=0 a3=20 items=2 ppid=29386 pid=29409 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=18292 comm="rm" exe="/bin/rm" key=(null)
将数字结果转换为文本
某些信息(例如用户 ID)将以数字形式列显。要将这些信息转换为直观易懂的文本格式,请在 ausearch
命令中添加 -i
选项。
按审计事件 ID 搜索
如果您先前运行了审计报告或执行了 autrace
,则应分析日志中特定事件的追踪。大多数报告类型都会在其输出中包含审计事件 ID。审计事件 ID 是审计消息 ID 的第二部分,后者由 Unix 纪元时戳和审计事件 ID 构成(以冒号分隔)。所记录的来自一个应用程序系统调用的所有事件都具有相同的事件 ID。在 ausearch
中使用此事件 ID 可以从日志中检索此事件的追踪。
使用如下所示的命令:
tux > sudo ausearch -a 5207
----
time->Tue Feb 17 13:43:58 2009
type=PATH msg=audit(1234874638.599:5207): item=0 name="/var/log/audit/audit.log" inode=1219041 dev=08:06 mode=0100644 ouid=0 ogid=0 rdev=00:00
type=CWD msg=audit(1234874638.599:5207): cwd="/root"
type=SYSCALL msg=audit(1234874638.599:5207): arch=c000003e syscall=2 success=yes exit=4 a0=62fb60 a1=0 a2=31 a3=0 items=1 ppid=25400 pid=25616 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=1164 comm="less" exe="/usr/bin/less" key="doc_log"
ausearch
-a
命令会抓取并显示日志中与所提供审计事件 ID 相关的所有记录。此选项可与任何其他选项结合使用。
按消息类型搜索
要搜索特定消息类型的审计记录,请使用 ausearch
-m *MESSAGE_TYPE*
命令。有效消息类型的示例包括 PATH
、SYSCALL
和 USER_LOGIN
。运行不带消息类型的 ausearch
-m
会显示所有消息类型的列表。
按登录 ID 搜索
要查看与特定登录用户 ID 关联的记录,请使用 ausearch
-ul
命令。此命令显示与指定的用户登录 ID 相关的所有记录,前提是该用户过去能够成功登录。
按用户 ID 搜索
使用 ausearch
-ua
查看与任何用户 ID(用户 ID 和有效用户 ID)相关的记录。使用 ausearch
-ui *UID*
查看与特定用户 ID 相关的报告。要搜索与特定有效用户 ID 相关的记录,请使用 ausearch
-ue *EUID*
。搜索用户 ID 是指搜索创建进程的用户的 ID。搜索有效用户 ID 是指搜索该用户 ID 以及运行此进程所需的特权。
按组 ID 搜索
使用 ausearch
-ga
命令查看与任何组 ID(组 ID 和有效组 ID)相关的记录。使用 ausearch
-gi *GID*
查看与特定用户 ID 相关的报告。要搜索与特定有效组 ID 相关的记录,请使用 ausearch
-ge *EGID*
。
按命令行名称搜索
使用 ausearch
-c *COMM_NAME*
命令查看与特定命令相关的记录,例如,使用 ausearch
-c less
可查看与 less
命令相关的所有记录。
按可执行文件名搜索
使用 ausearch
-x *EXE*
命令查看与特定可执行文件相关的记录,例如,使用 ausearch
-x /usr/bin/less
可查看与 /usr/bin/less
可执行文件相关的所有记录。
按系统调用名称搜索
使用 ausearch
-sc *SYSCALL*
命令查看与特定系统调用相关的记录,例如,使用 ausearch -sc open
可查看与 open
系统调用相关的所有记录。
按进程 ID 搜索
使用 ausearch
-p *PID*
命令查看与特定进程 ID 相关的记录,例如,使用 ausearch
-p 13368
可查看与此进程 ID 相关的所有记录。
按事件或系统调用成功值搜索
使用 ausearch
-sv *SUCCESS_VALUE*
查看包含特定系统调用成功值的记录,例如,使用 ausearch
-sv yes
可查看所有成功的系统调用。
按文件名搜索
使用 ausearch
-f *FILE_NAME*
查看包含特定文件名的记录,例如,使用 ausearch
-f /foo/bar
可查看与 /foo/bar
文件相关的所有记录。您也可以仅使用文件名,但不能使用相对路径。
按终端搜索
使用 ausearch
-tm *TERM*
查看仅与特定终端相关的记录,例如,使用 ausearch
-tm ssh
可查看与 SSH 终端上的事件相关的所有记录,使用 ausearch
-tm tty
可查看与该控制台相关的所有事件。
按主机名搜索
使用 ausearch
-hn *HOSTNAME*
查看与特定远程主机名相关的记录,例如,使用 ausearch
-hn jupiter.example.com
可查看与该主机名相关的所有记录。可以使用主机名、完全限定的域名或数字格式的网络地址。
按键字段搜索
查看包含审计规则集中指派的特定键(用于识别特定类型的事件)的记录。相关命令为 ausearch
-k *KEY_FIELD*
。例如,使用 ausearch
-k CFG_etc
可显示包含 CFG_etc
键的所有记录。
按字词搜索
查看包含审计规则集中指派的特定字符串(用于识别特定类型的事件)的记录。整个字符串将与文件名、主机名和终端进行匹配。相关命令为 ausearch
-w *WORD*
。
将搜索范围限制在特定的时间范围
使用 -ts
和 -te
可将搜索范围限制在特定的时间范围。-ts
选项用于指定开始日期和时间,-te
选项用于指定结束日期和时间。这些选项可与上面所述的任何选项结合使用。这些选项的用法与在 aureport
中的用法类似。
除了使用设置的规则监视系统以外,还可以使用 autrace 命令对各个进程执行专门的审计。autrace 的工作方式类似于 strace,但它收集的信息略有不同。autrace 的输出将写入到 /var/log/audit/audit.log,看上去与标准审计日志项没有任何不同。
对进程执行 autrace 时,需从队列中清除所有审计规则,以免这些规则与 autrace 本身添加的规则相冲突。使用 auditctl -D 命令删除审计规则。这会停止所有一般审计。
这里我们以执行whoami为例。
[root@VM-0-15-centos ~]# auditctl -D
No rules
[root@VM-0-15-centos ~]# autrace /usr/bin/whoami
Waiting to execute: /usr/bin/whoami
root
Cleaning up...
Trace complete. You can locate the records with 'ausearch -i -p 5280'
使用 autrace 需跟踪的可执行文件的完整路径。完成跟踪后,autrace 会提供跟踪的事件 ID,因此可以使用 ausearch 分析整个数据追踪。要将审计系统恢复为重新使用审计规则集,请使用 systemctl restart auditd 重启动审计守护程序。
使用ausearch查询审计结果。
[root@VM-0-15-centos ~]# ausearch -i -p 5280 -ts recent | head -n 3
---
type=PROCTITLE msg=audit(02/14/2022 15:47:25.880:8603375) : proctitle=autrace /usr/bin/whoami
type=SYSCALL msg=audit(02/14/2022 15:47:25.880:8603375) : arch=x86_64 syscall=mmap success=yes exit=(null)(Unknown error 2027839488) a0=0x0 a1=0x1000 a2=PROT_READ|PROT_WRITE a3=MAP_PRIVATE|MAP_ANONYMOUS items=0 ppid=5278 pid=5280 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=51951 comm=autrace exe=/usr/sbin/autrace key=(null)
如果想更直观的展示进程的调用链可以结合aureport使用。
root@uuu-virtual-machine:~/桌面/xuan_shan# ausearch -ts recent -p 90652 --raw | aureport --file --summary File Summary Report =========================== total file =========================== 1 /root/桌面/xuan_shan/wiper.py 1 /usr/bin/env 1 /lib64/ld-linux-x86-64.so.2 1 /etc/ld.so.cache 1 /lib/x86_64-linux-gnu/libc.so.6 1 /usr/lib/locale/locale-archive 1 /usr/local/sbin/python3\015 1 /usr/local/bin/python3\015 1 /usr/sbin/python3\015 1 /usr/bin/python3\015 1 /sbin/python3\015 1 /bin/python3\015 1 /usr/games/python3\015 1 /usr/local/games/python3\015 1 /snap/bin/python3\015 1 /usr/share/locale/locale.alias 1 /usr/share/locale/zh_CN/LC_MESSAGES/coreutils.mo 1 /usr/share/locale/zh/LC_MESSAGES/coreutils.mo 1 /usr/share/locale-langpack/zh_CN/LC_MESSAGES/coreutils.mo 1 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache 1 /usr/share/locale/zh_CN/LC_MESSAGES/libc.mo 1 /usr/share/locale/zh/LC_MESSAGES/libc.mo 1 /usr/share/locale-langpack/zh_CN/LC_MESSAGES/libc.mo
展示了执行whoami命令过程中所有设计到文件和路径信息。
审计系统还允许外部应用程序实时访问和使用 auditd 守护程序。此功能由审计调度程序提供。
audispd 是用于控制审计调度程序的守护程序。它通常由 auditd 启动。audispd 会提取审计事件并将其分发到想要对其进行实时分析的程序。auditd 的配置储存在 /etc/audisp/audispd.conf 中。
将linux audit产生的审计信息传入到其他程序中(利用audispd)
[root@VM-0-15-centos ~]# cat /etc/audisp/audispd.conf
active = yes # 是否激活这个配置文件的配置
direction = out # 只能是out
path = /yuan/test.sh # 程序位置,会作为子进程运行
type = always
args = hello # 会传参给子进程
format = string
[root@svr5 ~]# tailf /var/log/audit/audit.log type=SYSCALL msg=audit(1517557590.644:229228): arch=c000003e syscall=2 success=yes exit=3 a0=7fff71721839 a1=0 a2=1fffffffffff0000 a3=7fff717204c0 items=1 ppid=7654 pid=7808 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts2 ses=3 comm="cat" exe="/usr/bin/cat" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="sshd_config" .. .. #内容分析 # type为类型 # msg为(time_stamp:ID),时间是date +%s(1970-1-1至今的秒数) # arch=c000003e,代表x86_64(16进制) # success=yes/no,事件是否成功 # a0-a3是程序调用时前4个参数,16进制编码了 # ppid父进程ID,如bash,pid进程ID,如cat命令 # auid是审核用户的id,su - test, 依然可以追踪su前的账户 # uid,gid用户与组 # tty:从哪个终端执行的命令 # comm="cat" 用户在命令行执行的指令 # exe="/bin/cat" 实际程序的路径 # key="sshd_config" 管理员定义的策略关键字key # type=CWD 用来记录当前工作目录 # cwd="/home/username" # type=PATH # ouid(owner's user id) 对象所有者id # guid(owner's groupid) 对象所有者id [root@svr5 ~]# ausearch -k sshd_config -i //根据key搜索日志,-i选项表示以交互式方式操作
在我的部分机器中,为了直接给其他用户root权限。例如useradd 新增一个普通用户,采用修改/etc/passwd 文件的方式将其uid改为了0。此时一个普通用户就变成了root用户,但是该用户的gid=1000并没有改变。
案例背景
审记linux系统指定用户的文件访问。查询系统中uid为0的用户。
[root@VM-0-15-centos ~]# awk -F: '$3==0{print $0}' /etc/passwd
root:x:0:0:root:/root:/bin/bash
zgao:x:0:1000::/home/zgao:/bin/bash
这种特殊情况下怎么监控该用户访问过哪些文件呢?
因为uid改变了,直接监控uid=0还会监控到root的文件访问,这里gid未改变可使用gid作为过滤项查找。
auditctl -a exit,always -F arch=x86_64 -S open -F gid=1000
[root@VM-0-15-centos ~]# auditctl -a exit,always -F arch=x86_64 -S open -F gid=1000 -k user1000 [root@VM-0-15-centos ~]# auditctl -l -a always,exit -F arch=b64 -S open -F gid=1000 -F key=user1000 [root@VM-0-15-centos ~]# su - zgao Last login: Mon Feb 14 16:38:32 HKT 2022 from 203.205.141.113 on pts/1 [root@VM-0-15-centos ~]# ausearch -k user1000 --raw | aureport --summary --file File Summary Report =========================== total file //由于记录的文件访问过多,只展示部分 =========================== 30 /dev/ 30 /dev/null 25 /etc/ld.so.cache 23 /etc/ld.so.preload ... 8 /etc/passwd ... 2 /etc/login.defs 2 /dev/tty 2 /home/zgao/.cache/abrt/ 2 /home/zgao/.cache/abrt/lastnotification.0QVUzqxw ... 1 /etc/profile.d/vim.sh 1 /home/zgao/.bash_profile 1 /home/zgao/.bashrc 1 /etc/bashrc 1 /etc/inputrc
这里就监控了 su - zgao 用户的情况下,监控用户文件的访问情况。对于某些特殊情况的下系统审计能起到很好的效果。
root@uuu-virtual-machine:~/桌面/xuan_shan# auditctl -w /root/桌面/xuan_shan/Key/README.md -p rwxa -k key
root@uuu-virtual-machine:~/桌面/xuan_shan# auditctl -l
-w /root/桌面/xuan_shan/Key/README.md -p rwxa -k key
root@uuu-virtual-machine:~/桌面/xuan_shan# ausearch -k key
----
time->Sun Jun 19 15:02:35 2022
type=CONFIG_CHANGE msg=audit(1655622155.086:466): auid=0 ses=5 op=add_rule key="key"
ses=5
`记录了分析过程被调用的会话的会话 ID。
wipe擦除
[?] Choose an option (help to show again) [0-9]: 2 [?] Enter the path you want to wipe: ./Key [+] Files found: 1 [+] Overwriting Key/README.md (5606 bytes) [-] Starting one-pass random wipe... Progress: |██████████████████████████████████████████████████| 100.0% Complete [-] Key/README.md was succesfully wiped [+] Files wiped: 1 [+] Empty tree removed (path given was a dir) [?] Choose an option (help to show again) [0-9]: root@uuu-virtual-machine:~/桌面/xuan_shan# ausearch -k key ---- time->Sun Jun 19 15:30:56 2022 type=PROCTITLE msg=audit(1655623856.151:503): proctitle=707974686F6E330077697065722E7079002D69 type=PATH msg=audit(1655623856.151:503): item=0 name="./Data" inode=1442936 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=CWD msg=audit(1655623856.151:503): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E type=SYSCALL msg=audit(1655623856.151:503): arch=c000003e syscall=257 openat 打开文件 success=yes exit=3 a0=ffffff9c a1=7fbf4b024380 a2=90800 a3=0 items=1 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key" ---- time->Sun Jun 19 15:30:56 2022 type=PROCTITLE msg=audit(1655623856.151:504): proctitle=707974686F6E330077697065722E7079002D69 type=PATH msg=audit(1655623856.151:504): item=1 name="Data/README.md" inode=1442785 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=PATH msg=audit(1655623856.151:504): item=0 name="Data/" inode=1442936 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=CWD msg=audit(1655623856.151:504): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E type=SYSCALL msg=audit(1655623856.151:504): arch=c000003e syscall=257 openat 打开文件 success=yes exit=3 a0=ffffff9c a1=7fbf4ab9f320 a2=80241 a3=1b6 items=2 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key" ---- time->Sun Jun 19 15:30:56 2022 type=PROCTITLE msg=audit(1655623856.307:505): proctitle=707974686F6E330077697065722E7079002D69 type=PATH msg=audit(1655623856.307:505): item=1 name="Data/README.md" inode=1442785 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=PATH msg=audit(1655623856.307:505): item=0 name="Data/" inode=1442936 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=CWD msg=audit(1655623856.307:505): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E type=SYSCALL msg=audit(1655623856.307:505): arch=c000003e syscall=87 unlink 删除文件路径 success=yes exit=0 a0=7fbf4ab9f350 a1=0 a2=5617fa773210 a3=7ffd1700c2a7 items=2 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key" ---- time->Sun Jun 19 15:30:56 2022 type=PROCTITLE msg=audit(1655623856.307:506): proctitle=707974686F6E330077697065722E7079002D69 type=PATH msg=audit(1655623856.307:506): item=0 name="./Data" inode=1442936 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=CWD msg=audit(1655623856.307:506): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E type=SYSCALL msg=audit(1655623856.307:506): arch=c000003e syscall=257 openat 打开文件success=yes exit=3 a0=ffffff9c a1=7fbf4b024380 a2=80000 a3=0 items=1 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key" ---- time->Sun Jun 19 15:30:56 2022 type=PROCTITLE msg=audit(1655623856.307:507): proctitle=707974686F6E330077697065722E7079002D69 type=PATH msg=audit(1655623856.307:507): item=1 name="./Data" inode=1442936 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=DELETE cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=PATH msg=audit(1655623856.307:507): item=0 name="./" inode=1442234 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=CWD msg=audit(1655623856.307:507): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E type=SYSCALL msg=audit(1655623856.307:507): arch=c000003e syscall=84 rmdir 删除目录路径。它仅在目录为空时才起作用success=yes exit=0 a0=7fbf4b024380 a1=0 a2=5617fa773210 a3=7ffd1700c2a7 items=2 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key" ---- time->Sun Jun 19 15:30:56 2022 type=CONFIG_CHANGE msg=audit(1655623856.307:508): op=remove_rule dir=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E2F44617461 key="key" list=4 res=1 root@uuu-virtual-machine:~/桌面/xuan_shan#
root@uuu-virtual-machine:~/桌面/xuan_shan# aureport -s 系统调用 日期、时间、系统调用的编号、进程 ID、使用此调用的命令的名称、审计 ID 和事件编号 2022年06月19日 15:30:56 257 90302 python3 0 503 2022年06月19日 15:30:56 257 90302 python3 0 504 2022年06月19日 15:30:56 87 90302 python3 0 505 2022年06月19日 15:30:56 257 90302 python3 0 506 2022年06月19日 15:30:56 84 90302 python3 0 507 root@uuu-virtual-machine:~/桌面/xuan_shan# aureport -f 文件相关 日期、时间、所访问的文件的名称、访问文件的系统调用的编号、命令的成功或失败结果、访问文件的可执行文件、审计 ID 和事件编号。 128. 2022年06月19日 15:30:56 /root/桌面/xuan_shan/./Data 257 yes /usr/local/python3.8.3/bin/python3.8 0 503 129. 2022年06月19日 15:30:56 Data/ 257 yes /usr/local/python3.8.3/bin/python3.8 0 504 130. 2022年06月19日 15:30:56 Data/ 87 yes /usr/local/python3.8.3/bin/python3.8 0 505 131. 2022年06月19日 15:30:56 /root/桌面/xuan_shan/./Data 257 yes /usr/local/python3.8.3/bin/python3.8 0 506 132. 2022年06月19日 15:30:56 /root/桌面/xuan_shan/./ 84 yes /usr/local/python3.8.3/bin/python3.8 0 507 root@uuu-virtual-machine:~/桌面/xuan_shan# aureport -x 可执行文件时间创建 日期、时间、可执行文件的名称、运行可执行文件的终端、执行可执行文件的主机、审计 ID 和事件编号。 377. 2022年06月19日 15:30:56 /usr/local/python3.8.3/bin/python3.8 pts1 ? 0 503 378. 2022年06月19日 15:30:56 /usr/local/python3.8.3/bin/python3.8 pts1 ? 0 504 379. 2022年06月19日 15:30:56 /usr/local/python3.8.3/bin/python3.8 pts1 ? 0 505 380. 2022年06月19日 15:30:56 /usr/local/python3.8.3/bin/python3.8 pts1 ? 0 506 381. 2022年06月19日 15:30:56 /usr/local/python3.8.3/bin/python3.8 pts1 ? 0 507 root@uuu-virtual-machine:~/桌面/xuan_shan# aureport -p 进程事件 日期、时间、进程 ID、可执行文件的名称、系统调用、审计 ID 和事件编号。 389. 2022年06月19日 15:30:56 90302 /usr/local/python3.8.3/bin/python3.8 257 0 503 390. 2022年06月19日 15:30:56 90302 /usr/local/python3.8.3/bin/python3.8 257 0 504 391. 2022年06月19日 15:30:56 90302 /usr/local/python3.8.3/bin/python3.8 87 0 505 392. 2022年06月19日 15:30:56 90302 /usr/local/python3.8.3/bin/python3.8 257 0 506 393. 2022年06月19日 15:30:56 90302 /usr/local/python3.8.3/bin/python3.8 84 0 507 root@uuu-virtual-machine:~/桌面/xuan_shan# aureport -e -ts 15:29 -te 15:31 Event Report =================================== # date time event type auid success =================================== 1. 2022年06月19日 15:30:56 503 SYSCALL 0 yes 2. 2022年06月19日 15:30:56 504 SYSCALL 0 yes 3. 2022年06月19日 15:30:56 505 SYSCALL 0 yes 4. 2022年06月19日 15:30:56 506 SYSCALL 0 yes 5. 2022年06月19日 15:30:56 507 SYSCALL 0 yes 6. 2022年06月19日 15:30:56 508 CONFIG_CHANGE -2 yes
---- time->Sun Jun 19 15:30:56 2022 type=PROCTITLE msg=audit(1655623856.307:505): proctitle=707974686F6E330077697065722E7079002D69 type=PATH msg=audit(1655623856.307:505): item=1 name="Data/README.md" inode=1442785 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=PATH msg=audit(1655623856.307:505): item=0 name="Data/" inode=1442936 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 type=CWD msg=audit(1655623856.307:505): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E type=SYSCALL msg=audit(1655623856.307:505): arch=c000003e syscall=87 success=yes exit=0 a0=7fbf4ab9f350 a1=0 a2=5617fa773210 a3=7ffd1700c2a7 items=2 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key" ---- root@uuu-virtual-machine:~/桌面/xuan_shan# ausearch -k key -i ---- type=PROCTITLE msg=audit(2022年06月19日 15:30:56.307:505) : proctitle=python3 wiper.py -i type=PATH msg=audit(2022年06月19日 15:30:56.307:505) : item=1 name=Data/README.md inode=1442785 dev=08:01 mode=file,644 ouid=root ogid=root rdev=00:00 nametype=DELETE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=PATH msg=audit(2022年06月19日 15:30:56.307:505) : item=0 name=Data/ inode=1442936 dev=08:01 mode=dir,755 ouid=root ogid=root rdev=00:00 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=CWD msg=audit(2022年06月19日 15:30:56.307:505) : cwd=/root/桌面/xuan_shan type=SYSCALL msg=audit(2022年06月19日 15:30:56.307:505) : arch=x86_64 syscall=unlink success=yes exit=0 a0=0x7fbf4ab9f350 a1=0x0 a2=0x5617fa773210 a3=0x7ffd1700c2a7 items=2 ppid=90290 pid=90302 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=5 comm=python3 exe=/usr/local/python3.8.3/bin/python3.8 key=key ----
以上事件由四个记录组成,它们共享相同的时间戳和序列号。始终以 type=
关键字开头。
type=PROCTITLE msg=audit(1655623856.307:505): proctitle=707974686F6E330077697065722E7079002D69
type=PROCTITLE msg=audit(2022年06月19日 15:30:56.307:505) : proctitle=python3 wiper.py -i
type=PROCTITLE
type
字段包含记录的类型。在本例中,PROCTITLE
值指定此记录提供触发此审计事件的完整命令行,该事件由对内核的系统调用触发。
proctitle=707974686F6E330077697065722E7079002D69
proctitle
字段记录了用于调用分析过程的命令的完整命令行。该字段采用十六进制表示法编码,不允许用户影响 Audit 日志解析器。文本解码到触发此审计事件的命令。使用 ausearch 命令搜索 Audit 记录时,请使用 -i 或
--interpret
选项自动将十六进制值转换为其人类可读的等效值。707974686F6E330077697065722E7079002D6
值解释为 python3 wiper.py -i
。
type=PATH msg=audit(1655623856.307:505): item=1 name="Data/README.md" inode=1442785 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=PATH msg=audit(2022年06月19日 15:30:56.307:505) : item=1 name=Data/README.md inode=1442785 dev=08:01 mode=file,644 ouid=root ogid=root rdev=00:00 nametype=DELETE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0
type=PATH
在第三条记录中,type
字段值为 PATH
。Audit 事件包含作为参数传递给系统调用的每个路径的 PATH
-type 记录。在这个审计事件中,只有一个路径`(Data/README.md)作为参数。
msg=audit(1655623856.307:505):
msg
字段拥有与第一和第二条记录中的值相同的时间戳和 ID 值。
item=1
item
字段表示在 SYSCALL
类型记录所引用的项目总数中,当前记录是哪个项目。这个数字基于零;值 1
表示它是第二项。
name="/Data/README.md"
name
字段记录了作为参数传递给系统调用的文件或目录的路径。在本例中,它是 /Data/README.md
文件。
inode=1442785
inode
字段包含与该事件中记录的文件或目录相关联的 inode 号。以下命令显示与 1442785
索引节点编号关联的文件或目录:~]# **find / -inum 409248 -print**/root/.local/share/gnome-shell/application_state
dev=08:01
dev
字段指定了包含该事件中记录的文件或目录的设备的次要和主要 ID。在本例中,值表示 /dev/08/1
设备。
mode=0100644
读r=4,写w=2,执行x=1
第一位数字代表文件所有者的权限,第二位数字代表同组用户的权限,第三位数字代表其他用户的。
0(没有权限);4(读取权限);5(4+1 | 读取+执行);6(4+2 | 读取+写入);7(4+2+1 | 读取+写入+执行)
444 r–r–r–
600 rw——-
644 rw-r–r–
666 rw-rw-rw-
700 rwx——
744 rwxr–r–
755 rwxr-xr-x
777 rwxrwxrwx
mode
字段记录文件或目录权限,以数字表示法编码,如 st_mode
字段中 stat 命令返回。如需更多信息,请参阅 stat(2)
man page。在这种情况下,0100644 可以解释为
-rw–r–r—`
nametype=DELETE
nametype
字段记录了每个路径记录在给定系统调用的上下文中的操作意图。
cap_fp=none
cap_fp
字段记录了与设置文件或目录对象的基于文件系统的允许能力有关的数据。
cap_fi=none
cap_fi
字段记录了与文件或目录对象的基于继承文件系统的能力设置有关的数据。
cap_fe=0
cap_fe
字段记录了文件或目录对象基于文件系统能力的有效位的设置。
cap_fver=0
cap_fver
字段记录了文件或目录对象基于文件系统能力的版本。
未出现
obj=system_u:object_r:etc_t:s0
obj
字段记录了 SELinux 上下文,在执行时,记录的文件或目录被贴上了标签。
SELinux,Security Enhanced Linux 的缩写,也就是安全强化的 Linux,是由美国国家安全局(NSA)联合其他安全机构(比如 SCC 公司)共同开发的,旨在增强传统 Linux 操作系统的安全性,解决传统 Linux 系统中自主访问控制(DAC)系统中的各种权限问题(如 root 权限过高等)。
传统的 Linux 系统中,默认权限是对文件或目录的所有者、所属组和其他人的读、写和执行权限进行控制,这种控制方式称为自主访问控制(DAC)方式;而在 SELinux 中,采用的是强制访问控制(MAC)系统,也就是控制一个进程对具体文件系统上面的文件或目录是否拥有访问权限,而判断进程是否可以访问文件或目录的依据,取决于 SELinux 中设定的很多策略规则。
安全上下文是一个简单的、一致的访问控制属性
objtype=NORMAL
objtype
字段记录了每个路径记录在给定系统调用上下文中的操作意图。
ouid=0
ouid
字段记录了对象所有者的用户 ID。
ogid=0
ogid
字段记录了对象所有者的组 ID。
rdev=00:00
rdev
字段包含一个记录的设备标识符,仅用于特殊文件。在这种情况下,不会使用它,因为记录的文件是常规文件。
type=CWD msg=audit(1655623856.307:505): cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E
type=CWD msg=audit(2022年06月19日 15:30:56.307:505) : cwd=/root/桌面/xuan_shan
type=CWD
在第二条记录中,type
字段值为 CWD
- 当前工作目录。此类型用于记录从中调用第一条记录中指定的系统调用的进程的工作目录。此记录的目的是记录当前进程的位置,以便在相关 PATH 记录中捕获相对路径。这样,可以重建绝对路径。
msg=audit(1655623856.307:505)
msg
字段持有与第一条记录中的值相同的时间戳和 ID 值。时间戳在 1970 年 1 月 1 日使用 Unix 时间格式 - 秒,自 00:00:00 UTC 起。
cwd=2F726F6F742FE6A18CE99DA22F7875616E5F7368616E
cwd
字段包含系统调用所在目录的路径。
type=SYSCALL msg=audit(1655623856.307:505): arch=c000003e syscall=87 success=yes exit=0 a0=7fbf4ab9f350 a1=0 a2=5617fa773210 a3=7ffd1700c2a7 items=2 ppid=90290 pid=90302 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=5 comm="python3" exe="/usr/local/python3.8.3/bin/python3.8" key="key"2type=SYSCALL msg=audit(2022年06月19日 15:30:56.307:505) : arch=x86_64 syscall=unlink success=yes exit=0 a0=0x7fbf4ab9f350 a1=0x0 a2=0x5617fa773210 a3=0x7ffd1700c2a7 items=2 ppid=90290 pid=90302 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=5 comm=python3 exe=/usr/local/python3.8.3/bin/python3.8 key=key
type=SYSCALL
type
字段包含记录的类型。在本例中,SYSCALL 指定此记录是由系统调用对内核触发的。有关所有可能类型值及其解释列表, Audit Record Types。
msg=audit(1655623856.307:505):
msg
字段记录:时间戳和记录的唯一 ID,格式为 audit(*time_stamp*:*ID*)。
如果多个记录是作为同一审计事件的一部分生成的,则可以共享相同的时间戳和 ID。时间戳在 1970 年 1 月 1 日使用 Unix 时间格式 - 秒,自 00:00:00 UTC 起。各种特定于事件 *的名称*= 内核或用户空间应用程序提供的*值对*
.
arch=c000003e
arch
字段包含系统的 CPU 架构信息。该值 c000003e
以十六进制表示法编码。使用 ausearch 命令搜索 Audit 记录时,请使用 -i 或
--interpret
选项自动将十六进制值转换为其人类可读的等效值。c000003e
值被解释为 x86_64
。
syscall=87
syscall
字段记录了发送到内核的系统调用的类型。值 2
可以与其 /usr/include/asm/unistd_64.h
文件中的可读等效值匹配。在本例中,87 是 open
系统调用unlink 。使用 ausyscall --dump 命令显示所有系统调用的列表及其编号。
success=yes
success
字段记录了该特定事件中记录的系统调用是成功还是失败。
exit=0
exit
字段包含一个值,指定系统调用返回的退出代码。此值因不同的系统调用而异。您可以使用以下命令将值解读为其可读的等效值:
ausearch --interpret --exit 0
//查找审计日志包含带有退出代码 0 的事件。
a0=7fbf4ab9f350 a1=0 a2=5617fa773210 a3=7ffd1700c2a7
a0
至a3
字段记录了该事件中系统调用的前四个参数,用十六进制符号编码。这些参数取决于使用的系统调用
items=2
items
字段包含系统调用记录后面的 PATH 辅助记录的数量。
ppid=90290
ppid
字段记录了父进程ID(PPID)。在这种情况下,90290
是父进程的 PPID,如 bash
。
pid=90302
pid
字段记录了进程 ID(PID)。在本例中,90302
是进程的 PID。
auid=0
auid
字段记录了审计用户 ID,即loginuid。此 ID 在登录时分配给用户,并在每次用户的身份更改时继承,例如使用 su - john 命令切换用户帐户。
uid=0
uid
字段记录了启动分析过程的用户的用户 ID。使用以下命令可以解读用户 ID:ausearch -i --uid *UID*.
gid=0
gid
字段记录了启动分析过程的用户的组 ID。
euid=0
euid
字段记录了启动分析过程的用户的有效用户 ID。
suid=0
suid
字段记录了启动分析过程的用户的设置用户 ID。
fsuid=0
fsuid
字段记录了启动分析进程的用户的文件系统用户 ID。
egid=0
egid
字段记录了启动分析过程的用户的有效组 ID。
sgid=0
sgid
字段记录了启动分析过程的用户的组 ID。
fsgid=0
fsgid
字段记录了启动分析进程的用户的文件系统组 ID。
tty=pts1
tty
字段记录了分析过程被调用的终端。
ses=5
ses
字段记录了分析过程被调用的会话的会话 ID。
comm="python3"
comm
字段记录了用于调用分析过程的命令行名称。在本例中,cat 命令用于触发此审计事件。
exe="/usr/local/python3.8.3/bin/python3.8
exe
字段记录了用于调用分析过程的可执行文件的路径。
key=“key”
key
记录了与在审计日志中生成该事件的规则相关联的管理员定义的字符串。
https://access.redhat.com/articles/4409591#audit-event-fields-1
用户 UID 为 1000 的失败尝试以 root 用户身份登录。
type=USER_AUTH msg=audit(1364475353.159:24270): user pid=3280 uid=1000 auid=1000 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication acct="root" exe="/bin/su" hostname=? addr=? terminal=pts/0 res=failed'
root@uuu-virtual-machine:~/桌面/xuan_shan# python3 wiper.py -p /root/桌面/xuan_shan/wipeData/ -m r [+] Files found: 2 [+] Overwriting /root/桌面/xuan_shan/wipeData/LICENSE (35821 bytes) [-] Starting one-pass random wipe... Progress: |██████████████████████████████████████████████████| 100.0% Complete [-] /root/桌面/xuan_shan/wipeData/LICENSE was succesfully wiped [+] Overwriting /root/桌面/xuan_shan/wipeData/help.txt (711 bytes) [-] Starting one-pass random wipe... Progress: |██████████████████████████████████████████████████| 100.0% Complete [-] /root/桌面/xuan_shan/wipeData/help.txt was succesfully wiped [+] Files wiped: 2 [+] Empty tree removed (path given was a dir) root@uuu-virtual-machine:~/桌面/xuan_shan# date 2022年 06月 20日 星期一 08:47:40 CST root@uuu-virtual-machine:~/桌面/xuan_shan# ausearch -k wipe -i ---- type=CONFIG_CHANGE msg=audit(2022年06月20日 08:44:31.604:714) : auid=root ses=5 op=add_rule key=wipe list=exit res=yes ---- type=PROCTITLE msg=audit(2022年06月20日 08:47:22.747:720) : proctitle=python3 wiper.py -p /root/桌面/xuan_shan/wipeData/help.txt -m r type=PATH msg=audit(2022年06月20日 08:47:22.747:720) : item=0 name=/root/桌面/xuan_shan/wipeData/help.txt inode=1442764 dev=08:01 mode=file,644 ouid=root ogid=root rdev=00:00 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=CWD msg=audit(2022年06月20日 08:47:22.747:720) : cwd=/root/桌面/xuan_shan type=SYSCALL msg=audit(2022年06月20日 08:47:22.747:720) : arch=x86_64 syscall=openat success=no exit=ENOTDIR(不是目录) a0=0xffffff9c a1=0x7fa9c1552230 a2=O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC a3=0x0 items=1 ppid=91136 pid=91441 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=5 comm=python3 exe=/usr/local/python3.8.3/bin/python3.8 key=wipe ---- type=CONFIG_CHANGE msg=audit(2022年06月20日 08:47:30.859:722) : auid=root ses=5 op=updated_rules path=/root/桌面/xuan_shan/wipeData/help.txt key=wipe list=exit res=yes ---- type=PROCTITLE msg=audit(2022年06月20日 08:47:30.835:721) : proctitle=python3 wiper.py -p /root/桌面/xuan_shan/wipeData/ -m r type=PATH msg=audit(2022年06月20日 08:47:30.835:721) : item=1 name=/root/桌面/xuan_shan/wipeData/help.txt inode=1442764 dev=08:01 mode=file,644 ouid=root ogid=root rdev=00:00 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=PATH msg=audit(2022年06月20日 08:47:30.835:721) : item=0 name=/root/桌面/xuan_shan/wipeData/ inode=1442938 dev=08:01 mode=dir,755 ouid=root ogid=root rdev=00:00 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=CWD msg=audit(2022年06月20日 08:47:30.835:721) : cwd=/root/桌面/xuan_shan type=SYSCALL msg=audit(2022年06月20日 08:47:30.835:721) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7f2af8987780 a2=O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC a3=0x1b6 items=2 ppid=91136 pid=91442 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=5 comm=python3 exe=/usr/local/python3.8.3/bin/python3.8 key=wipe ---- type=PROCTITLE msg=audit(2022年06月20日 08:47:30.859:723) : proctitle=python3 wiper.py -p /root/桌面/xuan_shan/wipeData/ -m r type=PATH msg=audit(2022年06月20日 08:47:30.859:723) : item=1 name=/root/桌面/xuan_shan/wipeData/help.txt inode=1442764 dev=08:01 mode=file,644 ouid=root ogid=root rdev=00:00 nametype=DELETE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=PATH msg=audit(2022年06月20日 08:47:30.859:723) : item=0 name=/root/桌面/xuan_shan/wipeData/ inode=1442938 dev=08:01 mode=dir,755 ouid=root ogid=root rdev=00:00 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 type=CWD msg=audit(2022年06月20日 08:47:30.859:723) : cwd=/root/桌面/xuan_shan type=SYSCALL msg=audit(2022年06月20日 08:47:30.859:723) : arch=x86_64 syscall=unlink success=yes exit=0 a0=0x7f2af8987780 a1=0x0 a2=0x5567010f3210 a3=0x7f2af898f1fe items=2 ppid=91136 pid=91442 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=5 comm=python3 exe=/usr/local/python3.8.3/bin/python3.8 key=wipe ---- type=CONFIG_CHANGE msg=audit(2022年06月20日 08:47:30.859:724) : auid=root ses=5 op=remove_rule path=/root/桌面/xuan_shan/wipeData/help.txt key=wipe list=exit res=yes root@uuu-virtual-machine:~/桌面/xuan_shan#
0 read 1 write 2 open 3 close 4 stat 5 fstat 6 lstat 7 poll 8 lseek 9 mmap 10 mprotect 11 munmap 12 brk 13 rt_sigaction 14 rt_sigprocmask 15 rt_sigreturn 16 ioctl 17 pread 18 pwrite 19 readv 20 writev 21 access 22 pipe 23 select 24 sched_yield 25 mremap 26 msync 27 mincore 28 madvise 29 shmget 30 shmat 31 shmctl 32 dup 33 dup2 34 pause 35 nanosleep 36 getitimer 37 alarm 38 setitimer 39 getpid 40 sendfile 41 socket 42 connect 43 accept 44 sendto 45 recvfrom 46 sendmsg 47 recvmsg 48 shutdown 49 bind 50 listen 51 getsockname 52 getpeername 53 socketpair 54 setsockopt 55 getsockopt 56 clone 57 fork 58 vfork 59 execve 60 exit 61 wait4 62 kill 63 uname 64 semget 65 semop 66 semctl 67 shmdt 68 msgget 69 msgsnd 70 msgrcv 71 msgctl 72 fcntl 73 flock 74 fsync 75 fdatasync 76 truncate 77 ftruncate 78 getdents 79 getcwd 80 chdir 81 fchdir 82 rename 83 mkdir 84 rmdir 删除目录路径。它仅在目录为空时才起作用 85 creat 86 link 87 unlink 删除文件路径 88 symlink 89 readlink 90 chmod 91 fchmod 92 chown 93 fchown 94 lchown 95 umask 96 gettimeofday 97 getrlimit 98 getrusage 99 sysinfo 100 times 101 ptrace 102 getuid 103 syslog 104 getgid 105 setuid 106 setgid 107 geteuid 108 getegid 109 setpgid 110 getppid 111 getpgrp 112 setsid 113 setreuid 114 setregid 115 getgroups 116 setgroups 117 setresuid 118 getresuid 119 setresgid 120 getresgid 121 getpgid 122 setfsuid 123 setfsgid 124 getsid 125 capget 126 capset 127 rt_sigpending 128 rt_sigtimedwait 129 rt_sigqueueinfo 130 rt_sigsuspend 131 sigaltstack 132 utime 133 mknod 134 uselib 135 personality 136 ustat 137 statfs 138 fstatfs 139 sysfs 140 getpriority 141 setpriority 142 sched_setparam 143 sched_getparam 144 sched_setscheduler 145 sched_getscheduler 146 sched_get_priority_max 147 sched_get_priority_min 148 sched_rr_get_interval 149 mlock 150 munlock 151 mlockall 152 munlockall 153 vhangup 154 modify_ldt 155 pivot_root 156 _sysctl 157 prctl 158 arch_prctl 159 adjtimex 160 setrlimit 161 chroot 162 sync 163 acct 164 settimeofday 165 mount 166 umount2 167 swapon 168 swapoff 169 reboot 170 sethostname 171 setdomainname 172 iopl 173 ioperm 174 create_module 175 init_module 176 delete_module 177 get_kernel_syms 178 query_module 179 quotactl 180 nfsservctl 181 getpmsg 182 putpmsg 183 afs_syscall 184 tuxcall 185 security 186 gettid 187 readahead 188 setxattr 189 lsetxattr 190 fsetxattr 191 getxattr 192 lgetxattr 193 fgetxattr 194 listxattr 195 llistxattr 196 flistxattr 197 removexattr 198 lremovexattr 199 fremovexattr 200 tkill 201 time 202 futex 203 sched_setaffinity 204 sched_getaffinity 205 set_thread_area 206 io_setup 207 io_destroy 208 io_getevents 209 io_submit 210 io_cancel 211 get_thread_area 212 lookup_dcookie 213 epoll_create 214 epoll_ctl_old 215 epoll_wait_old 216 remap_file_pages 217 getdents64 218 set_tid_address 219 restart_syscall 220 semtimedop 221 fadvise64 222 timer_create 223 timer_settime 224 timer_gettime 225 timer_getoverrun 226 timer_delete 227 clock_settime 228 clock_gettime 229 clock_getres 230 clock_nanosleep 231 exit_group 232 epoll_wait 233 epoll_ctl 234 tgkill 235 utimes 236 vserver 237 mbind 238 set_mempolicy 239 get_mempolicy 240 mq_open 241 mq_unlink 242 mq_timedsend 243 mq_timedreceive 244 mq_notify 245 mq_getsetattr 246 kexec_load 247 waitid 248 add_key 249 request_key 250 keyctl 251 ioprio_set 252 ioprio_get 253 inotify_init 254 inotify_add_watch 255 inotify_rm_watch 256 migrate_pages 257 openat 打开文件 258 mkdirat 259 mknodat 260 fchownat 261 futimesat 262 newfstatat 263 unlinkat 264 renameat 265 linkat 266 symlinkat 267 readlinkat 268 fchmodat 269 faccessat 270 pselect6 271 ppoll 272 unshare 273 set_robust_list 274 get_robust_list 275 splice 276 tee 277 sync_file_range 278 vmsplice 279 move_pages 280 utimensat 281 epoll_pwait 282 signalfd 283 timerfd 284 eventfd 285 fallocate 286 timerfd_settime 287 timerfd_gettime 288 accept4 289 signalfd4 290 eventfd2 291 epoll_create1 292 dup3 293 pipe2 294 inotify_init1 295 preadv 296 pwritev 297 rt_tgsigqueueinfo 298 perf_event_open 299 recvmmsg 300 fanotify_init 301 fanotify_mark 302 prlimit64 303 name_to_handle_at 304 open_by_handle_at 305 clock_adjtime 306 syncfs 307 sendmmsg 308 setns 309 getcpu 310 process_vm_readv 311 process_vm_writev 312 kcmp 313 finit_module 314 sched_setattr 315 sched_getattr 316 renameat2 317 seccomp 318 getrandom 319 memfd_create 320 kexec_file_load 321 bpf 322 execveat 323 userfaultfd 324 membarrier 325 mlock2 326 copy_file_range 327 preadv2 328 pwritev2 329 pkey_mprotect 330 pkey_alloc 331 pkey_free 332 statx
imer_gettime
225 timer_getoverrun
226 timer_delete
227 clock_settime
228 clock_gettime
229 clock_getres
230 clock_nanosleep
231 exit_group
232 epoll_wait
233 epoll_ctl
234 tgkill
235 utimes
236 vserver
237 mbind
238 set_mempolicy
239 get_mempolicy
240 mq_open
241 mq_unlink
242 mq_timedsend
243 mq_timedreceive
244 mq_notify
245 mq_getsetattr
246 kexec_load
247 waitid
248 add_key
249 request_key
250 keyctl
251 ioprio_set
252 ioprio_get
253 inotify_init
254 inotify_add_watch
255 inotify_rm_watch
256 migrate_pages
257 openat 打开文件
258 mkdirat
259 mknodat
260 fchownat
261 futimesat
262 newfstatat
263 unlinkat
264 renameat
265 linkat
266 symlinkat
267 readlinkat
268 fchmodat
269 faccessat
270 pselect6
271 ppoll
272 unshare
273 set_robust_list
274 get_robust_list
275 splice
276 tee
277 sync_file_range
278 vmsplice
279 move_pages
280 utimensat
281 epoll_pwait
282 signalfd
283 timerfd
284 eventfd
285 fallocate
286 timerfd_settime
287 timerfd_gettime
288 accept4
289 signalfd4
290 eventfd2
291 epoll_create1
292 dup3
293 pipe2
294 inotify_init1
295 preadv
296 pwritev
297 rt_tgsigqueueinfo
298 perf_event_open
299 recvmmsg
300 fanotify_init
301 fanotify_mark
302 prlimit64
303 name_to_handle_at
304 open_by_handle_at
305 clock_adjtime
306 syncfs
307 sendmmsg
308 setns
309 getcpu
310 process_vm_readv
311 process_vm_writev
312 kcmp
313 finit_module
314 sched_setattr
315 sched_getattr
316 renameat2
317 seccomp
318 getrandom
319 memfd_create
320 kexec_file_load
321 bpf
322 execveat
323 userfaultfd
324 membarrier
325 mlock2
326 copy_file_range
327 preadv2
328 pwritev2
329 pkey_mprotect
330 pkey_alloc
331 pkey_free
332 statx
主要关注里面的**comm=”rm” exe=”/usr/bin/rm”**,这两个字段,通过这两个字段我们就知道是什么命令操作了我们的文件或目录。同时也可以看下**pid**这个字段,如果这个进程还在的话,那就可以直接看出是哪个进程操作的了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。