diff --git a/apps/rego-tunnel/build/setup-network.sh b/apps/rego-tunnel/build/setup-network.sh index 3c601b7..4aee9ff 100755 --- a/apps/rego-tunnel/build/setup-network.sh +++ b/apps/rego-tunnel/build/setup-network.sh @@ -11,11 +11,19 @@ set -e BRIDGE_NAME="${BRIDGE_NAME:-br-rego-vpn}" TAP_NAME="${TAP_NAME:-tap0}" -BRIDGE_CIDR="${BRIDGE_CIDR:-100.100.0.1}/24" +BRIDGE_CIDR="${BRIDGE_CIDR:-100.100.0.1}" VM_NET_IP="${VM_NET_IP:-100.100.0.2}" -VM_SUBNET="${VM_SUBNET:-100.100.0.0}/24" +VM_SUBNET="${VM_SUBNET:-100.100.0.0}" TARGET_IP="${TARGET_IP:-10.35.33.230}" +if [[ "$BRIDGE_CIDR" != */* ]]; then + BRIDGE_CIDR="$BRIDGE_CIDR/24" +fi + +if [[ "$VM_SUBNET" != */* ]]; then + VM_SUBNET="$VM_SUBNET/24" +fi + # Pick the outbound interface based on the container's default route. # (In Docker, this is not always eth1 when multiple networks are attached.) WAN_IF="$(ip route show default 0.0.0.0/0 2>/dev/null | awk '{for(i=1;i<=NF;i++) if($i=="dev"){print $(i+1); exit}}')" diff --git a/apps/rego-tunnel/build/start-dnsmasq.sh b/apps/rego-tunnel/build/start-dnsmasq.sh index dba4a17..2b2c3b8 100644 --- a/apps/rego-tunnel/build/start-dnsmasq.sh +++ b/apps/rego-tunnel/build/start-dnsmasq.sh @@ -2,13 +2,17 @@ set -euo pipefail BRIDGE_NAME="${BRIDGE_NAME:-br-rego-vpn}" -BRIDGE_CIDR="${BRIDGE_CIDR:-100.100.0.1}/24" +BRIDGE_CIDR="${BRIDGE_CIDR:-100.100.0.1}" VM_NET_IP="${VM_NET_IP:-100.100.0.2}" VM_MAC="${VM_MAC:-52:54:00:12:34:56}" LEASE_TIME="${LEASE_TIME:-12h}" DNS_SERVERS="${DNS_SERVERS:-1.1.1.1,8.8.8.8}" +if [[ "$BRIDGE_CIDR" != */* ]]; then + BRIDGE_CIDR="$BRIDGE_CIDR/24" +fi + GATEWAY_IP="${BRIDGE_CIDR%%/*}" mkdir -p /etc/dnsmasq.d diff --git a/apps/rego-tunnel/config.json b/apps/rego-tunnel/config.json index 3567d04..f739314 100755 --- a/apps/rego-tunnel/config.json +++ b/apps/rego-tunnel/config.json @@ -110,16 +110,16 @@ "placeholder": "12h", "required": true, "env_variable": "LEASE_TIME", - "default": "288h" + "default": "12h" }, { "type": "text", "label": "Host share directory", - "hint": "Directory on the host to share with the VM", - "placeholder": "${APP_DATA_DIR}/hostshare", + "hint": "Directory on the host to share with the VM (exported to the VM as 9p tag TSCLIENT)", + "placeholder": "/etc/runtipi/app-data", "required": false, "env_variable": "TSCLIENT", - "default": "${APP_DATA_DIR}/hostshare" + "default": "/etc/runtipi/app-data" } ], "supported_architectures": ["amd64"] diff --git a/apps/rego-tunnel/docker-compose.json b/apps/rego-tunnel/docker-compose.json index 71e6ddf..8e0ae4d 100755 --- a/apps/rego-tunnel/docker-compose.json +++ b/apps/rego-tunnel/docker-compose.json @@ -23,7 +23,7 @@ }, { "key": "BRIDGE_CIDR", - "value": "${BRIDGE_CIDR:-100.100.0.1/24}" + "value": "${BRIDGE_CIDR:-100.100.0.1}" }, { "key": "VM_NET_IP", @@ -31,7 +31,7 @@ }, { "key": "VM_SUBNET", - "value": "${VM_SUBNET:-100.100.0.0/24}" + "value": "${VM_SUBNET:-100.100.0.0}" }, { "key": "TARGET_IP", @@ -51,7 +51,7 @@ }, { "key": "TSCLIENT", - "value": "${TSCLIENT:-${APP_DATA_DIR}/hostshare}" + "value": "${TSCLIENT:-/etc/runtipi/app-data}" } ], "internalPort": 8006, @@ -71,7 +71,7 @@ "private": false }, { - "hostPath": "${TSCLIENT}", + "hostPath": "${TSCLIENT:-/etc/runtipi/app-data}", "containerPath": "/hostshare", "readOnly": false, "shared": false, diff --git a/apps/rego-tunnel/docker-compose.yml b/apps/rego-tunnel/docker-compose.yml index da766b1..d22c09e 100755 --- a/apps/rego-tunnel/docker-compose.yml +++ b/apps/rego-tunnel/docker-compose.yml @@ -17,18 +17,18 @@ services: - VM_CPUS=${WINDOWS_CPU_CORES} - BRIDGE_NAME=${BRIDGE_NAME:-br-rego-vpn} - TAP_NAME=${TAP_NAME:-tap0} - - BRIDGE_CIDR=${BRIDGE_CIDR:-100.100.0.1/24} + - BRIDGE_CIDR=${BRIDGE_CIDR:-100.100.0.1} - VM_NET_IP=${VM_NET_IP:-100.100.0.2} - - VM_SUBNET=${VM_SUBNET:-100.100.0.0/24} + - VM_SUBNET=${VM_SUBNET:-100.100.0.0} - TARGET_IP=${TARGET_IP:-10.35.33.230} - VM_MAC=${VM_MAC:-52:54:00:12:34:56} - DNS_SERVERS=${DNS_SERVERS:-1.1.1.1,8.8.8.8} - LEASE_TIME=${LEASE_TIME:-12h} - - TSCLIENT=${TSCLIENT:-/hostshare} + - TSCLIENT=${TSCLIENT:-/etc/runtipi/app-data} volumes: - /etc/runtipi/user-config/runtipi/rego-tunnel/storage/linux-vm.qcow2:/vm/linux-vm.qcow2 - /etc/runtipi/user-config/runtipi/rego-tunnel/shared:/shared - - ${TSCLIENT}:/shared/app-data + - ${TSCLIENT:-/etc/runtipi/app-data}:/hostshare networks: - tipi_main_network sysctls: