void

- enter the void 🪐
git clone git://git.acid.vegas/archlinux.git
Log | Files | Refs | Archive

commit 48df4f380225443b8479c5ca8d5f2c2248efad89
parent 4ed0812a7091f34145ebfbb98f47dee5378530d9
Author: acidvegas <acid.vegas@acid.vegas>
Date: Tue, 16 Jul 2024 20:20:21 -0400

Added support for dropbear or ssh

Diffstat:
Msetup | 22+++++++++++++---------

1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/setup b/setup
@@ -10,9 +10,9 @@ ARCH=x86_64         # x86_64 or x86_64-musl
 CPU=intel           # amd or intel (blank for none)
 DISPLAY_SERVER=xorg # xorg or blank for none
 GFX_DRIVER=intel    # amd, intel, or nvidia (blank for none)
-REMOTE=dropbear     # dropbear or ssh
+REMOTE=dropbear     # dropbear or ssh (blank for none)
 USERNAME=acidvegas
-
+WIFI_DEV=wlan0
 
 GIT_URL="https://raw.githubusercontent.com/acidvegas/void/master"
 
@@ -36,17 +36,16 @@ setup_root() {
 	printf "Defaults lecture = always\nDefaults lecture_file = /etc/sudoers.d/sudoers.lecture\nroot ALL=(ALL) ALL\n%%wheel ALL=(ALL) ALL\n" > /etc/sudoers
 	printf "\n\033[1m     \033[32m\"Bee\" careful    \033[34m__\n       \033[32mwith sudo!    \033[34m// \ \n                     \\\\\\_/ \033[33m//\n   \033[35m''-.._.-''-.._.. \033[33m-(||)(')\n                     '''\033[0m\n" > /etc/sudoers.d/sudoers.lecture
 
-	if [ $REMOTE = "ssh" ]; then
-		xbps-install -y openssh
-		printf "PermitRootLogin no\nPasswordAuthentication no\n" >> /etc/ssh/sshd_config
-		ln -sfv /etc/sv/sshd /var/service/
-	elif [ $REMOTE = "dropbear" ]; then
-		printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -p CHANGE:ME -w -s -R -F\n' > /etc/sv/dropbear/run
+	if [ $REMOTE = "dropbear" ]; then
+		LOCAL_IP=$(ip addr show $WIFI_DEV | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
+		RND_PORT=$(shuf -i 10000-65535 -n 1)
+		xbps-install -y dropbear
+		printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -p $LOCAL_IP:$RND_PORT -w -s -R -F' > /etc/sv/dropbear/run
 	fi
 	
 	printf "\nhsts=0\n" >> /etc/wgetrc
 
-	for item in dhcpcd dropbear incus incus-user socklog-unix nanoklogd wpa_supplicant; do
+	for item in dhcpcd incus incus-user socklog-unix nanoklogd wpa_supplicant; do
 		ln -sfv /etc/sv/$item /var/service # Use /etc/runit/runsvdir/default/ instead of /var/service if in a chroot environemnt
 	done
 }
@@ -94,6 +93,11 @@ setup_packages() {
 	xbps-install -y checkbashisms go make patch pkg-config python3 python3-pip
 
 	# Essentials
+	if [ $REMOTE = "dropbear" ]; then
+		xbps-install -y dhcpcd dropbear
+	elif [ $REMOTE = "ssh" ] || [ $REMOTE = "openssh" ]; then
+		xbps-install -y dhcpcd openssh
+	fi
 	xbps-install -y curl dropbear git jq progress rsync socklog-void tmux tor tree unzip zip
 
 	# Raspberry Pi specific