Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754572AbcDDGsq (ORCPT ); Mon, 4 Apr 2016 02:48:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:48371 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753008AbcDDGsp (ORCPT ); Mon, 4 Apr 2016 02:48:45 -0400 Message-ID: <1459752519.24025.5.camel@suse.com> Subject: Re: [RFC] Create an audit record of USB specific details From: Oliver Neukum To: wmealing Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Date: Mon, 04 Apr 2016 08:48:39 +0200 In-Reply-To: <1459742562-22803-1-git-send-email-wmail@redhat.com> References: <1459742562-22803-1-git-send-email-wmail@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1275 Lines: 32 On Mon, 2016-04-04 at 00:02 -0400, wmealing wrote: > From: Wade Mealing > > Gday, > > I'm looking to create an audit trail for when devices are added or removed > from the system. > > The audit subsystem is a logging subsystem in kernel space that can be > used to create advanced filters on generated events. It has partnered userspace > utilities ausearch, auditd, aureport, auditctl which work exclusively on audit > records. > > These tools are able to set filters to "trigger" on specific in-kernel events > specified by privileged users. While the userspace tools can create audit > events these are not able to be handled intelligently (decoded,filtered or > ignored) as kernel generated audit events are. That is a goal that should be debated in general. > I have this working at the moment with the USB subsystem (as an example). > Its been suggested that I use systemd-udev however this means that the audit > tools (ausearch) will not be able to index these records. Chaining this so tightly to the USB subsystem makes no sense. If you do this, then please hook into the generic layer, that is add_device(), and provide a method in the generic device structure for providing information to the audit subsystem. Regards Oliver