1
0
forked from finn/tinyboard

restructure

This commit is contained in:
2026-04-13 12:53:14 -07:00
parent 05a5928a56
commit 299f6c5355
8 changed files with 132 additions and 148 deletions

8
spoke/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y autossh openssh-client && rm -rf /var/lib/apt/lists/*
ARG UID=1000
ARG GID=1000
RUN groupadd -g ${GID} armbian && useradd -m -u ${UID} -g armbian armbian
USER armbian
WORKDIR /home/armbian
CMD ["autossh", "-M", "0", "-N"]

8
spoke/aptprimary.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
# Need armbian-config?
apt install -y vim
apt install -y autossh
apt install -y docker.io docker-cli docker-compose
usermod -aG docker armbian

View File

@@ -0,0 +1,33 @@
#/root/.not_logged_in_yet
# Network Settings
PRESET_NET_CHANGE_DEFAULTS="1"
## Ethernet
PRESET_NET_ETHERNET_ENABLED="1" # Ignored due to WiFi
## WiFi
PRESET_NET_WIFI_ENABLED="1"
PRESET_NET_WIFI_SSID="[REDACTED]"
PRESET_NET_WIFI_KEY="[REDACTED]"
PRESET_NET_WIFI_COUNTRYCODE="US"
PRESET_CONNECT_WIRELESS="n"
## Static IP
PRESET_NET_USE_STATIC="0"
PRESET_NET_STATIC_IP="192.168.0.100"
PRESET_NET_STATIC_MASK="255.255.255.0"
PRESET_NET_STATIC_GATEWAY="192.168.0.1"
PRESET_NET_STATIC_DNS="8.8.8.8 8.8.4.4"
# System
SET_LANG_BASED_ON_LOCATION="y"
PRESET_LOCALE="en_US.UTF-8"
PRESET_TIMEZONE="Etc/UTC"
# Root
PRESET_ROOT_PASSWORD="[REDACTED]"
PRESET_ROOT_KEY=""
# User
PRESET_USER_NAME="armbian"
PRESET_USER_PASSWORD="[REDACTED]"
PRESET_USER_KEY=""
PRESET_DEFAULT_REALNAME="Armbian user"
PRESET_USER_SHELL="bash"

39
spoke/autohostname.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Copy this along with .not_logged_in_yet to armbian root dir, then run after successful login
# Refresh: extract MAC address of wlan0
MAC=$(netplan status -f json | jq -r '.wlan0.macaddress')
# Check that we actually got a MAC address
if [[ -z "$MAC" ]]; then
echo "Error: Could not retrieve MAC address from netplan." >&2
exit 1
fi
echo "Detected MAC address: $MAC"
# Assign cheese hostname based on MAC address
case "$MAC" in
38:9c:80:46:26:c8) # ← Replace with your first real MAC
HOSTNAME="brie"
;;
68:f8:ea:22:e1:3d) # ← Replace with your second real MAC
HOSTNAME="gouda"
;;
99:88:77:66:55:44) # ← Replace with your third real MAC
HOSTNAME="camembert"
;;
*)
echo "Unknown MAC address: $MAC ... hostname not changed." >&2
exit 1
;;
esac
echo "Setting hostname to: $HOSTNAME"
sudo hostnamectl set-hostname "$HOSTNAME"
# Optional: also update /etc/hostname (hostnamectl usually does this, but to be safe)
echo "$HOSTNAME" | sudo tee /etc/hostname >/dev/null
echo "Hostname changed. Reboot or start a new shell to see the change."

22
spoke/clean_sensitive.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Script to clean sensitive WiFi credentials and passwords from configuration files
# Usage: ./clean_sensitive.sh [filename]
FILE="${1:-/home/finn/code/tinyboard/armb-not_logged_in_yet}"
echo "Cleaning sensitive data from: $FILE"
# Clean WiFi SSID (both commented and uncommented lines)
sed -i 's/^\(#*PRESET_NET_WIFI_SSID=\).*$/\1"[REDACTED]"/' "$FILE"
# Clean WiFi KEY (both commented and uncommented lines)
sed -i 's/^\(#*PRESET_NET_WIFI_KEY=\).*$/\1"[REDACTED]"/' "$FILE"
# Clean root password
sed -i 's/^\(PRESET_ROOT_PASSWORD=\).*$/\1"[REDACTED]"/' "$FILE"
# Clean user password
sed -i 's/^\(PRESET_USER_PASSWORD=\).*$/\1"[REDACTED]"/' "$FILE"
echo "wiped fields"

20
spoke/compose.yaml Normal file
View File

@@ -0,0 +1,20 @@
version: '3.8'
services:
autossh:
image: spoke-autossh
container_name: spoke-autossh
restart: always
network_mode: host
environment:
- AUTOSSH_GATETIME=0
command: >
autossh -M 0 -NT
-o "ServerAliveInterval=60"
-o "ServerAliveCountMax=3"
-R 11111:localhost:22
-i /home/armbian/.ssh/oilykey2026
armbian@oily.dad
volumes:
- /home/armbian/.ssh/oilykey2026:/home/armbian/.ssh/oilykey2026:ro
- /home/armbian/.ssh/known_hosts:/home/armbian/.ssh/known_hosts:ro
- /home/armbian/share:/home/armbian/share