If I run the rmdir command with a directory path with a slash at its end,
Audit doesn't record the deleted directory path.
Audit rule:
-a always,exit -F dir=/sasdata -F arch=b64 -S creat -S open -S openat -S
unlink -S unlinkat -S symlink -S symlinkat -S link -S linkat -S rename -S
renameat -S chmod -S fchmod -S fchmodat -S chown -S fchown -S fchownat -S
mkdir -S mkdirat -S rmdir -S setxattr -S lsetxattr -S fsetxattr -S
removexattr -S lremovexattr -S fremovexattr -k filesystem_op
Test command:
rmdir /sasdata/testdir
Audit output:
type=SYSCALL msg=audit(1614912311.117:4136): arch=c000003e syscall=84
success=yes exit=0 a0=7ffcf6e5c757 a1=2 a2=7f200050f280 a3=7ffcf6e5b660
items=3 ppid=17590 pid=22579 auid=201327714 uid=0 gid=0 euid=0 suid=0
fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=269 comm=\"rmdir\"
exe=\"/usr/bin/rmdir\" key=\"filesystem_op\"","type=CWD
msg=audit(1614912311.117:4136): cwd=\"/home/aevangelista\""
type=PATH msg=audit(1614912311.117:4136): item=0 name=\"/sasdata/\"
inode=100916940 dev=08:04 mode=040775 ouid=0 ogid=201327708 rdev=00:00
objtype=PARENT cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0
cap_fver=0
type=PATH msg=audit(1614912311.117:4136): item=1 name=(null)
inode=100916940 dev=08:04 mode=040775 ouid=0 ogid=201327708 rdev=00:00
objtype=PARENT cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0
cap_fver=0
type=PATH msg=audit(1614912311.117:4136): item=2 name=(null) inode=1181650
dev=08:04 mode=040755 ouid=0 ogid=0 rdev=00:00 objtype=DELETE
cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0
type=PROCTITLE msg=audit(1614912311.117:4136):
proctitle=726D646972002F736173646174612F746573746469722F
Shouldn't the directory path be recorded somewhere, regardless if there is
a slash at the end of the directory path?
I found this issue while using Auditbeat, a collector of Linux Audit events
used for integration with Elasticsearch. Related discussion:
https://discuss.elastic.co/t/rmdir-syscall-event-and-file-path/266015/3
Thanks in advance.