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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_PASS,URIBL_BLOCKED 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 0D5D7C43387 for ; Sun, 6 Jan 2019 07:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5A7821903 for ; Sun, 6 Jan 2019 07:33:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CScwd0NZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726250AbfAFHd6 (ORCPT ); Sun, 6 Jan 2019 02:33:58 -0500 Received: from mail-ed1-f54.google.com ([209.85.208.54]:38746 "EHLO mail-ed1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbfAFHd6 (ORCPT ); Sun, 6 Jan 2019 02:33:58 -0500 Received: by mail-ed1-f54.google.com with SMTP id h50so35165570ede.5 for ; Sat, 05 Jan 2019 23:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=j59FtDlxMZJ5Tx9zpB/C6gEigCo/7WvdUY5UoPYC60w=; b=CScwd0NZoeFk01fftrkWjdlUo0ojmzSt5aG/Cnbe2x808sPBw53jL5mX1TfOc4YOxw 4f8wLrVqJETIXLkgyLcDsgmdG+vukLjSoDuT/JAN9k5Xwvl+iRHP/cMZ+d/W6ruTjdUy H3l1Umn6bJonNNPJ/zUnuL3H2PV4rukZ1cWdCLd7iE+XlamquYCqDCtdrw3zY0QnVku3 Mh3sNQN+/dLUgBYg7+mmMfRkx0PNMKpdjC+8Y0bjEnvORwClpG4xm9+c3sMSbfcrxRag zkrZ3SJJ2Y2wyZH24xLouEfGeyFSLRl+b0tvZTXWWnwaCMdBiVtHflJ530A/ULiEoGVH a2yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=j59FtDlxMZJ5Tx9zpB/C6gEigCo/7WvdUY5UoPYC60w=; b=sLBNYtfRetsck3U5p/u9ScWn0TUY1ZtsXjgY6XREeO5SCnAy0GkYX0qhOcIqDft7n/ 1gNgawn/jQcVKsv78yQPpO/eVwNTJ+0H8Ia6k54inloF7+geNha+PDMJxkIBiMMTNHdd X6CgVhJOuGtO1i+n4AmxyFss0WJriZArYWP7ufiFmiT1ePelirmZT7GCMsWCwQt3Xfl9 IubyyOHmCYEG5/9/M3J9EnaSNRqT4YdAM0UCUqaaSYugaXkwdV3vM79WyogbcSuWGV7b 8Hnth9Ar/wdZznInkVexOi8rcMF6c1vD1leYl5wPeoOq6gVIvt/FRMZxfpr9HMY4/9RJ LNyw== X-Gm-Message-State: AA+aEWbyk5/rhG6UcQyq7ZYdirNoQ4T8dR4ZwJd2iY0L9uNwACnvXolN OypAQwnxwQsGllID1x4OGrNzxRKx X-Google-Smtp-Source: AFSGD/UhTK/w0aVVRh7MFtaxwh4fMl3Dw1AiNTAKNNZfXOvxlq/Jtgdgtbged8fUIh4Iv8huGEh8BQ== X-Received: by 2002:a50:9e43:: with SMTP id z61mr52278007ede.90.1546760035802; Sat, 05 Jan 2019 23:33:55 -0800 (PST) Received: from brutus ([2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id b11-v6sm16499386ejd.16.2019.01.05.23.33.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Jan 2019 23:33:54 -0800 (PST) From: Dominick Grift To: Nicolas Iooss Cc: selinux-refpolicy@vger.kernel.org Subject: Re: nss-systemd D-Bus call caused by getpwent References: Date: Sun, 06 Jan 2019 08:33:54 +0100 In-Reply-To: (Nicolas Iooss's message of "Sun, 6 Jan 2019 00:23:42 +0100") Message-ID: <87lg3y8ckd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Nicolas Iooss writes: > Hi, > While testing the current master branch of refpolicy on Arch Linux, I > encountered the following denial: > > type=USER_AVC msg=audit(1546729287.319:440): pid=312 uid=81 > auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t > msg='avc: denied { send_msg } for msgtype=method_call > interface=org.freedesktop.systemd1.Manager member=GetDynamicUsers > dest=org.freedesktop.systemd1 spid=14828 tpid=1 > scontext=system_u:system_r:sshd_t tcontext=system_u:system_r:init_t > tclass=dbus permissive=0 exe="/usr/bin/dbus-daemon" sauid=81 > hostname=? addr=? terminal=?' > > My OpenSSH server is calling GetDynamicUsers() exposed by systemd over > D-Bus. This call comes from systemd's NSSwitch module and occurs when > OpenSSH calls setpwent() to get information about a user > (https://github.com/systemd/systemd/blob/v240/src/nss-systemd/nss-systemd.c#L676). > How should this be handled by refpolicy? For example, would adding a > call to init_dbus_chat(nsswitch_domain) in a ifdef(`init_systemd') > block be acceptable? This would allow any callers of > auth_use_nsswitch() to be able to communicate with systemd's PID 1 > over D-Bus. FWIW I have this in my nss macro too, However I have two nss macros, one base macro and one superset that has this call amongst others (mymachines resolve etc) I only give nss base access to my confined users since they will never have access to any objects associated with userns uids/gids anyways so they shouldnt get into a position where they need to resolve them (except confined sysadm) > > Cheers, > Nicolas > -- Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift