linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Alan Evangelista <alan.vitor@gmail.com>
To: linux-audit@redhat.com
Subject: Deleted directory path not recorded when running rmdir with slash at directory path end
Date: Fri, 5 Mar 2021 00:09:35 -0300	[thread overview]
Message-ID: <CAKz+TUsgGuS8=PZN6bqNL2KAB4L1pPPwijT30FzjGE1CAxdtuQ@mail.gmail.com> (raw)


[-- 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

             reply	other threads:[~2021-03-05  3:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05  3:09 Alan Evangelista [this message]
2021-03-10 19:16 ` Deleted directory path not recorded when running rmdir with slash at directory path end Steve Grubb
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='CAKz+TUsgGuS8=PZN6bqNL2KAB4L1pPPwijT30FzjGE1CAxdtuQ@mail.gmail.com' \
    --to=alan.vitor@gmail.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).