Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2072314ybi; Thu, 20 Jun 2019 08:40:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzL9aJU+NOFLbvdmsba69N44MfpSDYwQiGMOevG2F1zVkJFdm5CBSE93EEPwswUAfV5dhuh X-Received: by 2002:a17:90a:cb97:: with SMTP id a23mr231672pju.67.1561045237738; Thu, 20 Jun 2019 08:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561045237; cv=none; d=google.com; s=arc-20160816; b=KaXbm8jany97FIDS72/kNcW5SU00cLgYwOBURfRZqohmfrsYprL8ymRmmVW+d9Yz7u bri3T/Dqb1nT4nMvDC/NLuAq4aoHnSB5rDHPVXQSCnXSGFcY1yhAUvChXXJICp8iqKGL QZHqqnmOj+wmrXaLeNveVePowhJa28lgay5BhcO6GTUB++Ne9L36PjvkQfqpl2K4gnaQ 78r90JJiFDdJM6yiwK3YrPO2VLyqIgAyvXSdX5SqgejH0AxUPFRyIWmUcwUmLIRGP0rD pPDEypOM1NJ75HAdi/xSr5U4iKDpaUYmojO2TgrEkfBqaTvVXt2C4wioS2hTR7+oihJO 5PAQ== 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:to:from:date:dkim-signature; bh=ItBiEftcyIrxKvLEmJl0ve+kvPFxh9g/aUvB84xPocI=; b=QxNrpB8+z3tZhw17saS1d8HJTHc/ngnX/SoCpC7ILrV9SHHJdXFPqoKsGURjzgGltg qICwtPyKt3Ne10py7+T5FWzPOCyztR++fKuNm7bIoHQfeeAuSZUC+C43j9K0YdPfEVk2 gwnyQRsPNP5UkK2ipSuwfTmy52CYjCnJO6b3oZiJElLBXe4AVUtRH0i85QaijpcxprJn NE3+TPQqzE3jFFjlAqiPuzryc0jsQfd0GW6FTxNhEmVpaXGRGzjv96B60UD2X4A2ohSW H6hlP17BJHYysdgVlkL9de884Rvz+y42gX5HC19Zl7131tT/HQ7wvsNLlfpCOo9SivvO cC/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PWIV/SFa"; 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 n15si19015plp.354.2019.06.20.08.40.35; Thu, 20 Jun 2019 08:40:37 -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="PWIV/SFa"; 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 S1726675AbfFTPk0 (ORCPT + 11 others); Thu, 20 Jun 2019 11:40:26 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:41508 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbfFTPk0 (ORCPT ); Thu, 20 Jun 2019 11:40:26 -0400 Received: by mail-ed1-f66.google.com with SMTP id p15so5325313eds.8 for ; Thu, 20 Jun 2019 08:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ItBiEftcyIrxKvLEmJl0ve+kvPFxh9g/aUvB84xPocI=; b=PWIV/SFaC5/nPKtyTkdundKJA4p2efpYMyioD6+QA46APvLnyOC2lhh+7mOsmjA7A2 Okp8oylHryPybTu/trmflA13b+SlPzHX3WUlwIjleVuIeEyyGOTqLGpS1L4AYNf8j3VP GGDuoJP+QlqOJtePY3ndZ39wEiL9vijCv6S6xNVVQ7ctFCrfsrIVumJBDPfgaroeBCDv AXKv5mLDxJgI/l1/6/HiVdvXSHZL1GyEVRwP2bcO0UJI595cZIogWYHsf+fcI6g9xcgT QSY3Mi4l/3BGt4IkIMVkY2IMnsju+jj2pQ5sufoTcHUBwwRU+aH2PCBi1oEVa5/YzjVC 25mA== 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:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ItBiEftcyIrxKvLEmJl0ve+kvPFxh9g/aUvB84xPocI=; b=BRKUjIfoKnzl4/0Fcv0mLm/Xun+awHD1RN8fmFxIBOVGeX+2mLbx3vUeqGikudPvPC QmpuzMfbPdbzcZQc1eceKDtK7hv8QQmFNiFq2a0205nl/HLKyKkNKXxa/Qv6BJFQk9wN 7iuiqPkLjbgG9XWbSNckdBF2bT3/XyWZRWaBsLFBlYDw/QlEoihmxVL+hIoEAIHHhaBb iUXTl6OrRqkZUa6DFgKT5QmZW08uLVIs9DN1atIjf1bXVyIO0bwa6DYEMEHGd/NXVj5s RUxA60ztwKG71gIpkoX5XiHTl5kUycdVG5GQXfLOiarVHUAhJWqqd21hWVRK3cZokSZt fWqQ== X-Gm-Message-State: APjAAAWTQEy0WDQSCLz7mzb/7EjKQeDJSgwK5j/f2LcpJyccj1NGffbC W3fIdxkiHBBpsul4pZSLvPs= X-Received: by 2002:a50:ba1b:: with SMTP id g27mr119397447edc.18.1561045223684; Thu, 20 Jun 2019 08:40:23 -0700 (PDT) Received: from brutus.lan (brutus.defensec.nl. [2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id f10sm4978374eda.41.2019.06.20.08.40.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 08:40:22 -0700 (PDT) Date: Thu, 20 Jun 2019 17:40:21 +0200 From: Dominick Grift To: Alexander Miroshnichenko , selinux-refpolicy@vger.kernel.org Subject: Re: [PATCH v2 2/2] ssh: Add interface ssh_search_dir Message-ID: <20190620154021.GE2647@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> <20190620152731.GD2647@brutus.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OZkY3AIuv2LYvjdk" Content-Disposition: inline In-Reply-To: <20190620152731.GD2647@brutus.lan> 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 --OZkY3AIuv2LYvjdk Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 20, 2019 at 05:27:31PM +0200, Dominick Grift wrote: > 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 wr= ote: > > > > 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 sou= rce. > > > 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= have > > gitosis_var_lib_t type, /var/lib/gitolite/.ssh have gitosis_ssh_home_t = type > > (in patched policy which I want to submit). > > If sshd does not have { search getattr } permissions to full path to ss= h key > > user fail to login. > > Can you propose corret way to give such permissions to multiple policie= s? > > It is incorrect to label /var/lib/gitolite as user_home_dir_t type, IMH= O. >=20 > Yes this sucks. I would probably do the following instead: >=20 > 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) >=20 > Dont bother with labeling /var/lib/gitolite/.ssh differently But this is just what I would do (if were ever forced to use gitolite). Oth= ers may have different opinions. >=20 > >=20 > > > > +') > > > > + > > > > ######################################## > > > > ## > > > > ## Read ssh home directory content ... > > >=20 > >=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 --=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 --OZkY3AIuv2LYvjdk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAl0LqOEACgkQJXSOVTf5 R2kuHQwAh4bksW239Df8C3PkKF0ypIN18lgz/Q2qLIxn9L2OJ/RZe9sVjmrav0Gg PX+qFPxp7cuKVOZXbtrjDIHw/NOjQUi/TzdPUr10srMRaDqURtTpWkQvNtbOiqcJ ceiSr6/u2T0OSAwwzfh0Rx15NRU0uClDu6z3Z91aVT2Ve69qU4odWIvutdmld1Lx 1Tdj0AUEEJufkDZRTVYL1Aj0jiLfgztPsIaoAjAK4NjeVeW0mAuWOW62wxZZywWB dr1tWgXUz75UC0fYt4AE7tq0gNJfRDYdnU1l2i2R+4c7Pn4aAeW34t1vmUznA1DK C8se4qpoiP5xZTBLW8Mdnk9Q5yK/VeRqTQrRL7XO55PBCmi89adIs6mzUjLeqkZi PyEPjJGdECAFxO+ESEGzU0PnAbSQyA5fcAmmttikHKWcJeCy/gSZ2iroD6vE+cFB pRihUJC9IKN1QV9VY/Xl5JR0cUNKuyKoK4QXwh6ScNY9Khg/VTkx+JIPBzd/xNkZ ZH1l+v+V =KMD2 -----END PGP SIGNATURE----- --OZkY3AIuv2LYvjdk--