From owner-freebsd-current@FreeBSD.ORG Fri Jul 17 11:16:09 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39F441065670 for ; Fri, 17 Jul 2009 11:16:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 9A7408FC17 for ; Fri, 17 Jul 2009 11:16:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n6HBG2tv044648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Jul 2009 14:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n6HBG2A4033283; Fri, 17 Jul 2009 14:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n6HBG23d033282; Fri, 17 Jul 2009 14:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Jul 2009 14:16:02 +0300 From: Kostik Belousov To: Jilles Tjoelker Message-ID: <20090717111602.GS55190@deviant.kiev.zoral.com.ua> References: <20090717103438.GB48647@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="V5ypyLxjHkpp0hbI" Content-Disposition: inline In-Reply-To: <20090717103438.GB48647@stack.nl> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-current@freebsd.org Subject: Re: hard links to symlinks X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 11:16:09 -0000 --V5ypyLxjHkpp0hbI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 17, 2009 at 12:34:38PM +0200, Jilles Tjoelker wrote: > In compliance with POSIX.1-2008, linkat() allows creating hard links to > symlinks. This means that it is a much worse idea to trust a symlink > just because it is owned by a trusted user (if it is in a directory > writable by other users). Security issues like > http://archives.neohapsis.com/archives/postfix/2008-08/0391.html now > affect FreeBSD 8 local filesystems as well. >=20 > Given that Linux and Solaris have allowed this for a long time, I think > this functionality should remain, but it should probably be mentioned in > the release notes. The security.bsd.hardlink_check_uid sysctl can be > used to avoid vulnerabilities. >=20 > By the way, the man page erroneously says the AT_SYMLINK_NOFOLLOW flag > should be set to have linkat() follow symlinks. The standard and the > implementation are correct, AT_SYMLINK_FOLLOW; the AT_SYMLINK_NOFOLLOW > flag is not valid for this function. Please commit the fix. >=20 > Note that the link command and the link() function always follow > symlinks (this is POSIX.1-2001 and POSIX.1-2008 compliant), and the ln > command will not create hard links to symlinks either. Hence, people may > think it is not possible (the check in the Postfix advisory will not > detect FreeBSD 8's capability). >=20 > I have a patch to add the POSIX.1-2008 -L and -P options to ln, making > it possible to choose the desired behaviour (follow/don't follow > symlinks). I think this is too late for 8.0, however. You can make it in before BETA3, in my opinion. --V5ypyLxjHkpp0hbI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpgXXEACgkQC3+MBN1Mb4iNYACgyLZUBb4LAq5KmL8XKCohtl0m TugAoK/ZWlTETYI68ir+8WJs3/FNmnxi =E7Tg -----END PGP SIGNATURE----- --V5ypyLxjHkpp0hbI--