From owner-freebsd-pkg@freebsd.org Sun Jul 5 11:16:09 2020 Return-Path: Delivered-To: freebsd-pkg@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A98B2368D1F for ; Sun, 5 Jul 2020 11:16:09 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4B05jj3BGTz3YsY for ; Sun, 5 Jul 2020 11:16:09 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 6B5DD368D1E; Sun, 5 Jul 2020 11:16:09 +0000 (UTC) Delivered-To: pkg@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A148368D1D for ; Sun, 5 Jul 2020 11:16:09 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B05jg2rHWz3Z1y for ; Sun, 5 Jul 2020 11:16:07 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x744.google.com with SMTP id c30so28580660qka.10 for ; Sun, 05 Jul 2020 04:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=84k2orqTF+VBXdr5oGxZZ6j/rZZ69uKzfGxaYPtNCyw=; b=P3DZdClk5t3qjRlBWTIuOZWspgCtTJM6unU7+AqxXishNdIsfeo13NsugD8GwAh5lL MQo79e5z07MNL21F7EI6tg4+fDZ4/Ica/PExm0yvgXPMcQW0RJ6Rbe8tAQPIRq3b+bT0 VZTaefS5A0hn+ioIrDYAMICqIWYXprNnwRyA8yk53LfAqA3p0EHnVajBo+kQstGQpYA6 2p4Q1San/QRvNKvDAObWmCurBuzc7jXBs2NvkORuDT+8V7ixdm0YT6VTzWwkrG8OVZ0H cskVOyegcbR9aJ/VKjAtwDqppZ4EtUFYrGyWCCAZyYq6M+gndPmu+bSFJQP8MgMdpqP1 FPMw== 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:references :mime-version:content-disposition:in-reply-to; bh=84k2orqTF+VBXdr5oGxZZ6j/rZZ69uKzfGxaYPtNCyw=; b=fnpBTYIlMKrKFpt5zltgYnqGoBk9A9iLsoT6pI4wTB78XmaeZ2WSK2tzqvn3jnXOUp /xVynnflg3dqD0TMm5aibwh2PPa7fe9xrMrC6uQQnBkBjg8Om4zpF25nZldYjJuCnuGd Nn/n5anICzHVBV1kICqtldHyd+KMFZX2j/S6iNu7PeOWoS8TdtHgRPOl6ZWMawnT5nz2 DZRKBVMFTPQses0E+dcYYVmqk/0PKY6Hd7RHQ5mb1CH2BN9CJ9JY0T4fk7aWAWPt6gMF M2JTWfx6u+yg9M32jDjgMSt8MAvVTXQ5fOkxPL9wZL+4zEqNNbhrpOSVv0pU4+TmHxoa U8sQ== X-Gm-Message-State: AOAM530j/u2yHaFXK7WqckQsi0oYRD4Ly4t2e1PAwR1R/xXU1UTRnQn9 oNmzdvYN0Oyzfw17xP5N80Cb4g== X-Google-Smtp-Source: ABdhPJyn65wczgJnPmzKwVo78s0IajMKDC3GTNypDHocsJQoXa+sAZOLwvb3ztgTJpRVH5BWX5T5Ag== X-Received: by 2002:a05:620a:1305:: with SMTP id o5mr36024681qkj.59.1593947766186; Sun, 05 Jul 2020 04:16:06 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-231-224.bltmmd.fios.verizon.net. [100.16.231.224]) by smtp.gmail.com with ESMTPSA id t36sm17774796qtj.58.2020.07.05.04.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 04:16:05 -0700 (PDT) Date: Sun, 5 Jul 2020 07:15:38 -0400 From: Shawn Webb To: Baptiste Daroussin Cc: pkg@freebsd.org, dev@hardenedbsd.org Subject: Re: Filesystem extended attributes support Message-ID: <20200705111538.axuh3ohdpqkb74ym@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <20200704141345.xwdf2ckxak2hfpkh@mutt-hbsd> <20200704201100.lkcde42gtlgspwpr@ivaldir.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="722nrty244veuwai" Content-Disposition: inline In-Reply-To: <20200704201100.lkcde42gtlgspwpr@ivaldir.net> X-Rspamd-Queue-Id: 4B05jg2rHWz3Z1y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=P3DZdClk; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::744 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.14 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-0.99)[-0.987]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[pkg@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; NEURAL_HAM_LONG(-1.03)[-1.026]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.02)[-0.023]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::744:from]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[100.16.231.224:received] X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jul 2020 11:16:09 -0000 --722nrty244veuwai Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 04, 2020 at 10:11:00PM +0200, Baptiste Daroussin wrote: > On Sat, Jul 04, 2020 at 10:13:45AM -0400, Shawn Webb wrote: > > Hey FreeBSD pkg(8) developers, > >=20 > > Attached is a patch that implements filesystem extended attributes > > support. Only the system namespace is supported. In case the patch > > gets scrubbed from this email, I've posted it here: > > https://gist.github.com/d0b4653bc5942dbcdcd1db877d37c2dc > >=20 > > Anyone who wants to write unit tests is welcomed to do so. > >=20 > > This patch to pkg does depend on a separate patch to libarchive: > > https://github.com/libarchive/libarchive/pull/1409 > >=20 > > HardenedBSD has a separate patch to tmpfs that enables incredibly > > basic extended attribute support. The tmpfs patch is only needed for > > those who use tmpfs with poudriere. > >=20 > > And finally, another patch to the jails subsystem that allows a > > privileged user within a jail to set system namespace filesystem > > extended attributes (disabled by default) is needed for poudriere > > users. > >=20 > > The patch to tmpfs and jails is not included here as they are > > tangential. >=20 > Thank you for the patch at quick glance it looks fine to me. I would have > obviously to wait for libarchive to merge the patch first to be able to t= est it > and do a proper review at the time. >=20 > Don't hesitate to ping me again if you see no progress with libarchive has > merged the said patch. >=20 > I would have to rework it a bit probably: > - Add a configure detection of the fact libarchive does or not have the > necessary support > - Add regression tests to ensure I don't break this in the future. > - Maybe add an option to enable/disable it via pkg.conf (not sure yet abo= ut > that ;)) Sounds good. Thanks for the positive response. I might try to upstream the tmpfs patch as well, but I'm not sure I've got the locking right, yet. It's my first time working on a filesystem of any sort, and I'm not confident I got it right on the first try. Time will tell. With extended attribute support, pkg could also store a hash of the file as an extended attribute. One could use that as a method to determine whether changes have been made. Think: application integrity enforcement. So filesystem extended attribute support may have virtues outside of HardenedBSD's exploit mitigation toggling use case. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --722nrty244veuwai Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl8BtlQACgkQ/y5nonf4 4fpq3w/+MO9tvFnIhtZT/NUIBH019bZ4LOWlFI0MT5IYigrXon51mdKyMUSUrtu0 YEb5lklPilPm3lg2FNEb5dXXjktfNDYg9iCpde3MazPmGpyQJJbvJWpgRCFfiKQG bmtyA/7FY1VPy4s4qgrFQtOK7xUl7xzoxtcqnYL2Jnub8hqdc71ZE/xI6SgSCL+q 0Z+rOQc67iuSaGNQqmAhx+nDQi0mGv/qzt213/o7olwGDmacRUsGfw089eCHCD1N i0RN7yk9BszEOg021+PD1/CTe4mfPps4PtM4g/qk6BfrvQ3eACKjWK1ew5FLZ18J qpSbeIMcAXM0A57CsM1YvNKxxvzb8/CWUBrr6SjIypT2N8JaU6DD7328cZz+Hfpp ss6o7hUdDBV2LCfS9HBri2Fmm/B5m7Qci08PSu1q24nTG7r+mSbCN3CVAYP7dRT9 zigxkNiZMuICCaT7k8akuDSv7xTjhqAZQnr5o2Dtdj27jX1iZOepCLcbX7IQg4wY fXquds/S4RBf5dSEbE/C7BXSQ/xtaGY8EyzegHXeV8OHaZZzpKycO4zLiNAmbinr wJ6uscd/SguiG2GZ2sddME16g+xkMZtN+Tirc+WBYLGLD6BRuIYF0lqt6yqkrWne zz+0k5lD16deotN3MFJ7rWHTf0mF/bqj5wGL0NMmASuYBxIJTnw= =gp6m -----END PGP SIGNATURE----- --722nrty244veuwai--