From patchwork Mon Sep 23 17:18:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988673 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RfKU61KU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8sj2fRhz1xsp for ; Tue, 24 Sep 2024 03:21:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bGLHRBnQi2UMq/E2Sy9vkTwMaw5o7OcvYvJUe+vSjX8=; b=RfKU61KUrMwiYG YVETFDUd6NTdEz711/m20KqqWmMjVlwzc5qT922SU8OC4uAtOcKP/K//wvaPJoa/ncN+AfJsf6ji+ 7zSaxqK1UcHtjGX/dxYfTpD7W5HYD39JMnpzCbL6C0f/fgcQtnlsy5BcErJgiIV7BhKoF5k1iTTIY HU74PzRh5Cv3JARZF6hn+kFOoFpGEOyEmqvF3g2ADHiz/boODE1yi5SwufSLWoTclj3ZfFaKk9IX6 XzzLvD2I/2pM48k9dhK3E2Y2f6b3RKE2iQnC8pOB7CNVWAhBpKjodzse48gPAQLfJK9d8OBWYYLRf gOuZF55zy6aGLYJ1oNRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmi3-000000006xI-38Mm; Mon, 23 Sep 2024 17:18:52 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006ru-39Ps for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:41 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhl-00HS5P-0z; Mon, 23 Sep 2024 19:18:33 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Cc: Daniel Golle Subject: [PATCH 01/11] base-files: uci-defaults: allow setting wireless defaults Date: Mon, 23 Sep 2024 19:18:15 +0200 Message-Id: <20240923171825.148902-2-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_846969_3B3CC539 X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Daniel Golle Introduce new uci-default functions: - ucidef_set_wireless band ssid [encryption] [key] - ucidef_set_country cc They are supposed to be used in /etc/board.d/* scripts to define board-specific defaults for wireless. Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Daniel Golle Introduce new uci-default functions: - ucidef_set_wireless band ssid [encryption] [key] - ucidef_set_country cc They are supposed to be used in /etc/board.d/* scripts to define board-specific defaults for wireless. Signed-off-by: Daniel Golle Signed-off-by: John Crispin --- .../files/lib/functions/uci-defaults.sh | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index b89cc8e9e3..ba7288c2c6 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -642,6 +642,41 @@ ucidef_set_hostname() { json_select .. } +ucidef_set_wireless() { + local band="$1" + local ssid="$2" + local encryption="$3" + local key="$4" + + case "$band" in + all|2g|5g|6g) ;; + *) return;; + esac + [ -z "$ssid" ] && return + + json_select_object wlan + json_select_object defaults + json_select_object ssids + json_select_object "$band" + json_add_string ssid "$ssid" + [ -n "$encryption" ] && json_add_string encryption "$encryption" + [ -n "$key" ] && json_add_string key "$key" + json_select .. + json_select .. + json_select .. + json_select .. +} + +ucidef_set_country() { + local country="$1" + + json_select_object wlan + json_select_object defaults + json_add_string country "$country" + json_select .. + json_select .. +} + ucidef_set_ntpserver() { local server From patchwork Mon Sep 23 17:18:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988670 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ACXykZM4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8sH0qplz1xsg for ; Tue, 24 Sep 2024 03:20:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GJjvZvIc21sctzMNNPGfkxMywM3fi6TA8aq9NkFiG0o=; b=ACXykZM4jbE6ED Pmg1B8iMqDn+srfAmUiZ31J08IsOwZSFF8vWU+XpBL13dWsbhxM+MGvOdzcfykGhHSKVlcNkkigxB nXopJHdVBLqeLklVOnz+mSs9flhWl0692ma6hqUEoHI9kREchspkGzHSe+XgrtXl9qk+w9dsZVw09 AALV3XQlktJwO36yQCtbhGAi0hMlvNkkD/4YZTUbF3aNS43f+p7XneEoBpEqOK9gcaBrDVC3sQ6RC qAA9EZ3Os8k9dEgwt1Bs0/Ib4fi72EA/QpxQNhOjQ05ZyhnmmKhgc2zHnnis3BmySx0eCR9DBx2Lb RcTzgGUnXQmaepdB14hA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhw-000000006vU-3slJ; Mon, 23 Sep 2024 17:18:44 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rR-1uxJ for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:40 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhl-00HS5P-1W for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:33 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 02/11] base-files: uci-defaults: allow setting default credentials and ssh keys Date: Mon, 23 Sep 2024 19:18:16 +0200 Message-Id: <20240923171825.148902-3-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_525948_76B42B62 X-CRM114-Status: UNSURE ( 5.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Introduce new uci-default functions: - ucidef_set_root_password [password hash/cleartext] - ucidef_set_ssh_authorized_key [ssh key] Signed-off-by: John Crispin --- .../base-files/files/lib/functions/uci-defaults.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Introduce new uci-default functions: - ucidef_set_root_password [password hash/cleartext] - ucidef_set_ssh_authorized_key [ssh key] Signed-off-by: John Crispin --- .../base-files/files/lib/functions/uci-defaults.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index ba7288c2c6..bcc78220cc 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -677,6 +677,20 @@ ucidef_set_country() { json_select .. } +ucidef_set_root_password() { + local passwd="$1" + json_select_object credentials + json_add_string root_password "$passwd" + json_select .. +} + +ucidef_set_ssh_authorized_key() { + local ssh_key="$1" + json_select_object credentials + json_add_string ssh_authorized_key "$ssh_key" + json_select .. +} + ucidef_set_ntpserver() { local server From patchwork Mon Sep 23 17:18:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988672 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=MhOnOM0G; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8sj2CLrz1xsg for ; Tue, 24 Sep 2024 03:21:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hSxkzf3Nzao1oqZdJINFoPwV6SteOrSjQjgHGwjRTiQ=; b=MhOnOM0G7EQxZF mr0XFHLPLRS3YKHIbRXyUTS6S6UJ9JmaXuYTFl3+hDjmRIYdqs0AlzUntFPhqmeMfi8Gn+SNtyYyF JaR5e0SG1DkruZBebu+a373K6jXVD1CTlesNtifWoO5OUvUgcFuJ42fSWUm7+nAaY4KAvskJG76N2 lviHVFlJ/5CFDBr6hBQRIYY2WUSNqfQ34Xhp3grccgNbk8m2fiJ2dDv+i4cA6gER9FoWtK8GnMN44 fZGRvOFQS78R7lbdmBDZ/HuMWBcMG3nqgYgYk8nwriW2kHqxzqKnzrBhasxVGpE+9Pm1SNnYYM5nI gc0x4nkcdoDl+j1qoLKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmi7-000000006xr-1aaS; Mon, 23 Sep 2024 17:18:55 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rS-3DDk for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:42 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhl-00HS5P-23 for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:33 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 03/11] base-files: uci-defaults: allow setting default timezone Date: Mon, 23 Sep 2024 19:18:17 +0200 Message-Id: <20240923171825.148902-4-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_839730_B218213B X-CRM114-Status: UNSURE ( 5.23 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Introduce new uci-default functions: - ucidef_set_timezone TZ Signed-off-by: John Crispin --- package/base-files/files/lib/functions/uci-defaults.sh | 7 +++++++ 1 file changed, 7 insertions(+) Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Introduce new uci-default functions: - ucidef_set_timezone TZ Signed-off-by: John Crispin --- package/base-files/files/lib/functions/uci-defaults.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index bcc78220cc..67862497c0 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -642,6 +642,13 @@ ucidef_set_hostname() { json_select .. } +ucidef_set_timezone() { + local timezone="$1" + json_select_object system + json_add_string timezone "$timezone" + json_select .. +} + ucidef_set_wireless() { local band="$1" local ssid="$2" From patchwork Mon Sep 23 17:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988675 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uyCdBcQd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8sy0B5gz1xsp for ; Tue, 24 Sep 2024 03:21:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cGl0oBrkAHEu9e5tfZ1Tmv75M9MLnggwzoOJ4+I3UOo=; b=uyCdBcQdIwb04H T+G9DN4uT8v6gQOL7tKoYLy9oVJ/fzLBy9+lN9rrF7oxd79m9i9wZG9USiI6fhatJ2qx5tMojIoMk /QtA0+3CQTvIpNnCD3Rzf4n39Qjiq37HHZ+b9ES6wEOYDmIA/6XdGE9kv7+G8xzeCAqhP0i/x3ar+ A6TYVESRLx7mBDHxCx87NJR95skXaQzjrgZdOWZHY3pOAuQUqA0MjgKvl9mvyLpOQ47DBbpYijOO/ zsXq5iZGPIuWsTpMFJABvv4GOf+RKjrL/zvyv1+IcX5d6sj6DK54sXs3CN3/LyeQq7QiUt5g0ZtqI vWp4KjWshsgXy/zWwjUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhu-000000006ua-1lr0; Mon, 23 Sep 2024 17:18:42 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rT-1v2y for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:38 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhl-00HS5P-2Y for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:33 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 04/11] base-files: uci-defaults: allow setting the number of MACs a radio can use Date: Mon, 23 Sep 2024 19:18:18 +0200 Message-Id: <20240923171825.148902-5-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_525950_76AEE377 X-CRM114-Status: UNSURE ( 6.40 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Introduce new uci-default functions: - ucidef_set_wireless_mac_count [count] Signed-off-by: John Crispin --- .../files/lib/functions/uci-defaults.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Introduce new uci-default functions: - ucidef_set_wireless_mac_count [count] Signed-off-by: John Crispin --- .../files/lib/functions/uci-defaults.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 67862497c0..30ae36949e 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -684,6 +684,27 @@ ucidef_set_country() { json_select .. } +ucidef_set_wireless_mac_count() { + local band="$1" + local mac_count="$2" + + case "$band" in + 2g|5g|6g) ;; + *) return;; + esac + [ -z "$mac_count" ] && return + + json_select_object wlan + json_select_object defaults + json_select_object ssids + json_select_object "$band" + json_add_string mac_count "$mac_count" + json_select .. + json_select .. + json_select .. + json_select .. +} + ucidef_set_root_password() { local passwd="$1" json_select_object credentials From patchwork Mon Sep 23 17:18:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988674 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=J4NwiG9D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8sx5yySz1xsg for ; Tue, 24 Sep 2024 03:21:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OZR5m0JWI0Xpai9ccx6US8EF3lnLSv+3ABPav9Uofy8=; b=J4NwiG9Dz5d/L/ Hpm/8IY7Oi2FGdMVnBdDtsQcovR9ed2Sy8emdyrpa4TmlGtLQ8pZQIPj1Pni/9iJqLh60ctkNGt2t RKPA3B90nBrlyWaxG2xu8pTnFGgSLCsLQGgiGxY7rmnBZSMr6sA4J0KjxnIMk2mppTvJKjeJpqUzk 0PP/wqCyRgsgaZOYr3RlKoXQmaGxQ6VCGQJQreuVSjvxfispRc0A6w9Lj5KUKGaYlo3gTi8U9aWVf EGJ/l7WkTxYi9xwAbfc3+QNLkYJMtj/Po7D3sXOimPjfVZBz/7wwtoXVObWfpKZXVf20cnHfsGDlU NSRdFzyCVP7oiK2OetAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmi0-000000006wK-48LX; Mon, 23 Sep 2024 17:18:48 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rV-2xWa for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:41 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhl-00HS5P-34 for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 05/11] base-files: execute uboot-env script before calling config_generate Date: Mon, 23 Sep 2024 19:18:19 +0200 Message-Id: <20240923171825.148902-6-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_788220_E79026F5 X-CRM114-Status: UNSURE ( 7.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This allows /etc/board.d/* scripts to use values from the uboot environment. Signed-off-by: John Crispin --- package/base-files/files/etc/init.d/boot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This allows /etc/board.d/* scripts to use values from the uboot environment. Signed-off-by: John Crispin --- package/base-files/files/etc/init.d/boot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index d17754d087..c7d1d4af3a 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -10,7 +10,6 @@ uci_apply_defaults() { cd /etc/uci-defaults || return 0 files="$(ls)" [ -z "$files" ] && return 0 - mkdir -p /tmp/.uci for file in $files; do ( . "./$(basename $file)" ) && rm -f "$file" done @@ -47,6 +46,8 @@ boot() { sleep 1 } + mkdir -p /tmp/.uci + [ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools) /bin/config_generate rm -f /tmp/.config_pending /sbin/wifi config From patchwork Mon Sep 23 17:18:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988671 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=zzWB8R9i; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8sH6Cpgz1xsp for ; Tue, 24 Sep 2024 03:20:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HhHgOSmwHE6KCQP/0oege5Wm1MfQI/JDD4sDW71M/dM=; b=zzWB8R9iCtH9eM bMvcR1u2/dbAPKYiHlQYIaOe9mgj10NzGxLJQT6mcAmIy0JYFS/Qeem8f4xjtP4WFWSiBV0kGQTgc Ku7DG0P8Xx8gy7AmZ658nQ0jxrYhu/s85j4u+4s8LXQAPsMoCk9hViPum6IBD4FSysKXMBst+XdZm qTIKteX2OEC/4WDOfztY5GCDoZFhoY5W/Sn8EzpMmI5Dsj4SpZq+Ea05ZbyV6GfTiWuBfefc2pnhT /bFaU4Ir26OTVByeDARc9seBlPo8+6UdFjZeTCHfeIU1KzhakhwgxiQEA7X/VI+Q7JFt/DHgZsnRf T3KWVUqD3Qh36IKIEP4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmi2-000000006wo-1bZr; Mon, 23 Sep 2024 17:18:50 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rX-2u7C for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:41 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhm-00HS5P-0M for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 06/11] uboot-envtools: add fw_loadenv tool Date: Mon, 23 Sep 2024 19:18:20 +0200 Message-Id: <20240923171825.148902-7-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_762824_6763FDB8 X-CRM114-Status: GOOD ( 10.23 ) X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This tool will load the uboot environment to /var/run/uboot-env/. This allows more efficient use when accessing multiple variables. Signed-off-by: John Crispin --- package/boot/uboot-envtools/Makefile | 1 + package/boot/uboot-envtools/files/fw_loadenv | 26 ++++++++++++++++++++ 2 files changed, 27 insertions(+) c [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This tool will load the uboot environment to /var/run/uboot-env/. This allows more efficient use when accessing multiple variables. Signed-off-by: John Crispin --- package/boot/uboot-envtools/Makefile | 1 + package/boot/uboot-envtools/files/fw_loadenv | 26 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 package/boot/uboot-envtools/files/fw_loadenv diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 19c3073c74..875afad554 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -71,6 +71,7 @@ define Package/uboot-envtools/install $(LN) fw_printenv $(1)/usr/sbin/fw_setenv $(INSTALL_BIN) ./files/fw_printsys $(1)/usr/sbin $(INSTALL_BIN) ./files/fw_setsys $(1)/usr/sbin + $(INSTALL_BIN) ./files/fw_loadenv $(1)/usr/sbin $(INSTALL_DIR) $(1)/lib $(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib $(INSTALL_DIR) $(1)/etc/uci-defaults diff --git a/package/boot/uboot-envtools/files/fw_loadenv b/package/boot/uboot-envtools/files/fw_loadenv new file mode 100644 index 0000000000..9fe302ce89 --- /dev/null +++ b/package/boot/uboot-envtools/files/fw_loadenv @@ -0,0 +1,26 @@ +#!/usr/bin/ucode + +'use strict'; + +const path = '/var/run/uboot-env/'; + +import * as fs from 'fs'; + +if (fs.lsdir(path)) { + warn(`env has already been loaded to ${path}\n`); + exit(0); +} + +let fp = fs.popen('fw_printenv'); +let raw = fp.read('all'); +fp.close(); + +if (!length(raw)) + exit(0); + +fs.mkdir(path); +for (let line in split(raw, '\n')) { + let vals = split(line, '='); + if (vals[0] && vals[1]) + fs.writefile(path + vals[0], vals[1]); +} From patchwork Mon Sep 23 17:18:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988677 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=b6Z8qWND; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8t01Z5Cz1xsg for ; Tue, 24 Sep 2024 03:21:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DgDsy7Rq7GC1UAHmexcfOv4lGFvQ0Icr/VfX7V5pms0=; b=b6Z8qWNDpBCfNx Lf8pFzrRzb42GIwgo4qtE7KvzjywKQWVDNFu91OlOMf3ts08hYxiQ11fZLaIMkx7/7gDbpaBuzmW6 X90Q4MR9ieEzNtcuWHrwI8Eq+MYJWLOy8HiTe09ADnj5J6g3iEbSA//PK7Ysh8QhZZ/gMghyoAXZ9 wOEgrHlRWyekuwere10RKC6UinhkWXFtnKqI5igtwDqnAqbQtxpLZ24hz9mozFp4rVFVvOtxC0VLz hEd9U8jZz16Jeo7QKAZBdUBMlFQwAB6+UXrvFXfu4s0LfLcjrM+IpRKRrOhPC2+RLc/JDDOIQ15ds zoeHe+jyLHcW9TTEj0JA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhv-000000006vG-2gxA; Mon, 23 Sep 2024 17:18:43 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rv-1ujq for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:40 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhm-00HS5P-0q for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 07/11] uboot-envtools: add a board.d script to load defaults from the environment Date: Mon, 23 Sep 2024 19:18:21 +0200 Message-Id: <20240923171825.148902-8-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_525608_CF08EFAE X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This allows loading default wifi credentials, passwords and ssh keys on firstboot. Signed-off-by: John Crispin --- package/boot/uboot-envtools/Makefile | 2 ++ package/boot/uboot-envtools/files/fw_defaults | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) cre [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This allows loading default wifi credentials, passwords and ssh keys on firstboot. Signed-off-by: John Crispin --- package/boot/uboot-envtools/Makefile | 2 ++ package/boot/uboot-envtools/files/fw_defaults | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 package/boot/uboot-envtools/files/fw_defaults diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 875afad554..61939be6de 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -72,6 +72,8 @@ define Package/uboot-envtools/install $(INSTALL_BIN) ./files/fw_printsys $(1)/usr/sbin $(INSTALL_BIN) ./files/fw_setsys $(1)/usr/sbin $(INSTALL_BIN) ./files/fw_loadenv $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc/board.d + $(INSTALL_DATA) ./files/fw_defaults $(1)/etc/board.d/05_fw_defaults $(INSTALL_DIR) $(1)/lib $(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib $(INSTALL_DIR) $(1)/etc/uci-defaults diff --git a/package/boot/uboot-envtools/files/fw_defaults b/package/boot/uboot-envtools/files/fw_defaults new file mode 100644 index 0000000000..5ef27f6cad --- /dev/null +++ b/package/boot/uboot-envtools/files/fw_defaults @@ -0,0 +1,16 @@ +. /lib/functions/uci-defaults.sh + +fw_loadenv + +board_config_update + +[ -f /var/run/uboot-env/owrt_ssid -a -f /var/run/uboot-env/owrt_wifi_key ] && + ucidef_set_wireless all "$(cat /var/run/uboot-env/owrt_ssid)" sae-mixed "$(cat /var/run/uboot-env/owrt_wifi_key)" +[ -f /var/run/uboot-env/owrt_country ] && ucidef_set_country "$(cat /var/run/uboot-env/owrt_country)" +[ -f /var/run/uboot-env/owrt_ssh_auth_key ] && ucidef_set_ssh_authorized_key "$(cat /var/run/uboot-env/owrt_ssh_auth_key)" +[ -f /var/run/uboot-env/owrt_root_password ] && ucidef_set_root_password "$(cat /var/run/uboot-env/owrt_root_password)" +[ -f /var/run/uboot-env/owrt_timezone ] && ucidef_set_timezone "$(cat /var/run/uboot-env/owrt_timezone)" + +board_config_flush + +exit 0 From patchwork Mon Sep 23 17:18:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988668 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=xNgRxGtf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8s93rrMz1xsg for ; Tue, 24 Sep 2024 03:20:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fjv8+YO8S+n/Cy5jzg69HgT74XMeFFLpb4TqxnDMizM=; b=xNgRxGtfcFLPP5 Z1dgtlzc6xaTQdI2ufWxkldT8krNAnBywCFDOnkYSJAHc13Ldr+1yWXebFd/WSa/Yy2dwuQBZ3H/X PV1YI1zBg0/TUO2pBAHaEiqqUzhLM43Ic1lnsufMH/VKzu8s8ap0gg3XTNwYeLVVTF98Y0KoNqH1L DDMRGXxPXop4ThvPdzcQXns/Tt1xvhL2MPH8/XgwxYfdrq+zcsUrPa5xz5/XBRbG2QzZf6DTNhTLa HtOKjORokh0vbKYINl9NI4mKEEjF/GnGHEQfX0Wtd9buuyrVl9A4dQPQnd8B5PD2/QDw86r7CJbOT bFYCePiH3IHIf3QWu4CA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhz-000000006w3-312v; Mon, 23 Sep 2024 17:18:47 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rw-2uPV for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:40 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhm-00HS5P-1M for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 08/11] wifi-scripts: populate default wifi credentials and country code from board.json Date: Mon, 23 Sep 2024 19:18:22 +0200 Message-Id: <20240923171825.148902-9-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_760870_9070BE17 X-CRM114-Status: UNSURE ( 7.01 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: John Crispin --- .../wifi-scripts/files/lib/wifi/mac80211.uc | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc index b68167b754..9fd6c35e8b 100644 --- a/package/network/c [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: John Crispin --- .../wifi-scripts/files/lib/wifi/mac80211.uc | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc index b68167b754..9fd6c35e8b 100644 --- a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc +++ b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc @@ -71,20 +71,34 @@ for (let phy_name, phy in board.wlan) { if (match(phy_name, /^phy[0-9]/)) id = `path='${phy.path}'`; + band_name = lc(band_name); + + let country, defaults, num_global_macaddr; + if (board.wlan.defaults) { + defaults = board.wlan.defaults.ssids?.[band_name]?.ssid ? board.wlan.defaults.ssids?.[band_name] : board.wlan.defaults.ssids?.all; + country = board.wlan.defaults.country; + if (!country && band_name != '2g') + defaults = null; + num_global_macaddr = board.wlan.defaults.ssids?.[band_name]?.mac_count; + } + print(`set ${s}=wifi-device set ${s}.type='mac80211' set ${s}.${id} -set ${s}.band='${lc(band_name)}' +set ${s}.band='${band_name}' set ${s}.channel='${channel}' set ${s}.htmode='${htmode}' -set ${s}.disabled='1' +set ${s}.country='${country || ''}' +set ${s}.num_global_macaddr='${num_global_macaddr || ''}' +set ${s}.disabled='${defaults ? 0 : 1}' set ${si}=wifi-iface set ${si}.device='${name}' set ${si}.network='lan' set ${si}.mode='ap' -set ${si}.ssid='OpenWrt' -set ${si}.encryption='none' +set ${si}.ssid='${defaults?.ssid || "OpenWrt"}' +set ${si}.encryption='${defaults?.encryption || "none"}' +set ${si}.key='${defaults?.key || ""}' `); commit = true; From patchwork Mon Sep 23 17:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988676 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Q3Sgd7gG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8t01bGlz1xsp for ; Tue, 24 Sep 2024 03:21:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B2ObzYSEQH6rr22twARYvoU1PyI99L5GiM/YGP8vhM4=; b=Q3Sgd7gGK1PA5c mxeS/cqmO5EP30eyu0Y4Xj02TvO+0rYIxTBeBcRg0hprUx3728eQFm+QFv0U8Fz+Bx/QLj5WNSkmG 82+XD+haK/MV9SScrbDUIU1uBUlj1Ho5gXpyDZrjgabSHVEh7WUtI+SPPXfdy4eVP53ulnc0BDBe+ lN4Jru4/QoMGgNOZWPNSjEQ+em079+dpNXZaNVpPrRfGOnJanw/Ef8WN1gHSvCCketVinCaw7QZvO 1hSK8YX19OyG/HtQWmRMsbokYOHJq7d9LXzw+4LmwgopNLkRWEvb1lVw/rfTPS0buLFt5GRct/6XX vOHvhht8wV9kUNQG+3zQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhy-000000006vk-0sqv; Mon, 23 Sep 2024 17:18:46 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmhp-000000006rx-1ue9 for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:18:40 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhm-00HS5P-1s for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 09/11] dropbear: add a uci-defaults script for loading authorized keys Date: Mon, 23 Sep 2024 19:18:23 +0200 Message-Id: <20240923171825.148902-10-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_101837_525608_90E20A02 X-CRM114-Status: GOOD ( 10.12 ) X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Write the ssh authorized key to /etc/dropbear/ssh_authorized_keys if present inside boad.json. Signed-off-by: John Crispin --- package/network/services/dropbear/Makefile | 2 ++ .../services/dropbear/files/dropbear.defaults | 15 +++++++++++++++ 2 files changed, 17 insertions(+ [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Write the ssh authorized key to /etc/dropbear/ssh_authorized_keys if present inside boad.json. Signed-off-by: John Crispin --- package/network/services/dropbear/Makefile | 2 ++ .../services/dropbear/files/dropbear.defaults | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 package/network/services/dropbear/files/dropbear.defaults diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 3367fd7f74..e9f3bd693c 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -227,6 +227,8 @@ define Package/dropbear/install $(INSTALL_DIR) $(1)/etc/dropbear $(INSTALL_DIR) $(1)/lib/preinit $(INSTALL_DATA) ./files/dropbear.failsafe $(1)/lib/preinit/99_10_failsafe_dropbear + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/dropbear.defaults $(1)/etc/uci-defaults/50-dropbear $(foreach f,$(filter /etc/dropbear/%,$(Package/dropbear/conffiles)),$(if $(wildcard $(TOPDIR)/files/$(f)),chmod 0600 $(TOPDIR)/files/$(f) || :; )) endef diff --git a/package/network/services/dropbear/files/dropbear.defaults b/package/network/services/dropbear/files/dropbear.defaults new file mode 100644 index 0000000000..ad831521b1 --- /dev/null +++ b/package/network/services/dropbear/files/dropbear.defaults @@ -0,0 +1,15 @@ +[ ! -s /etc/dropbear/authorized_keys ] || exit 0 + +. /usr/share/libubox/jshn.sh + +json_init +json_load "$(cat /etc/board.json)" + +json_select credentials + json_get_vars ssh_authorized_keys ssh_authorized_key + [ -z "$ssh_authorized_key" ] || { + echo -n "$ssh_authorized_key" > /etc/dropbear/authorized_keys + uci set dropbear.@dropbear[-1].PasswordAuth='off' + uci set dropbear.@dropbear[-1].RootPasswordAuth='off' + } +json_select .. From patchwork Mon Sep 23 17:18:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988679 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=klpDHjEc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC8z64XcMz1xsn for ; Tue, 24 Sep 2024 03:25:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k7aTivnDa6emvl78iE1WzV1HMGTIiiLeRouwWXlFDOA=; b=klpDHjEcIgciN5 QCfG/fzFUfbu1rCWVC1cOHOIi1B9baIDVGowqtFdVWz6Wqr71nqcck4VhRn/j3sUx80FfSiYRdt5U kUwieVDqYoQSXcnwZGVitn6mMCdvt5/UW/PU9aTIBPaBm1TKhPG5lTtVTqCspWNSsgWk+NRB8ZLF5 bAF/kMqMdVqEd4gbyOlv7dc0jXQQDfXov4jyD2kWSqDVOiwpY2rBP0lngkaLJtdV8NBjXsJ1wdYSW A73i+t/gk3Va/1tCnjTXp2gmfV9BSl/TGh6iBtpQ3RwmrnYDqDGoEgL8hsbdmHslbTZ4u/Gegay7z n+p1NZj40MJucRbMnWjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmo5-000000009Dv-2O0k; Mon, 23 Sep 2024 17:25:05 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmo2-000000009DG-11J4 for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:25:03 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhm-00HS5P-2O for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 10/11] base-files: add timezone to UCI during config_generate Date: Mon, 23 Sep 2024 19:18:24 +0200 Message-Id: <20240923171825.148902-11-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_102502_345328_15DF5E7B X-CRM114-Status: UNSURE ( 6.26 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: John Crispin --- package/base-files/files/bin/config_generate | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index be21d0079a..9d1968ce20 100755 --- a/package/base-files/files/bin/config_generate +++ b/pa [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: John Crispin --- package/base-files/files/bin/config_generate | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index be21d0079a..9d1968ce20 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -341,6 +341,11 @@ generate_static_system() { uci -q set "system.@system[-1].compat_version=1.0" fi + local timezone + if json_get_var timezone timezone; then + uci -q set "system.@system[-1].timezone=$timezone" + fi + if json_is_a ntpserver array; then local keys key json_get_keys keys ntpserver From patchwork Mon Sep 23 17:18:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1988682 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=X2zZtavU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XC97q3bNbz1xsM for ; Tue, 24 Sep 2024 03:33:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BturfZ68Qqb3cZW5LpBlf/Q5l9HH4VBr0VTQsZ1b3+M=; b=X2zZtavUiCZdDi ZXLkyG484DZ6A/IPjKyVp2FfI/s2dxWfX51Y+pez1pSv+/2QVkNxeQhWp0tIn/p58LTXf4MvdK7bx 4HdLmutGT4DvVUrEhwvPZcNAYYuYtz0mn8c93+/C0ZYG3Or91ODfhzgbqKeMj9dc7IsTIEwnP7cTV 8TRxOtku4Yxb+Iqj0sgGO8Eo8vVR/z6OG8mk5j5Y4PUNkHxjpjdSQjLkwAXvBYcjwYvLvvQczQsQe rso3z+EwPariOLYQ0/JreZG1hsuPRmQXTPAVHiT/T5ATuf110UifxggTmmgxtBjxwFGPcL+KfJ36t RGTIgnMnV62yLBs+CVfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ssmv5-00000000ANu-480R; Mon, 23 Sep 2024 17:32:20 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ssmv3-00000000AMs-1VDg for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 17:32:18 +0000 Received: from [2a04:4540:1404:e800:43a1:93c8:f672:7397] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ssmhm-00HS5P-2u for openwrt-devel@lists.openwrt.org; Mon, 23 Sep 2024 19:18:34 +0200 From: John Crispin To: openwrt-devel@lists.openwrt.org Subject: [PATCH 11/11] base-files: set root password if present inside board.json Date: Mon, 23 Sep 2024 19:18:25 +0200 Message-Id: <20240923171825.148902-12-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240923171825.148902-1-john@phrozen.org> References: <20240923171825.148902-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_103217_400018_ED69D023 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The code checks if the first character is "$". In that case it is assumed that the string contains a solted hash. Alternatively we assume that it is a cleartext password. Signed-off-by: John Crispin --- .../files/etc/uci-defaults/50-root-passwd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 package/base-files/files/etc/uci-d [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [46.4.11.11 listed in bl.score.senderscore.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The code checks if the first character is "$". In that case it is assumed that the string contains a solted hash. Alternatively we assume that it is a cleartext password. Signed-off-by: John Crispin --- .../files/etc/uci-defaults/50-root-passwd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 package/base-files/files/etc/uci-defaults/50-root-passwd diff --git a/package/base-files/files/etc/uci-defaults/50-root-passwd b/package/base-files/files/etc/uci-defaults/50-root-passwd new file mode 100644 index 0000000000..a7e5ace913 --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/50-root-passwd @@ -0,0 +1,15 @@ +. /usr/share/libubox/jshn.sh + +json_init +json_load "$(cat /etc/board.json)" + +json_select credentials +json_get_vars root_password root_password + [ -z "$root_password" ] || { + if [ "${root_password:0:1}" == "$" ]; then + sed -i "s|^root:[^:]*|root:$root_password|g" /etc/shadow + else + (echo "$root_password"; sleep 1; echo "$root_password") | passwd root + fi + } +json_select ..