Received: by 10.223.185.116 with SMTP id b49csp1957916wrg; Sun, 4 Mar 2018 14:18:05 -0800 (PST) X-Google-Smtp-Source: AG47ELuwXp3o3Jp8tyu1B8Z9hOr/TRzi+lJHLXo29YpwMLpVMOEHrWFNmev7AGeLf2EaioucWWF4 X-Received: by 10.99.125.16 with SMTP id y16mr10408549pgc.3.1520201885011; Sun, 04 Mar 2018 14:18:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520201884; cv=none; d=google.com; s=arc-20160816; b=biK1UWXSLbOjZ9tOsTSIaFXm9gLoA7HWw4QRwSZVlI9GG3T6tc6sb3/C6wfdakaPWb FvZKVgDIxOHYqj5bVKIs/aA81KCta4Ol0YUCNtcfx4Lb6quY7evVBWxZlNS8QC95slp9 hy+I2pBHltAmuI9mvo4Fr0OOve8j/HtJDQbRhLJAQzgH2FXzT+r34kZgTuYslub6sJLR Z34r/ivPpn8igWxKx29BuFz3PAd5f08wkGjCRdo7Q1SWkkmsaCckEFnMKjgWHPoEAJBT WqIIwzmrlqS+h7PNixxgiapDPeXgqpW8XgCJmqWFZKnyRvYL+jZ4i6SeJSdMfQcxkPl1 /RRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject :arc-authentication-results; bh=gvHo//st73JXOwfOBHuNRJaQWOTX7KgRSMGSlo27Huo=; b=DyA2NKQJPh9uHLkvhZvpJOARGaaSO2V7UfT7kgMRDjCTov1H4m8EJHPbxFv9kJkrPk DLOJt4YDeANGpFIfV0EXUg4vNDpdfg66SEENlZhG+Beyyaum4bqAFh6TBYpa0RzUm0Yq J+enhmjeNamAGncXYEaxBF4PePjMtGcNLOwuZ4NZuY9FiPnKpQ/fDlufBNbAdThMKn62 LsJS5qnK4bgan2HdbrX54kU8b0pWW5YPRjNdnlbOV09kPJl3fGHoAeRK78415smfGF/s PqkggtDs8K9poSUdLUnO0BOsoAZ1Ko7lv8mTzNrEn8FWdXzo/PoFQjv9eyGbF/UTcm3J f+3A== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si8325402plb.68.2018.03.04.14.17.18; Sun, 04 Mar 2018 14:18:04 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932361AbeCDV4M (ORCPT + 99 others); Sun, 4 Mar 2018 16:56:12 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59906 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932299AbeCDV4J (ORCPT ); Sun, 4 Mar 2018 16:56:09 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w24LsBwa025395 for ; Sun, 4 Mar 2018 16:56:09 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gga78wab1-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Sun, 04 Mar 2018 16:56:08 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 4 Mar 2018 21:56:06 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 4 Mar 2018 21:56:01 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w24Lu1fD56950786; Sun, 4 Mar 2018 21:56:01 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E60834C046; Sun, 4 Mar 2018 21:49:25 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96EAA4C040; Sun, 4 Mar 2018 21:49:23 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.81.235]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 4 Mar 2018 21:49:23 +0000 (GMT) Subject: Re: [RFC PATCH V1 00/12] audit: implement container id From: Mimi Zohar To: Richard Guy Briggs , cgroups@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, Linux-Audit Mailing List , linux-fsdevel@vger.kernel.org, LKML , netdev@vger.kernel.org Cc: mszeredi@redhat.com, ebiederm@xmission.com, simo@redhat.com, jlayton@redhat.com, carlos@redhat.com, dhowells@redhat.com, viro@zeniv.linux.org.uk, luto@kernel.org, eparis@parisplace.org, trondmy@primarydata.com, serge@hallyn.com Date: Sun, 04 Mar 2018 16:55:57 -0500 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18030421-0040-0000-0000-0000041A9E37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030421-0041-0000-0000-0000261DAAC8 Message-Id: <1520200557.10396.257.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-04_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803040285 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-03-01 at 14:41 -0500, Richard Guy Briggs wrote: > Implement audit kernel container ID. > > This patchset is a preliminary RFC based on the proposal document (V3) > posted: > https://www.redhat.com/archives/linux-audit/2018-January/msg00014.html > > The first patch implements the proc fs write to set the audit container > ID of a process, emitting an AUDIT_CONTAINER record. > > The second implements an auxiliary syscall record AUDIT_CONTAINER_INFO > if a container ID is present on a task. > > The third adds filtering to the exit, exclude and user lists. > > The 4th, implements reading the container ID from the proc filesystem > for debugging. This isn't planned for upstream inclusion. > > The 5th adds signal and ptrace support. > > The 6th attempts to create a local audit context to be able to bind a > standalone record with the container ID record. > > The 7th, 8th, 9th, 10th patches add container ID records to standalone > records. Some of these may end up being syscall auxiliary records and > won't need this specific support since they'll be supported via > syscalls. > > The 11th is a temporary workaround due to the AUDIT_CONTAINER records > not showing up as do AUDIT_LOGIN records. I suspect this is due to its > range (1000 vs 1300), but the intent is to solve it. > > The 12th adds debug information not intended for upstream for those > brave souls wanting to tinker with it in this early state. > > Feedback please! Which tree can this patch set be applied to? Mimi > Here's a quick and dirty test script: > echo 123455 > /proc/$$/containerid; echo $? > sleep 4& > child=$!; sleep 1 > echo 18446744073709551615 > /proc/$child/containerid; echo $? > echo 123456 > /proc/$child/containerid; echo $? > echo 123457 > /proc/$child/containerid; echo $? > sleep 1 > ausearch -ts recent |grep " contid=18446744073709551615"; echo $? > ausearch -ts recent |grep " contid=123456"; echo $? > ausearch -ts recent |grep " contid=123457"; echo $? > echo self:$$ contid:$( cat /proc/$$/containerid) > echo child:$child contid:$( cat /proc/$child/containerid) > > containerid=123458 > key=tmpcontainerid > auditctl -a exit,always -F dir=/tmp -F perm=wa -F containerid=$containerid -F key=$key || echo failed to add containerid filter rule > bash -c "sleep 1; echo test > /tmp/$key"& > child=$! > echo $containerid > /proc/$child/containerid > sleep 2 > rm -f /tmp/$key > ausearch -ts recent -k $key || echo failed to find CONTAINER_INFO record > auditctl -d exit,always -F dir=/tmp -F perm=wa -F containerid=$containerid -F key=$key || echo failed to add containerid filter rule > > See: > https://github.com/linux-audit/audit-kernel/issues/32 > https://github.com/linux-audit/audit-userspace/issues/40 > https://github.com/linux-audit/audit-testsuite/issues/64 > > Richard Guy Briggs (12): > audit: add container id > audit: log container info of syscalls > audit: add containerid filtering > audit: read container ID of a process > audit: add containerid support for ptrace and signals > audit: add support for non-syscall auxiliary records > audit: add container aux record to watch/tree/mark > audit: add containerid support for tty_audit > audit: add containerid support for config/feature/user records > audit: add containerid support for seccomp and anom_abend records > debug audit: add container id > debug! audit: add container id > > drivers/tty/tty_audit.c | 5 +- > fs/proc/base.c | 63 +++++++++++++++++++ > include/linux/audit.h | 36 +++++++++++ > include/linux/init_task.h | 4 +- > include/linux/sched.h | 1 + > include/uapi/linux/audit.h | 9 ++- > kernel/audit.c | 74 +++++++++++++++++++--- > kernel/audit.h | 3 + > kernel/audit_fsnotify.c | 5 +- > kernel/audit_tree.c | 5 +- > kernel/audit_watch.c | 33 +++++----- > kernel/auditfilter.c | 52 ++++++++++++++- > kernel/auditsc.c | 154 +++++++++++++++++++++++++++++++++++++++++++-- > 13 files changed, 408 insertions(+), 36 deletions(-) >