lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhTh+z7O353Qc86kqF8URf0QfErG1qHPvzXCgH+6c-AJ4g@mail.gmail.com>
Date:   Thu, 2 Mar 2023 14:06:08 -0500
From:   Paul Moore <paul@...l-moore.com>
To:     Fan Wu <wufan@...ux.microsoft.com>
Cc:     corbet@....net, zohar@...ux.ibm.com, jmorris@...ei.org,
        serge@...lyn.com, tytso@....edu, ebiggers@...nel.org,
        axboe@...nel.dk, agk@...hat.com, snitzer@...nel.org,
        eparis@...hat.com, linux-doc@...r.kernel.org,
        linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org,
        linux-fscrypt@...r.kernel.org, linux-block@...r.kernel.org,
        dm-devel@...hat.com, linux-audit@...hat.com,
        roberto.sassu@...wei.com, linux-kernel@...r.kernel.org,
        Deven Bowers <deven.desai@...ux.microsoft.com>
Subject: Re: [RFC PATCH v9 08/16] ipe: add permissive toggle

On Mon, Jan 30, 2023 at 5:58 PM Fan Wu <wufan@...ux.microsoft.com> wrote:
>
> From: Deven Bowers <deven.desai@...ux.microsoft.com>
>
> IPE, like SELinux, supports a permissive mode. This mode allows policy
> authors to test and evaluate IPE policy without it effecting their
> programs. When the mode is changed, a 1404 AUDIT_MAC_STATUS
> be reported.
>
> This patch adds the following audit records:
>
>   audit: MAC_STATUS permissive=1 auid=4294967295 ses=4294967295 lsm=ipe
>     res=1
>   audit: MAC_STATUS permissive=0 auid=4294967295 ses=4294967295 lsm=ipe
>     res=1
>
> These records are emitted within the following events:
>
>   audit: MAC_STATUS permissive=1 auid=4294967295 ses=4294967295 lsm=ipe
>     res=1
>   audit[185]: SYSCALL arch=c000003e syscall=1 success=yes exit=2 a0=1
>     a1=56308bb3ecc0 a2=2 a3=7f290fdc53e0 items=0 ppid=183 pid=185
>     auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0
>     tty=pts0 ses=4294967295 comm="bash" exe="/usr/bin/bash" key=(null)
>   audit: PROCTITLE proctitle="-bash"
>   audit: MAC_STATUS permissive=0 auid=4294967295 ses=4294967295 lsm=ipe
>     res=1
>   audit[185]: SYSCALL arch=c000003e syscall=1 success=yes exit=2 a0=1
>     a1=56308bb3ecc0 a2=2 a3=7f290fdc53e0 items=0 ppid=183 pid=185
>     auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0
>     tty=pts0 ses=4294967295 comm="bash" exe="/usr/bin/bash" key=(null)
>   audit: PROCTITLE proctitle="-bash"
>
>   Implying user used bash to toggle the switch.
>
> Signed-off-by: Deven Bowers <deven.desai@...ux.microsoft.com>
> Signed-off-by: Fan Wu <wufan@...ux.microsoft.com>

...

> ---
>  security/ipe/audit.c | 36 +++++++++++++++++++++++
>  security/ipe/audit.h |  1 +
>  security/ipe/eval.c  |  9 ++++++
>  security/ipe/eval.h  |  1 +
>  security/ipe/fs.c    | 69 ++++++++++++++++++++++++++++++++++++++++++--
>  5 files changed, 114 insertions(+), 2 deletions(-)
>
> diff --git a/security/ipe/audit.c b/security/ipe/audit.c
> index 295e9f9f5146..ff74026a595f 100644
> --- a/security/ipe/audit.c
> +++ b/security/ipe/audit.c
> @@ -194,3 +194,39 @@ void ipe_audit_policy_load(const struct ipe_policy *const p)
>
>         audit_log_end(ab);
>  }
> +
> +/**
> + * ipe_audit_enforce - Audit a change in IPE's enforcement state.
> + */
> +void ipe_audit_enforce(void)
> +{
> +       struct audit_buffer *ab;
> +
> +       ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_MAC_STATUS);
> +       if (!ab)
> +               return;
> +
> +       audit_log_format(ab, "permissive=%d", !READ_ONCE(enforce));
> +       audit_log_format(ab, " auid=%u ses=%u lsm=ipe res=1",
> +                        from_kuid(&init_user_ns, audit_get_loginuid(current)),
> +                        audit_get_sessionid(current));
> +
> +       audit_log_end(ab);
> +}

See the earlier comments in the patchset about consistent formatting
of a given record type.  To the best of my knowledge only SELinux
currently uses the AUDIT_MAC_STATUS record and an example can be found
in `sel_write_enforce()`.  The good news is that it looks like that
format could be made to work here without too much fuss.

> +/**
> + * emit_enforcement - Emit the enforcement state of IPE started with.
> + *
> + * Return:
> + * 0 - Always
> + */
> +static int emit_enforcement(void)
> +{
> +       if (!ipe_enabled)
> +               return -EOPNOTSUPP;
> +
> +       ipe_audit_enforce();
> +       return 0;
> +}
> +
> +late_initcall(emit_enforcement);

--
paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ