From: Steve Grubb <sgrubb@redhat.com>
To: linux-audit@redhat.com
Subject: Re: Deleted directory path not recorded when running rmdir with slash at directory path end
Date: Wed, 10 Mar 2021 14:16:21 -0500 [thread overview]
Message-ID: <2083653.Icojqenx9y@x2> (raw)
In-Reply-To: <CAKz+TUsgGuS8=PZN6bqNL2KAB4L1pPPwijT30FzjGE1CAxdtuQ@mail.gmail.com>
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
next prev parent reply other threads:[~2021-03-10 19:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-03-15 13:56 ` Lenny Bruzenak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2083653.Icojqenx9y@x2 \
--to=sgrubb@redhat.com \
--cc=linux-audit@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).