Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59C07C433DF for ; Wed, 20 May 2020 16:53:17 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1336620671 for ; Wed, 20 May 2020 16:53:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Xq0UqHy5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1336620671 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-audit-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589993596; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=y1fwy44gf3y7wkwec/zEK6VzjFwVdobKOCYf5dPjVXs=; b=Xq0UqHy5W5DqdpkeiIwDdx6QfiEUv+ZtFovPJKWCjL1jLYL6eDqZA9kWG8NNoucMXHg9tA 9Ax5KjEy2aVVulTTO0Gy/GSeI2gCw8SF071Qos6YI0gH3smkf2BZpgckjpDOF5fjyHNiok sfod1r6kjiuoXXxGSXPAxD/ZGepk+Y4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-LXdEbhQZNuOh3uK3xQfXqA-1; Wed, 20 May 2020 12:53:14 -0400 X-MC-Unique: LXdEbhQZNuOh3uK3xQfXqA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D8E480183C; Wed, 20 May 2020 16:53:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E89BE707C0; Wed, 20 May 2020 16:53:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CBC1F1809547; Wed, 20 May 2020 16:53:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04KGr9dK014840 for ; Wed, 20 May 2020 12:53:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DAF060C87; Wed, 20 May 2020 16:53:09 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB4CE60C84; Wed, 20 May 2020 16:53:03 +0000 (UTC) From: Richard Guy Briggs To: Linux-Audit Mailing List Subject: [PATCH ghak28/ghak25 user v6 2/2] ausearch-parse: mod parser for YAASAO for NETFILTER_CFG Date: Wed, 20 May 2020 12:52:20 -0400 Message-Id: <1589993540-21629-3-git-send-email-rgb@redhat.com> In-Reply-To: <1589993540-21629-1-git-send-email-rgb@redhat.com> References: <1589993540-21629-1-git-send-email-rgb@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: linux-audit@redhat.com Cc: Richard Guy Briggs , eparis@parisplace.org X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Modify the YAASAO parser to accomodate the ghak25 NETFILTER_CFG record. Signed-off-by: Richard Guy Briggs --- src/ausearch-parse.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c index be1d32cdfa5f..cd8632a58ac0 100644 --- a/src/ausearch-parse.c +++ b/src/ausearch-parse.c @@ -173,11 +173,11 @@ int extract_search_items(llist *l) case AUDIT_BPRM_FCAPS: case AUDIT_CAPSET: case AUDIT_MMAP: - case AUDIT_NETFILTER_CFG: case AUDIT_PROCTITLE: case AUDIT_REPLACE...AUDIT_BPF: // Nothing to parse break; + case AUDIT_NETFILTER_CFG: case AUDIT_EVENT_LISTENER: ret = parse_yaasao(n, s); break; @@ -2596,7 +2596,7 @@ static int parse_yaasao(lnode *n, search_items *s) } else return 54; } - // get uid if not already filled + // optionally get uid if not already filled if ((s->uid == -1 && !s->tuid) && (event_uid != -1 || event_tuid)) { str = strstr(term, "uid="); if (str) { @@ -2610,31 +2610,31 @@ static int parse_yaasao(lnode *n, search_items *s) if (errno) return 56; *term = ' '; - if (s->tuid) free((void *)s->tuid); - s->tuid = lookup_uid("uid", s->uid); } else - return 57; + s->uid = 0; + if (s->tuid) free((void *)s->tuid); + s->tuid = lookup_uid("uid", s->uid); } - // get loginuid if not already filled + // optionally get loginuid if not already filled if ((s->loginuid == -2 && !s->tauid) && (event_loginuid != -2 || event_tauid)) { str = strstr(term, "auid="); if (str) { ptr = str + 5; term = strchr(ptr, ' '); if (term == NULL) - return 58; + return 57; *term = 0; errno = 0; s->loginuid = strtoul(ptr, NULL, 10); if (errno) - return 59; + return 58; *term = ' '; - if (s->tauid) free((void *)s->tauid); - s->tauid = lookup_uid("auid", s->loginuid); } else - return 60; + s->loginuid = (unsigned long)-1; + if (s->tauid) free((void *)s->tauid); + s->tauid = lookup_uid("auid", s->loginuid); } - // get tty if not already filled + // optionally get tty if not already filled if (!s->terminal && event_terminal) { // dont do this search unless needed str = strstr(term, "tty="); @@ -2642,31 +2642,31 @@ static int parse_yaasao(lnode *n, search_items *s) str += 4; term = strchr(str, ' '); if (term == NULL) - return 61; + return 59; *term = 0; if (s->terminal) // ANOM_NETLINK has one free(s->terminal); s->terminal = strdup(str); *term = ' '; } else - return 62; + s->terminal = strdup("(none)"); } - // get ses if not already filled + // optionally get ses if not already filled if (s->session_id == -2 && event_session_id != -2 ) { str = strstr(term, "ses="); if (str) { ptr = str + 4; term = strchr(ptr, ' '); if (term == NULL) - return 63; + return 60; *term = 0; errno = 0; s->session_id = strtoul(ptr, NULL, 10); if (errno) - return 64; + return 61; *term = ' '; } else - return 65 + s->session_id = (unsigned long)-1; } // get subject if not already filled if (!s->avc && event_subject) { @@ -2676,7 +2676,7 @@ static int parse_yaasao(lnode *n, search_items *s) str += 5; term = strchr(str, ' '); if (term == NULL) - return 66; + return 62; *term = 0; if (audit_avc_init(s) == 0) { anode an; @@ -2686,9 +2686,9 @@ static int parse_yaasao(lnode *n, search_items *s) alist_append(s->avc, &an); *term = ' '; } else - return 67; + return 63; } else - return 68; + return 64; } // get command line if not already filled if (!s->comm && event_comm) { @@ -2703,16 +2703,16 @@ static int parse_yaasao(lnode *n, search_items *s) str++; term = strchr(str, '"'); if (term == NULL) - return 69; + return 65; *term = 0; s->comm = strdup(str); *term = '"'; } else s->comm = unescape(str); } else - return 70; + return 66; } - // get exe if not already filled + // optionally get exe if not already filled if (!s->exe && event_exe) { // dont do this search unless needed str = strstr(n->message, "exe="); @@ -2722,14 +2722,14 @@ static int parse_yaasao(lnode *n, search_items *s) str++; term = strchr(str, '"'); if (term == NULL) - return 71; + return 67; *term = 0; s->exe = strdup(str); *term = '"'; } else s->exe = unescape(str); } else - return 72; + s->exe = strdup("(null)"); } return 0; } -- 1.8.3.1 -- Linux-audit mailing list Linux-audit@redhat.com https://www.redhat.com/mailman/listinfo/linux-audit