From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1F42C433E0 for ; Wed, 10 Mar 2021 19:16:34 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6BB7164F60 for ; Wed, 10 Mar 2021 19:16:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BB7164F60 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=linux-audit-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615403793; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=02Y3VqQyMfUJyUzDl6cK1ECZlNfRrDJNJul1Y1S33Fw=; b=eS8iHCg3mUhFnsR7TUc+iolwp2qDhJVaVdXXREC7gjWO1WVbEEyeXPbMigykBGkpFjFo9P 0p/B4yO/TIbkyY9CwgoaxbLQwLM+bF/d21pA/f1Tsk5JKWgwPutUHRnqVKjkFpHwTF0tpL 7EkZX9iWlhILKdf7YjGTlyaL8ZXqvYY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-AYdDVO62POmI6CrfNQuCdg-1; Wed, 10 Mar 2021 14:16:31 -0500 X-MC-Unique: AYdDVO62POmI6CrfNQuCdg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EF49CC62B; Wed, 10 Mar 2021 19:16:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EAAA65D9DB; Wed, 10 Mar 2021 19:16:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4F1F21809C8C; Wed, 10 Mar 2021 19:16:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12AJGPRr004595 for ; Wed, 10 Mar 2021 14:16:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 566EB1F076; Wed, 10 Mar 2021 19:16:25 +0000 (UTC) Received: from x2.localnet (ovpn-116-198.rdu2.redhat.com [10.10.116.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01FEC19C48; Wed, 10 Mar 2021 19:16:21 +0000 (UTC) From: Steve Grubb 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 Message-ID: <2083653.Icojqenx9y@x2> Organization: Red Hat In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: linux-audit@redhat.com X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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