1
0
forked from finn/tinyboard
Files
tinyboard/README.md

194 lines
5.8 KiB
Markdown
Raw Normal View History

# TinyBoard
2026-04-13 13:08:32 -07:00
A hub-spoke architecture for secure file sharing over SSH tunnels using autossh and rclone.
Spokes are ARM devices (e.g. OrangePi, Raspberry Pi) running Armbian that establish reverse SSH tunnels to a central hub server. The hub mounts spoke filesystems via SFTP using rclone, making files accessible across all devices without exposing them to the internet.
2026-04-13 13:08:32 -07:00
---
2026-04-13 13:08:32 -07:00
## Quickstart
2026-04-13 13:08:32 -07:00
### Setting up a new Hub
2026-04-13 13:08:32 -07:00
On a fresh Debian/Ubuntu VPS or server:
2026-04-13 13:08:32 -07:00
```bash
apt install git
2026-04-16 14:23:51 -07:00
git clone https://gut.oily.dad/justin/tinyboard
cd tinyboard
./setup.sh # choose option 4
2026-04-13 13:08:32 -07:00
```
### Setting up a new Spoke
2026-04-13 13:08:32 -07:00
On a fresh Armbian device:
2026-04-13 13:08:32 -07:00
1. Modify `spoke/armbian.not_logged_in_yet` accordingly, then drop it onto the SD card as `/root/.not_logged_in_yet` before first boot (WiFi credentials) — see [Armbian Autoconfig docs](https://docs.armbian.com/User-Guide_Autoconfig/)
2. Boot, SSH in as root
3. Run:
2026-04-13 13:08:32 -07:00
```bash
apt install git
2026-04-16 14:23:51 -07:00
git clone https://gut.oily.dad/justin/tinyboard
cd tinyboard
./spoke/setup-network.sh # configure static IP — SSH session will drop, reconnect
./setup.sh # choose option 1
2026-04-13 13:08:32 -07:00
```
### Onboarding a Spoke from the Hub
2026-04-13 13:08:32 -07:00
Once the spoke tunnel is up, run on the hub:
2026-04-13 13:08:32 -07:00
```bash
cd tinyboard
./setup.sh # choose option 2
2026-04-13 13:08:32 -07:00
```
### Offboarding a Spoke from the Hub
2026-04-15 12:01:09 -07:00
2026-04-13 13:08:32 -07:00
```bash
cd tinyboard
./setup.sh # choose option 3
```
2026-04-13 13:08:32 -07:00
---
2026-04-13 13:08:32 -07:00
## Architecture
2026-04-13 13:08:32 -07:00
```
[ Spoke ] [ Hub ]
OrangePi / RPi VPS / Server
Armbian Any Linux
2026-04-13 13:08:32 -07:00
autossh container ──────────► sshd (GatewayPorts)
reverse tunnel port 111xx
2026-04-15 12:01:09 -07:00
rclone SFTP mount
~/mnt/<spoke-name>/
2026-04-15 12:01:09 -07:00
```
Spokes initiate outbound SSH connections to the hub, creating reverse tunnels. The hub then uses rclone to mount each spoke's filesystem over SFTP through the tunnel. No inbound ports need to be open on the spoke.
2026-04-13 13:08:32 -07:00
---
2026-04-13 13:08:32 -07:00
## Directory Structure
2026-04-13 13:08:32 -07:00
```
tinyboard/
├── setup.sh ← entry point
├── spoke/
│ ├── setup-network.sh ← configure static IP before setup
│ ├── setup-spoke.sh ← automated spoke setup
│ ├── compose.yaml ← Docker Compose for autossh + syncthing
│ ├── Dockerfile ← autossh container
2026-04-16 14:23:51 -07:00
│ └── armbian.not_logged_in_yet ← Armbian first-boot WiFi config template
└── hub/
├── setup-hub.sh ← automated hub setup
├── onboard-spoke.sh ← add a new spoke to the hub
└── offboard-spoke.sh ← remove a spoke from the hub
2026-04-13 13:08:32 -07:00
```
---
## Setup Scripts
### `setup.sh`
Entry point. Presents a menu:
1. Set up this device as a new spoke
2. Onboard a new spoke from the hub
3. Offboard a spoke from the hub
4. Set up this device as a new hub
### `spoke/setup-network.sh`
Run as root on a new spoke before `setup.sh`. Configures a static IP via netplan. Supports both WiFi and wired interfaces. Automatically reverts if network connectivity is lost after applying the new config.
### `spoke/setup-spoke.sh`
Run as root on a new spoke. Handles:
- Package installation (apt/dnf/yum/pacman)
- Docker installation
- SSH server setup
- Hostname configuration
- SSH key generation and hub authorization
- Tunnel port auto-detection on the hub
- Docker image build and container start
- Optional password auth disable
### `hub/setup-hub.sh`
Run as root on a new hub server. Handles:
- Package installation (apt/dnf/yum/pacman)
- rclone installation
- Hub user creation
- SSH server configuration (GatewayPorts, AllowTcpForwarding)
- FUSE configuration
- rclone config directory setup
- Optional password auth disable
### `hub/onboard-spoke.sh`
Run as the hub user after a spoke connects. Handles:
- SSH key generation and deployment to spoke
- rclone remote configuration
- Spoke registration in `~/.config/tinyboard/spokes`
- Per-spoke crontab entry for auto-mount on reboot
### `hub/offboard-spoke.sh`
Run as the hub user to remove a spoke. Handles:
- Unmounting the spoke filesystem
- Removing the crontab entry
- Removing the rclone remote
- Optionally removing the hub SSH key
- Removing from the spoke registry
---
## Spoke Registry
The hub maintains a registry of connected spokes at `~/.config/tinyboard/spokes`:
2026-04-13 13:08:32 -07:00
```
rocky 11113 /home/armbian/.ssh/armbian-rocky-202504 /home/armbian/mnt/rocky
gouda 11114 /home/armbian/.ssh/armbian-gouda-202504 /home/armbian/mnt/gouda
```
2026-04-13 13:08:32 -07:00
Each spoke gets its own mount point at `~/mnt/<spoke-name>/` and a dedicated rclone crontab entry.
2026-04-13 13:08:32 -07:00
---
2026-04-13 13:08:32 -07:00
## Security
2026-04-13 13:08:32 -07:00
- All communication is over SSH tunnels — no spoke ports exposed to the internet
- SSH keys are used for all authentication
- Scripts check and auto-fix unsafe file permissions (600/400)
- Password authentication can be disabled during setup
- Scripts refuse to disable password auth if no authorized keys are present (lockout prevention)
- Netplan changes are verified with a 30-second connectivity check before being made permanent
2026-04-13 13:08:32 -07:00
---
2026-04-13 13:08:32 -07:00
## Sensitive Files
2026-04-13 13:08:32 -07:00
Before committing, ensure the following do not contain real credentials:
2026-04-13 13:08:32 -07:00
2026-04-16 14:23:51 -07:00
- `spoke/armbian.not_logged_in_yet` — contains WiFi SSID, password, and user passwords
2026-04-13 13:08:32 -07:00
---
2026-04-13 13:08:32 -07:00
## Troubleshooting
### `apt update` fails with beta.armbian.com error
On some Armbian images, a beta apt repository is enabled by default and may cause `apt update` to fail. Comment it out:
```bash
grep -r "beta.armbian" /etc/apt/sources.list /etc/apt/sources.list.d/
```
Open the file that contains it (usually `/etc/apt/sources.list.d/armbian.sources`) and comment out or remove the line referencing `beta.armbian.com`, then run `apt update` again.
---
## Requirements
2026-04-13 12:31:45 -07:00
**Spoke:** Armbian (Debian-based), ARM device, Docker, autossh, git
2026-04-13 12:31:45 -07:00
**Hub:** Any Linux server (Debian/Ubuntu/RHEL/Arch), rclone, fuse, openssh-server