From cb3954e70b96cd714d77605b261e6d1e41a328c9 Mon Sep 17 00:00:00 2001 From: Abhishek Mishra Date: Wed, 15 Jul 2026 15:44:37 +0000 Subject: [PATCH] !boards/moxart: Use ROMFS PBKDF2 passwd login Migrate moxa:nsh from fixed telnet password to build-time ROMFS /etc/passwd with PBKDF2-HMAC-SHA256 and cryptodev. Signed-off-by: Abhishek Mishra --- boards/arm/moxart/moxa/configs/nsh/defconfig | 10 +++++++- boards/arm/moxart/moxa/src/Makefile | 5 ++++ boards/arm/moxart/moxa/src/etc/group | 1 + .../arm/moxart/moxa/src/etc/init.d/rc.sysinit | 25 +++++++++++++++++++ boards/arm/moxart/moxa/src/etc/init.d/rcS | 25 +++++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 boards/arm/moxart/moxa/src/etc/group create mode 100644 boards/arm/moxart/moxa/src/etc/init.d/rc.sysinit create mode 100644 boards/arm/moxart/moxa/src/etc/init.d/rcS diff --git a/boards/arm/moxart/moxa/configs/nsh/defconfig b/boards/arm/moxart/moxa/configs/nsh/defconfig index df5dc3a01aa..bd4315e2a50 100644 --- a/boards/arm/moxart/moxa/configs/nsh/defconfig +++ b/boards/arm/moxart/moxa/configs/nsh/defconfig @@ -43,13 +43,22 @@ CONFIG_ARCH_INTERRUPTSTACK=1024 CONFIG_ARCH_STACKDUMP=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_RESET=y +CONFIG_BOARD_ETC_ROMFS_PASSWD_ENABLE=y CONFIG_BOARD_LOOPSPERMSEC=6965 CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y +CONFIG_CRYPTO=y +CONFIG_CRYPTO_CRYPTODEV=y +CONFIG_CRYPTO_CRYPTODEV_SOFTWARE_CRYPTO=y +CONFIG_CRYPTO_SW_AES=y CONFIG_DEFAULT_SMALL=y +CONFIG_ETC_ROMFS=y +CONFIG_ETC_ROMFSDEVNO=0 CONFIG_FS_BINFS=y CONFIG_FS_ROMFS=y CONFIG_FS_UNIONFS=y +CONFIG_FSUTILS_PASSWD=y +CONFIG_FSUTILS_PASSWD_READONLY=y CONFIG_FTMAC100_BASE=0x90900000 CONFIG_FTMAC100_IRQ=25 CONFIG_FTMAC100_MAC0_ENV_ADDR=0x80000050 @@ -69,7 +78,6 @@ CONFIG_NET_SOCKOPTS=y CONFIG_NET_TCP=y CONFIG_NET_TCP_WRITE_BUFFERS=y CONFIG_NSH_BUILTIN_APPS=y -CONFIG_NSH_LOGIN_PASSWORD="nuttx" CONFIG_NSH_TELNET=y CONFIG_NSH_TELNET_LOGIN=y CONFIG_RAM_SIZE=2097152 diff --git a/boards/arm/moxart/moxa/src/Makefile b/boards/arm/moxart/moxa/src/Makefile index 11ceee4b22b..d377615684d 100644 --- a/boards/arm/moxart/moxa/src/Makefile +++ b/boards/arm/moxart/moxa/src/Makefile @@ -28,4 +28,9 @@ ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += moxart_reset.c endif +ifeq ($(CONFIG_ETC_ROMFS),y) + RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS + RCRAWS = etc/group +endif + include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/moxart/moxa/src/etc/group b/boards/arm/moxart/moxa/src/etc/group new file mode 100644 index 00000000000..f0565ff64b4 --- /dev/null +++ b/boards/arm/moxart/moxa/src/etc/group @@ -0,0 +1 @@ +root:*:0:root diff --git a/boards/arm/moxart/moxa/src/etc/init.d/rc.sysinit b/boards/arm/moxart/moxa/src/etc/init.d/rc.sysinit new file mode 100644 index 00000000000..21741f6ebfa --- /dev/null +++ b/boards/arm/moxart/moxa/src/etc/init.d/rc.sysinit @@ -0,0 +1,25 @@ +/**************************************************************************** + * boards/arm/moxart/moxa/src/etc/init.d/rc.sysinit + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#include + +/* ROMFS /etc system-init script (no board-specific init commands yet). */ diff --git a/boards/arm/moxart/moxa/src/etc/init.d/rcS b/boards/arm/moxart/moxa/src/etc/init.d/rcS new file mode 100644 index 00000000000..cf55be5520c --- /dev/null +++ b/boards/arm/moxart/moxa/src/etc/init.d/rcS @@ -0,0 +1,25 @@ +/**************************************************************************** + * boards/arm/moxart/moxa/src/etc/init.d/rcS + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#include + +/* ROMFS /etc start-up script (no board-specific start-up commands yet). */