Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6233902imb; Fri, 8 Mar 2019 12:27:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyCKSpfYTNB1tsBPyQUNucxn9IUo7fPTLBbf5YbYbz0ND+myCRAb7vKhpJUNciK7qf484O2 X-Received: by 2002:a63:e206:: with SMTP id q6mr18059097pgh.87.1552076820277; Fri, 08 Mar 2019 12:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552076820; cv=none; d=google.com; s=arc-20160816; b=lhtDAdARQIdWNwqKCfLSegRLFyMrc464M2QCc9QkRyjlZIWTAU6NUSda/dB8HtPhWN 3PwLrmyUbFG6NcvGCO4MwVHLjCI1VVIlE6MzjCQaqUy7cg71tT7VVrMeZwMwk78DgVd3 zdvyys4dMk3zXUDW3rZfdOtMWD7qT1QiSftbzDfZWjUX17iJUoxgApVDNzoM0sU2JMU8 Rvkt1WVDrMK3MpBtFp4s8g056n8390R7A8GdM6J3s7sA4N93Nnfo0OQ5HV2E85BD6c/t HdayNn62dpj9z9i7ohPYRwA2Fuyw+a7L+6m4NEM82Q9sH96pl5bDkzziP6XJ0rKO0XO0 qCfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=A3ahLoA85q8PeppNrGrEryLiSD5jcqCrXgJglP3aB80=; b=sTfG2TlR2o88tluddo5bG3C9oRrb8+rOeScnuBPR+Wp3T2q7pR0j4fNKtsAJxg0haz Y3EbBKss/SaOJSiR9dEkGxRlOWrupDRtSZ0JzEwaD5wbSj4NGzv740NbV0jKafhgf2bn DC5PzapQwc6Ma36x5lCFmA+bFotV2QFcI7b+gCIVRCHSElsV1cDNQlrDuJtac4+Ap+ve zdkke3XlEMK36X3XGj1u0u0E26hPwiEMK+FVuoVe6ZsUpfv3Pa42tR+m3cQ9WBP3VqMa DdCfw5gHgikBcCyigRy1aemRyp7xVtXaE3bI3IdQykZZoc1ZXZV6JysoPuee+YniYjO6 6MRA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si7440818plr.297.2019.03.08.12.26.44; Fri, 08 Mar 2019 12:27:00 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726960AbfCHU0F (ORCPT + 99 others); Fri, 8 Mar 2019 15:26:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36102 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfCHU0F (ORCPT ); Fri, 8 Mar 2019 15:26:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 908287FDE5; Fri, 8 Mar 2019 20:26:04 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-21.phx2.redhat.com [10.3.112.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E27C0600CD; Fri, 8 Mar 2019 20:25:57 +0000 (UTC) Date: Fri, 8 Mar 2019 15:25:55 -0500 From: Richard Guy Briggs To: Ondrej Mosnacek Cc: linux-audit@redhat.com, Paul Moore , Steve Grubb , Miroslav Lichvar , John Stultz , Thomas Gleixner , Stephen Boyd , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH ghak10 v6 0/2] audit: Log changes that can affect the system clock Message-ID: <20190308202555.dj75sfdxxxnckygq@madcap2.tricolour.ca> References: <20190307123254.348-1-omosnace@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190307123254.348-1-omosnace@redhat.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 08 Mar 2019 20:26:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-03-07 13:32, Ondrej Mosnacek wrote: > This patchset implements auditing of (syscall-triggered) changes that > can modify or indirectly affect the system clock. Some of these > changes can already be detected by simply logging relevant syscalls, > but this has some disadvantages: > a) It is usually not possible to find out from the syscall records > the amount by which the time was shifted. > b) Syscalls like adjtimex(2) or clock_adjtime(2) can be used also > for read-only operations, which might flood the audit log with > false positives. (Note that these patches don't solve this > problem yet due to the limitations of current record filtering > capabilities.) > > The main motivation is to provide better reliability of timestamps > on the system as mandated by the FPT_STM.1 security functional > requirement from Common Criteria. This requirement apparently demands > that it is possible to reconstruct from audit trail the old and new > values of the time when it is adjusted (see [1]). > > The current version of the patchset logs the following changes: > - direct setting of system time to a given value > - direct injection of timekeeping offset > - adjustment of timekeeping's TAI offset > - NTP value adjustments: > - time_offset > - time_freq > - time_status > - time_adjust > - tick_usec > > Changes to the following NTP values are not logged, as they are not > important for security: > - time_maxerror > - time_esterror > - time_constant > > Audit kernel GitHub issue: https://github.com/linux-audit/audit-kernel/issues/10 > Audit kernel RFE page: https://github.com/linux-audit/audit-kernel/wiki/RFE-More-detailed-auditing-of-changes-to-system-clock > > Testing: Passed audit-testuite; functional tests TBD Reviewed-by: Richard Guy Briggs How do you plan to test this in the audit-testsuite? > Changes in v6: > - Reorganized the patches to group changes by record type, not > kernel subsytem, as suggested in earlier discussions > - Added checks to ignore no-change events (new value == old value) > - Added TIME_INJOFFSET logging also to do_settimeofday64() to cover > syscalls such as settimeofday(2), stime(2), clock_settime(2) > - Created an RFE page on audit-kernel GitHub > TODO: > - tests for audit-testsuite > > v5: https://www.redhat.com/archives/linux-audit/2018-August/msg00039.html > Changes in v5: > - Dropped logging of some less important changes and update commit messages > - No longer mark the patchset as RFC > > v4: https://www.redhat.com/archives/linux-audit/2018-August/msg00023.html > Changes in v4: > - Squashed first two patches into one > - Renamed ADJNTPVAL's "type" field to "op" to align with audit record > conventions > - Minor commit message editing > - Cc timekeeping/NTP people for feedback > > v3: https://www.redhat.com/archives/linux-audit/2018-July/msg00001.html > Changes in v3: > - Switched to separate records for each variable > - Both old and new value is now reported for each change > - Injecting offset is reported via a separate record (since this > offset consists of two values and is added directly to the clock, > i.e. it doesn't make sense to log old and new value) > - Added example records produced by chronyd -q (see the commit message > of the last patch) > > v2: https://www.redhat.com/archives/linux-audit/2018-June/msg00114.html > Changes in v2: > - The audit_adjtime() function has been modified to only log those > fields that contain values that are actually used, resulting in more > compact records. > - The audit_adjtime() call has been moved to do_adjtimex() in > timekeeping.c > - Added an additional patch (for review) that simplifies the detection > if the syscall is read-only. > > v1: https://www.redhat.com/archives/linux-audit/2018-June/msg00095.html > > [1] https://www.niap-ccevs.org/MMO/PP/pp_ca_v2.1.pdf -- section 5.1, > table 4 > > Ondrej Mosnacek (2): > timekeeping: Audit clock adjustments > ntp: Audit NTP parameters adjustment > > include/linux/audit.h | 29 +++++++++++++++++++++++++++++ > include/uapi/linux/audit.h | 2 ++ > kernel/auditsc.c | 15 +++++++++++++++ > kernel/time/ntp.c | 38 ++++++++++++++++++++++++++++++-------- > kernel/time/timekeeping.c | 6 ++++++ > 5 files changed, 82 insertions(+), 8 deletions(-) > > -- > 2.20.1 > - RGB -- Richard Guy Briggs Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635