M0dEx / quincy

QUIC-based VPN
MIT License
114 stars 11 forks source link

Add additional route configuration #77

Closed M0dEx closed 4 months ago

M0dEx commented 4 months ago

Quincy is missing a crucial part of any VPN - the ability to specify a set of subnets that should be routed through the tunnel.

Add such capability in a multi-platform way (possibly using console commands).

sasanj commented 4 months ago

Hi First of all let me thank you for your efforts. they are very appreciated. I've changed quincy-client to call a script when it's interface is up with some parameters. The script will setup routes, as follows.

#!/bin/bash
SERVER=${1%%:*}
IP=$( resolvectl query -4 $SERVER | grep -Po $SERVER':\s+\K[\d.]+')
ROUTE="$(ip route get $IP | head -1 | sed 's/uid.*$//')"
ip route add $ROUTE metric 5
INTERFACE=$4
ADDRESS=${2%%/*}
MTU=$3
ip rule delete from $ADDRESS table 25
ip rule add from $ADDRESS table 25 &&
ip route add 10.0.0.0/24 via $ADDRESS table 25 &&
ip route add default via 10.0.0.1 table 25 &&
ip route add default via 10.0.0.1 metric 10 &&
resolvectl dns $INTERFACE 10.0.0.1 &&
resolvectl domain $INTERFACE '~.' &&
resolvectl default-route $INTERFACE true

One thing that is really needed is the ip address of the server. Right now I've hard coded it.

M0dEx commented 4 months ago

For now, you could probably run this script without any changes to Quincy using a systemd service ExecPre/ExecPost.

You could probably get the server's IP address using ip and grepping the output, or perhaps grepping it from the client config for now.

I am unsure of how I will implement this, but this and #76 are the most important feature additions at the moment.