Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2059580ybi; Thu, 20 Jun 2019 08:27:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHLEA5SSSqjaAOyqzNrpqm8JdQ7G20CtJMQr4W22FwSTb8OCvipliVGTJGQd202GupwAxt X-Received: by 2002:a63:8b4c:: with SMTP id j73mr2804723pge.11.1561044459554; Thu, 20 Jun 2019 08:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561044459; cv=none; d=google.com; s=arc-20160816; b=oMPWS2sh7R9b9SguTzFQIY5YSczYemiNXk0f83fvdVXo7MF9laTRDZt8Nh37tGcFoD My9jsLmTL3CmcZmSBe37J6fCdBFvSCn0fZMs3iThuLdD9bZFqPGtpwwLUuxqmB0NefxL z0BfHfGrRvSs4sARFJQzFMO+IyeVmfO6FnG2ic6wLshzLSyI1R8JiFdREeMVDSYBanoj 5he3W8uOBfUzJo66bqQIq9fTy+aAIMz5Pm7YC0cLpW+vPPxJkXt8s7Vc4ueahQ+8szSD ADS9Ch7uGvVZYt8F6m5FPa3KTfQ7QLow0IB1WkiFDw1id8qJyzjc+uzr8/B2l4Y6k0Ix O0/A== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=psixLgESEdZamU61XPWQRr362sP8bsDhBW6/p8fd1+0=; b=V0DbfN/q0/k+YCJZywssUu99lBE2zJ2lopa4h676PyVWlXwUnJZR5KtF+ze2bnhp7s CrIbQSjjOkBUpeRBf/W1GO/EGQOyqsM7ifTRfN0WNGUfPUJeb1pwt3kxl5IE4ciGxDmt mDU0S30YqX8rR4HKocIk8Uv/DwWX3/pRvAthySM2Vwxz6ospnw4qwR5Drg4uPRry642/ qxwc4OxI6K1NUDJiFQByegBI7lsKqxNKDI6vyeASeh8pJqc9ftp6OsxYhunx65PP7wVY L/6o9Rdx1bV8ki/kpz/NCKPu7kj/wXqXUqa/RCMZ50DtZYvmAras4Pl6ltqQ+a0KKryX P71Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j+xTcnfJ; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g29si6223086pgl.503.2019.06.20.08.27.36; Thu, 20 Jun 2019 08:27:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j+xTcnfJ; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbfFTP1g (ORCPT + 11 others); Thu, 20 Jun 2019 11:27:36 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:38506 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbfFTP1g (ORCPT ); Thu, 20 Jun 2019 11:27:36 -0400 Received: by mail-ed1-f65.google.com with SMTP id r12so5301026edo.5 for ; Thu, 20 Jun 2019 08:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=psixLgESEdZamU61XPWQRr362sP8bsDhBW6/p8fd1+0=; b=j+xTcnfJ9MCh6eZHoSuVXuPdQPGqlh+hfnci8GCc4+K3iKoXUVlRVN+4FmJusPOfj8 p3GMRsu6skqI2iAjzA0kXtoi0D+pebEpXkgx7gNsn6OEH5KDO/pY/1LZYgszKyXBfObk s7tefLzaEAG+IFbhRnq7nf2ezd0InzgQs3lXeL++D7khnYkY6eJmh5B3xfM4XhPrUv8U L2F1fSgp3PzRyPnxtnaC5Odv3Ro99UChz3W24IGkmt8kdc61V/38EbFUWUniBBvZbrnb JqgXKzi2V2gDx5jtuH80GPPvbk9OKMLbj+RdlhtL7gppjL2YA7hCpl2x5yJm4re7tKie v+7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=psixLgESEdZamU61XPWQRr362sP8bsDhBW6/p8fd1+0=; b=J8zkiYe4GOdGcO8hU5QWfj5W5Jz9XYjy336hEERj4a/+EAXhcQe2rg3PbfTEn/PGi9 jVyblieUT8Bte8yTZUXdd50KnZ/EzW8q4yqgWG7MJDsZNMuru0lLTmt6qAGijhwjFfYr m3B4pOtvqCm8VVkqpfZCzB/OsJPG167t+0S2WNiBPQ8BZGEAYkqoYTlgBL7CjtTqVSLs Eb7cB50jrpkJPRUESzLHIk4RsBSa/Rs98bFQA1Ar1tzJ6M4CrhrOzJzC9f/cvzbojDYW zfKdL9EXePeYmgBCpG+CkGkJt9JzqlZAl5Fcrn6LBye5hY6wsHboi/GtoqHFN2iFULan GrvA== X-Gm-Message-State: APjAAAX9bMFSJAv09DqdfhBoRVIlcD0V46K/Bvmw2vByOG/luRg1bX8P 6Vhs3rhwrHap3NAE7lJIBaKkcbrg X-Received: by 2002:a17:906:5042:: with SMTP id e2mr44452573ejk.220.1561044454189; Thu, 20 Jun 2019 08:27:34 -0700 (PDT) Received: from brutus.lan (brutus.defensec.nl. [2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id f3sm3862863ejc.15.2019.06.20.08.27.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 08:27:33 -0700 (PDT) Date: Thu, 20 Jun 2019 17:27:31 +0200 From: Dominick Grift To: Alexander Miroshnichenko Cc: selinux-refpolicy@vger.kernel.org Subject: Re: [PATCH v2 2/2] ssh: Add interface ssh_search_dir Message-ID: <20190620152731.GD2647@brutus.lan> Mail-Followup-To: Alexander Miroshnichenko , selinux-refpolicy@vger.kernel.org References: <20190620144138.15172-1-alex@millerson.name> <20190620144138.15172-3-alex@millerson.name> <20190620145011.GC2647@brutus.lan> <642ea6d9-97c9-4ec4-a7ed-84995a953b48@millerson.name> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/unnNtmY43mpUSKx" Content-Disposition: inline In-Reply-To: <642ea6d9-97c9-4ec4-a7ed-84995a953b48@millerson.name> User-Agent: Every email client sucks, this one just sucks less. X-PGP-Key: https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org --/unnNtmY43mpUSKx Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 20, 2019 at 06:05:57PM +0300, Alexander Miroshnichenko wrote: > On =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 20 =D0=B8=D1=8E=D0=BD=D1= =8F 2019 =D0=B3. 17:50:11 MSK, Dominick Grift wrote: > > On Thu, Jun 20, 2019 at 05:41:38PM +0300, Alexander Miroshnichenko wrot= e: > > > Create interface ssh_search_dir to allow ssh_server search for keys > > > in non-standard location. > > >=20 > > > Signed-off-by: Alexander Miroshnichenko > > > --- > > > policy/modules/services/ssh.if | 18 ++++++++++++++++++ > > > 1 file changed, 18 insertions(+) > > >=20 > > > diff --git a/policy/modules/services/ssh.if > > > b/policy/modules/services/ssh.if > > > index 0941f133711e..51c64ded00c4 100644 > > > --- a/policy/modules/services/ssh.if > > > +++ b/policy/modules/services/ssh.if > > > @@ -680,6 +680,24 @@ interface(`ssh_agent_exec',` > > > can_exec($1, ssh_agent_exec_t) > > > ') > > > +######################################## > > > +## > > > +## Search for keys in non-standard location > > > +## > > > +## > > > +## > > > +## Domain allowed access. > > > +## > > > +## > > > +# > > > +interface(`ssh_search_dir',` > > > + gen_require(` > > > + type sshd_t; > > > + ') > > > + > > > + allow sshd_t $1:dir search_dir_perms; > >=20 > > This is generally not allowed. The caller should generally be the sourc= e. > > Regardless of the above. Keys should be in user home directories. I > > wonder what specific scenario prompted you to propose this interface? >=20 > GIT hosting software like gitolite/gitosis/gitea manage users ssh keys and > store them own location like /var/lib/gitolite/.ssh . /var/lib/gitolite h= ave > gitosis_var_lib_t type, /var/lib/gitolite/.ssh have gitosis_ssh_home_t ty= pe > (in patched policy which I want to submit). > If sshd does not have { search getattr } permissions to full path to ssh = key > user fail to login. > Can you propose corret way to give such permissions to multiple policies? > It is incorrect to label /var/lib/gitolite as user_home_dir_t type, IMHO. Yes this sucks. I would probably do the following instead: 1. echo "ignoredirs=3D/var/lib/gitolite" >> /etc/selinux/semanage.conf 2. semodule -B && restorecon -RvF /var/lib/gitolite 3. gitosis_read_lib_files(sshd_t) Dont bother with labeling /var/lib/gitolite/.ssh differently >=20 > > > +') > > > + > > > ######################################## > > > ## > > > ## Read ssh home directory content ... > >=20 >=20 --=20 Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 Dominick Grift --/unnNtmY43mpUSKx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAl0Lpd8ACgkQJXSOVTf5 R2lyfwv/XK4RGNoBgmZSJkLJoaNcVtviVjZjH+DEMUzJaHBLkC4yinW5bpEFOXI+ 9n0sG89qKGrVj2jvB1qCYU9v02zCrWFnUHwISP4qzcLfGNYxR8/OrmM9LuTeN4fQ PD0PU+CyCjp+p+WTMaDS1ASS5oe9WdTU9nwvIEHSNnjWYj9Tjx38EdhKoyayZXNf d1FziYMRZUBsCInhhqNJsW65hyeZkNbKoUe4OLF5kGkuvRqXjWYP4B7VrW+uCXaS DifeIX+J2jrb7SLjt3+YdgRMoUjOrlxCZ37DgyfeXwyRHQhQzbYDrI5FYzdAI5lF 9RnCtzpMvLfawcNZm0AjKJE0hC+nt6NJc/UMvlP6vAURShvY8GNbAjhONfauoVcA 2vNcpXcX41yI7T3Blw/mKpQya5m4pq/NlgAxealuyRogIZh9bn6e6rjypBcifuuF ylddD8Fxr4HzYLa77soxJudFI/xB24dBfW9p/A2z73n1L49NK8+pviLQun5fvnC0 8qxA4YmY =qbJn -----END PGP SIGNATURE----- --/unnNtmY43mpUSKx--