From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 045F0138334 for ; Thu, 5 Dec 2019 23:52:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 77382E0942; Thu, 5 Dec 2019 23:52:17 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 41C2FE0942 for ; Thu, 5 Dec 2019 23:52:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6948234D81D for ; Thu, 5 Dec 2019 23:52:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AA5B38D7 for ; Thu, 5 Dec 2019 23:52:12 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1575473602.e1cc1a18a5e3202394cd579eaa6230b5750d84f4.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_determineargs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: e1cc1a18a5e3202394cd579eaa6230b5750d84f4 X-VCS-Branch: master Date: Thu, 5 Dec 2019 23:52:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ab55978d-4b8a-4978-bcb9-bd80b535cafd X-Archives-Hash: 4d60df8a4ae8ca8e00cc5dd173ee428c commit: e1cc1a18a5e3202394cd579eaa6230b5750d84f4 Author: Thomas Deutschmann gentoo org> AuthorDate: Wed Dec 4 15:33:22 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Dec 4 15:33:22 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=e1cc1a18 gen_determineargs.sh: determine_real_args(): Adjust authorized_keys file validation Using "-s" is not enough, file could be a directory. Better check for content! Signed-off-by: Thomas Deutschmann gentoo.org> gen_determineargs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 9e46576..0fd24d5 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -847,9 +847,9 @@ determine_real_args() { elif [ ! -e "${ssh_authorized_keys_file}" ] then gen_die "authorized_keys file '${ssh_authorized_keys_file}' does not exist!" - elif [ ! -s "${ssh_authorized_keys_file}" ] + elif ! grep -qE '^(ecdsa|ssh)-' "${ssh_authorized_keys_file}" &>/dev/null then - gen_die "authorized_keys file '${ssh_authorized_keys_file}' is empty!" + gen_die "authorized_keys file '${ssh_authorized_keys_file}' does not look like a valid authorized_keys file: File does not contain any entry matching regular expression '^(ecdsa|ssh)-'!" else declare -gr DROPBEAR_AUTHORIZED_KEYS_FILE="${ssh_authorized_keys_file}" fi