From owner-svn-src-all@freebsd.org Thu Oct 3 20:45:53 2019 Return-Path: Delivered-To: svn-src-all@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 7B9B91403A5; Thu, 3 Oct 2019 20:45:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46klQT2gchz4j6S; Thu, 3 Oct 2019 20:45:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BEB419B9E; Thu, 3 Oct 2019 20:45:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x93KjrYq075740; Thu, 3 Oct 2019 20:45:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x93Kjrbr075739; Thu, 3 Oct 2019 20:45:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910032045.x93Kjrbr075739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 3 Oct 2019 20:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353070 - head/usr.sbin/certctl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/certctl X-SVN-Commit-Revision: 353070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Oct 2019 20:45:53 -0000 Author: kevans Date: Thu Oct 3 20:45:52 2019 New Revision: 353070 URL: https://svnweb.freebsd.org/changeset/base/353070 Log: certctl(8): let one blacklist based on hashed filenames It seems reasonable to allow, for instance: $ certctl list # reviews output -- ah, yeah, I don't trust that one $ certctl blacklist ce5e74ef.0 $ certctl rehash We can unambiguously determine what cert "ce5e74ef.0" refers to, and we've described it to them in `certctl list` output -- I see little sense in forcing another level of filesystem inspection to determien what cert file this physically corresponds to. Modified: head/usr.sbin/certctl/certctl.sh Modified: head/usr.sbin/certctl/certctl.sh ============================================================================== --- head/usr.sbin/certctl/certctl.sh Thu Oct 3 20:39:17 2019 (r353069) +++ head/usr.sbin/certctl/certctl.sh Thu Oct 3 20:45:52 2019 (r353070) @@ -74,11 +74,21 @@ create_trusted_link() create_blacklisted() { - local hash + local hash srcfile filename - hash=$( do_hash "$1" ) || return - [ $VERBOSE -gt 0 ] && echo "Adding $hash.0 to blacklist" - [ $NOOP -eq 0 ] && ln -fs $(realpath "$1") "$BLACKLISTDESTDIR/$hash.0" + # If it exists as a file, we'll try that; otherwise, we'll scan + if [ -e "$1" ]; then + hash=$( do_hash "$1" ) || return + srcfile=$(realpath "$1") + filename="$hash.0" + elif [ -e "${CERTDESTDIR}/$1" ]; then + srcfile=$(realpath "${CERTDESTDIR}/$1") + filename="$1" + else + return + fi + [ $VERBOSE -gt 0 ] && echo "Adding $filename to blacklist" + [ $NOOP -eq 0 ] && ln -fs "$srcfile" "$BLACKLISTDESTDIR/$filename" } do_scan()