Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1108116ybl; Thu, 23 Jan 2020 13:46:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwVoJZiN1U50B2e2MXJmnp413j1Le1DU+IpNY2HsZY0loCwYr4CR2+RDen2Ad4/lNCFkgsR X-Received: by 2002:a9d:7ac9:: with SMTP id m9mr366626otn.80.1579815991149; Thu, 23 Jan 2020 13:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579815991; cv=none; d=google.com; s=arc-20160816; b=SDSeb3RNXQYz8N+0vTTdUNPKin/4hDn/5WY6dTDXXsUTV1j+vpsdeLGiTo543u6/cx hxuHjlVRxh08IrIblahDIVyoi6FVpuWDGd7GLzWPpeNI+pgVpJaApY7DSqY0/WdVsths 9VFagOHu4LN4onSf+kgPAm+omspyQ0dKQrWS6FbQQPkc1QU4IMXnPx4F/6UajhhgIob+ ZBI/HaEJgkt6QVKlBI45GSX9mDYG0NjKfYifsrqlQJ02hhsU3BJQechrbcym2Eoq8ltO 0WiTdcXHL0nifM4QdG2mrVX6Jqm/gwF8/DAbst6YhICnCq/eYbi0c+ZmWr8AYRh185J+ YnHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=14Phm8+YcLeBER1tUmYRr6u2IEB1IiJoYWbH7UYZiVo=; b=J+oRim6PTw0lSPgJo0IJmE2bb1UP3kWORXFJ3SVQM+3UR1enSfGVpHIqKwZ1HAalMp qrcbg4aln2lFq6FmlD+R0GU0pgT/tcXxpoRQwKqn+lz4XD1D3UCIBQRaiqoPXJgHJiFZ 2qAh01Y06iaINb5/LzvKM1SOg2P5HyZsKbtUO34N/HTwTvouH9rcD5a7dFDSLp+O+3FH 1lZ58yNXYcfoWIwg7m3vwbpZMomAQLWcJqDZTqDm4p3qcDFugpBkMDWVl/sBbCW9AQVM CGCna35PDE1eGyAh8BCr9XXFqaj71MjymkCPB5fcWVJczqQ2E1c8IyCP8n9f7lE5Pyhl XUtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=FkFiUQ+Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14si1802763otk.225.2020.01.23.13.46.18; Thu, 23 Jan 2020 13:46:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=FkFiUQ+Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729043AbgAWVpU (ORCPT + 99 others); Thu, 23 Jan 2020 16:45:20 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45206 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728057AbgAWVpU (ORCPT ); Thu, 23 Jan 2020 16:45:20 -0500 Received: by mail-lj1-f195.google.com with SMTP id j26so5402133ljc.12 for ; Thu, 23 Jan 2020 13:45:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=14Phm8+YcLeBER1tUmYRr6u2IEB1IiJoYWbH7UYZiVo=; b=FkFiUQ+QKLXb0B0bW8Dkh0idUJ/db0OxoHdnOxNAp1boJLPUkSnF0i7Bdi1TnSHg31 7DLxaMiuAxaLeTfpvYGTB5pDNYF4brL6mBnAtQ50VspqngrmvJeH/+0eJLoTUZwwcNur JAyFY0lEOW/cQuhfOdHnCYnqVkBNxdDhqQ3OlUfpJNAuoTfxaOt3y6cUFoLlHZmgwLI4 4Lkic2ibNKtNZ0+gjR5pgpO7uhwUR3no6Ynmw5sz8oUizYKwrpA2JOd4FinkN6SiZTM5 oJjkoj0cwM7s2n6b/q6hbwIegVIvRgqr09h1A/K86vcXBXGaqQ1OQrhHJm6RBnSPHVPv 7m4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=14Phm8+YcLeBER1tUmYRr6u2IEB1IiJoYWbH7UYZiVo=; b=GfTuOnEzDkeD4ZNrupTuO98LCiAd38myYHMLGDS7yBoPI5mQVrRPzqooNn7mqC4jay /tZC5sVTI4UYdErCBPlPFCKHRMViVViumVVtFk+rIUGq8sfilYEXAtCcg8S/MumPoMsM ATRMEZ4Wgoa1vD2CfUg+UlIWSFfGPsjBAjMZ47F8rbb2sfz+eiub1iONaa778lHqzgZH baMCnBDsfLSReBTlYYDSHz2iczIUo8NPEq1up5pnlPRs2q1VPBW2fWqfLp/syALBDFqo 3TVR5uRLrQCGcGDSInGkeGOmPgYUo78LoDtwFT28WPz9s2cevIJJdhFdVLXqMjYb/KpP IZqw== X-Gm-Message-State: APjAAAWhOhb4QbKkV09NF+SvccKH/xEcWSw5lOcn4PCnXMmlgo88CL+M I/Gqp8qE0cksLMPQ/39iEZydIQvMXor+lH2yTj3QTms= X-Received: by 2002:a2e:9b03:: with SMTP id u3mr256015lji.87.1579815917614; Thu, 23 Jan 2020 13:45:17 -0800 (PST) MIME-Version: 1.0 References: <20200122230742.7vwtvmhhjerray5f@madcap2.tricolour.ca> <20200123161349.z55l2dd7qsyhoxbn@madcap2.tricolour.ca> <20200123185149.sr4b4u4s2ec7renc@madcap2.tricolour.ca> <20200123201541.emtse6l5wrnrpqgc@madcap2.tricolour.ca> In-Reply-To: <20200123201541.emtse6l5wrnrpqgc@madcap2.tricolour.ca> From: Paul Moore Date: Thu, 23 Jan 2020 16:45:06 -0500 Message-ID: Subject: Re: [PATCH ghak28 V4] audit: log audit netlink multicast bind and unbind events To: Richard Guy Briggs Cc: Eric Paris , nhorman@redhat.com, Linux-Audit Mailing List , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 23, 2020 at 3:15 PM Richard Guy Briggs wrote: > On 2020-01-23 14:07, Paul Moore wrote: > > On Thu, Jan 23, 2020 at 1:52 PM Richard Guy Briggs wrote: > > > On 2020-01-23 11:57, Paul Moore wrote: > > > > On Thu, Jan 23, 2020 at 11:14 AM Richard Guy Briggs wrote: > > > > > On 2020-01-23 09:32, Paul Moore wrote: > > > > > > On Wed, Jan 22, 2020 at 6:07 PM Richard Guy Briggs wrote: > > > > > > > On 2020-01-22 17:40, Paul Moore wrote: > > > > > > > > On Fri, Jan 17, 2020 at 3:21 PM Richard Guy Briggs wrote: > > > > > > > > > > > > ... > > > > > > > > > > > > > > > diff --git a/kernel/audit.c b/kernel/audit.c > > > > > > > > > index 17b0d523afb3..478259f3fa53 100644 > > > > > > > > > --- a/kernel/audit.c > > > > > > > > > +++ b/kernel/audit.c > > > > > > > > > @@ -1520,20 +1520,60 @@ static void audit_receive(struct sk_buff *skb) > > > > > > > > > audit_ctl_unlock(); > > > > > > > > > } > > > > > > > > > > > > > > > > > > +/* Log information about who is connecting to the audit multicast socket */ > > > > > > > > > +static void audit_log_multicast_bind(int group, const char *op, int err) > > > > > > > > > +{ > > > > > > > > > + const struct cred *cred; > > > > > > > > > + struct tty_struct *tty; > > > > > > > > > + char comm[sizeof(current->comm)]; > > > > > > > > > + struct audit_buffer *ab; > > > > > > > > > + > > > > > > > > > + if (!audit_enabled) > > > > > > > > > + return; > > > > > > > > > + > > > > > > > > > + ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_EVENT_LISTENER); > > > > > > > > > + if (!ab) > > > > > > > > > + return; > > > > > > > > > + > > > > > > > > > + cred = current_cred(); > > > > > > > > > + tty = audit_get_tty(); > > > > > > > > > + audit_log_format(ab, "pid=%u uid=%u auid=%u tty=%s ses=%u", > > > > > > > > > + task_pid_nr(current), > > > > > > > > > + from_kuid(&init_user_ns, cred->uid), > > > > > > > > > + from_kuid(&init_user_ns, audit_get_loginuid(current)), > > > > > > > > > + tty ? tty_name(tty) : "(none)", > > > > > > > > > + audit_get_sessionid(current)); > > > > > > > > > > > > > > > > Don't we already get all of that information as part of the syscall record? > > > > > > > > > > > > > > Yes. However, the syscall record isn't always present. One example is > > > > > > > systemd, shown above. > > > > > > > > > > > > Assuming that the system supports syscall auditing, the absence of a > > > > > > syscall record is a configuration choice made by the admin. If the > > > > > > system doesn't support syscall auditing the obvious "fix" is to do the > > > > > > work to enable syscall auditing on that platform ... but now we're > > > > > > starting to get off topic. > > > > > > > > > > Well, the system did spit out a syscall record with the example above, > > > > > so it has support for syscall auditing. > > > > > > > > > > I'm testing on f30 with an upstream kernel, the standard 30-stig ruleset and > > > > > with kernel command line audit=1. What else is needed to support a syscall > > > > > record on systemd before any audit rules have been put in place? We may still > > > > > have a bug here that affects early process auditing. What am I missing? > > > > > > > > > > If we can get that sorted out, we don't need subject attributes in this record. > > > > > > > > It looks like some debugging is in order. There must be some sort of > > > > action initiated by userspace which is causing the multicast > > > > "op=connect", right? Find out what that is and why it isn't > > > > generating a syscall record (maybe it's not a syscall? I don't know > > > > what systemd is doing here). > > > > > > One clue is that subj=kernel and auid, ttye and ses are unset, despite > > > the rest checking out: > > > pid=1 uid=root auid=unset tty=(none) ses=unset subj=kernel comm=systemd exe=/usr/lib/systemd/systemd > > > > Does Fedora use systemd in its initramfs (I'm guessing the answer is > > "yes")? If so, I wonder if that is the source of this record. > > Asking around, I got: "yes, dracut uses systemd these days" > > So, yes, that is the source of this record. > > So if there is no syscall associated with that record, it appears we > need those subject attributes. Well, I'm fairly certain that the record in question was the result of a syscall made by systemd, the question is why was it not recorded? That is something that needs to be answered. -- paul moore www.paul-moore.com