* Deleted directory path not recorded when running rmdir with slash at directory path end
@ 2021-03-05 3:09 Alan Evangelista
2021-03-10 19:16 ` Steve Grubb
2021-03-15 13:56 ` Lenny Bruzenak
0 siblings, 2 replies; 3+ messages in thread
From: Alan Evangelista @ 2021-03-05 3:09 UTC (permalink / raw)
To: linux-audit
[-- Attachment #1.1: Type: text/plain, Size: 2028 bytes --]
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.
[-- Attachment #1.2: Type: text/html, Size: 2507 bytes --]
[-- Attachment #2: Type: text/plain, Size: 106 bytes --]
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Deleted directory path not recorded when running rmdir with slash at directory path end
2021-03-05 3:09 Deleted directory path not recorded when running rmdir with slash at directory path end Alan Evangelista
@ 2021-03-10 19:16 ` Steve Grubb
2021-03-15 13:56 ` Lenny Bruzenak
1 sibling, 0 replies; 3+ messages in thread
From: Steve Grubb @ 2021-03-10 19:16 UTC (permalink / raw)
To: linux-audit
On Thursday, March 4, 2021 10:09:35 PM EST Alan Evangelista wrote:
> 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
I'm guessing that this ^^^ record is the directory that was removed. But as
this is syscall exit, it has been removed and has no name.
> 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 want to think this was a problem on older kernels. The solution was to also
place a watch on the directory itself ( -F path=/sasdata ). It has nothing
to do with the trailing slash.
-Steve
> 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.
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Deleted directory path not recorded when running rmdir with slash at directory path end
2021-03-05 3:09 Deleted directory path not recorded when running rmdir with slash at directory path end Alan Evangelista
2021-03-10 19:16 ` Steve Grubb
@ 2021-03-15 13:56 ` Lenny Bruzenak
1 sibling, 0 replies; 3+ messages in thread
From: Lenny Bruzenak @ 2021-03-15 13:56 UTC (permalink / raw)
To: linux-audit
On 3/4/21 9:09 PM, Alan Evangelista wrote:
> 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
> <https://discuss.elastic.co/t/rmdir-syscall-event-and-file-path/266015/3>
I tested this on a 3.10.0 kernel with userspace 2.8.5 and it works as
advertised.
The "proctitle" event in my search was the first one and I used the "-i"
interpret flag. I could decode the raw ascii above but I suspect it
would say "rmdir /sasdata/testdir/", since "72" is "r", "6D" is "m" and
"2F", the last char, is "/" .
LCB
--
Lenny Bruzenak
MagitekLTD
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-15 13:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 3:09 Deleted directory path not recorded when running rmdir with slash at directory path end Alan Evangelista
2021-03-10 19:16 ` Steve Grubb
2021-03-15 13:56 ` Lenny Bruzenak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).