From dc7f3f17d2ef475ff08acc7caaabc0410d93c188 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 10 Apr 2024 12:20:12 +0000 Subject: [PATCH] last minor updates --- RMxxx_rgmii_toolkit.sh | 11 ++++++++--- lighttpd/README.md | 9 --------- lighttpd/gencert.sh | 4 ---- sshd/README.md | 10 ---------- 4 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 lighttpd/README.md delete mode 100644 lighttpd/gencert.sh delete mode 100644 sshd/README.md diff --git a/RMxxx_rgmii_toolkit.sh b/RMxxx_rgmii_toolkit.sh index 5d15df4..702d95b 100644 --- a/RMxxx_rgmii_toolkit.sh +++ b/RMxxx_rgmii_toolkit.sh @@ -323,6 +323,7 @@ install_lighttpd() { ensure_entware_installed /opt/bin/opkg install lighttpd lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-cgi lighttpd-mod-openssl lighttpd-mod-proxy + rm /opt/etc/init.d/S80lighttpd # Ensure rc.unslung doesn't try to start it systemctl stop lighttpd echo -e "\033[0;32mInstalling/Updating Lighttpd...\033[0m" @@ -342,11 +343,12 @@ install_lighttpd() { while true; do echo -e "\e[1;31mPlease set your root web login password.\e[0m" - read password + read -s password if [ -z "$password" ]; then echo -e "\e[1;32mNo password provided.\e[0m" else - printf "root:$(openssl passwd -crypt $password)\n" >> $LIGHTTPD_DIR/.htpasswd + echo -n "root:" > $LIGHTTPD_DIR/.htpasswd + openssl passwd -crypt "$password" >> $LIGHTTPD_DIR/.htpasswd echo -e "\e[1;32mPassword set.\e[0m" break fi @@ -1113,14 +1115,17 @@ echo " :+##+. " ln -sf "/lib/systemd/system/sshd.service" "/lib/systemd/system/multi-user.target.wants/" opkg install openssh-server-pam shadow-useradd + rm /opt/etc/init.d/S40sshd # Ensure rc.unslung doesn't try to start it /opt/bin/ssh-keygen -A systemctl daemon-reload systemctl enable sshd + # Enable PAM and PermitRootLogin sed -i "s/^.*UsePAM .*/UsePAM yes/" "/opt/etc/ssh/sshd_config" sed -i "s/^.*PermitRootLogin .*/PermitRootLogin yes/" "/opt/etc/ssh/sshd_config" - useradd -u 106 -g nogroup -d /opt/var/run -s /bin/nologin -r -N -M sshd + # Ensure the sshd user exists in the /opt/etc/passwd file + grep "sshd:x:106" /opt/etc/passwd || echo "sshd:x:106:65534:Linux User,,,:/opt/run/sshd:/bin/nologin" >> /opt/etc/passwd systemctl start sshd echo -e "\e[1;32mOpenSSH installed!!\e[0m" diff --git a/lighttpd/README.md b/lighttpd/README.md deleted file mode 100644 index d0edda5..0000000 --- a/lighttpd/README.md +++ /dev/null @@ -1,9 +0,0 @@ -lighttpd -lighttpd-mod-auth -lighttpd-mod-authn_file -lighttpd-mod-cgi -lighttpd-mod-openssl -lighttpd-mod-proxy -printf "USER:$(openssl passwd -crypt PASSWORD)\n" >> .htpasswd - - diff --git a/lighttpd/gencert.sh b/lighttpd/gencert.sh deleted file mode 100644 index a98208e..0000000 --- a/lighttpd/gencert.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \ - -subj "/C=US/ST=MI/L=Romulus/O=RMIITools/CN=localhost" \ - -keyout server.key -out server.crt diff --git a/sshd/README.md b/sshd/README.md deleted file mode 100644 index 64656a0..0000000 --- a/sshd/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Generate Host Keys -ssh-keygen -A - -# Must edit in /opt/etc/ssh/sshd_config -PasswordAuthentication yes -UsePAM yes -PermitRootLogin yes - -# Need to add ssh user in /opt/etc/passwd -sshd:x:106:65534:Linux User,,,:/opt/run/sshd:/bin/nologin