Update pawdance

This commit is contained in:
racks 2025-07-25 20:50:24 +02:00
parent 3bd8792e49
commit 8f9e40ee65

View file

@ -1,28 +1,10 @@
#!/usr/bin/env bash
# pawdance.sh EXACT client *and* server logic driven by an easytoedit config file
# -----------------------------------------------------------------------------
# Modes (ROLE in config):
# client brings up a pointtopoint tunnel by SSHwing into the server.
# server creates the matching tunnel locally and (optionally) enables routing.
#
# Connection source (CONNECT_MODE):
# dns resolve REMOTE_HOST on every run.
# ip use the hardcoded REMOTE_CONNECT_IP4 and/or REMOTE_CONNECT_IP6.
# auto if REMOTE_HOST is set use dns, otherwise ip (default).
#
# Extra dial options:
# CONNECT_PREFER which address family to try first (auto|ipv4|ipv6).
# SSH_KEY_MODE set to "true" to pass an explicit private key via -i.
# SSH_KEY absolute path to that key (required if SSH_KEY_MODE=true).
#
# -----------------------------------------------------------------------------
# v4.5.1 better --help, commented example configs, SSH_KEY_MODE support.
# -----------------------------------------------------------------------------
# pawdance.sh - EXACT client *and* server logic driven by an easytoedit config file
#
set -euo pipefail
SCRIPT_NAME="pawdance"
VERSION="4.5.1"
VERSION="4.5.2"
CONFIG_FILE=""
SUBCMD=""
@ -249,7 +231,7 @@ client_up() {
[[ -n "$REMOTE_IP6_RESOLVED" && -n "$IPV6_GW" ]] && \
$SUDO ip -6 route add "$REMOTE_IP6_RESOLVED" via "$IPV6_GW" dev "$IFACE6"
log "Setting default routes (metric 1)…"
log "Setting default routes (metric1)…"
[[ "$DEFAULT_ROUTE_IPV4" == "true" && -n "$REMOTE_IP4" ]] && \
$SUDO ip route add default via "$REMOTE_IP4" dev "$TUN_DEV" metric 1
[[ "$DEFAULT_ROUTE_IPV6" == "true" && -n "$REMOTE_IP6" ]] && \
@ -308,7 +290,7 @@ server_up() {
# -------------- CLI --------------
usage() {
cat <<EOF
$SCRIPT_NAME $VERSION vpn wrapper over SSH
$SCRIPT_NAME $VERSION - vpn wrapper over SSH
Subcommands:
up --config <file> Bring tunnel up (client or server, per ROLE).