Allow specifying external domain names to be routed through VPN
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,2 +1,3 @@ | ||||
| routes.txt | ||||
| domains.txt | ||||
| run.sh | ||||
| @@ -15,6 +15,7 @@ brew install vpn-slice | ||||
| brew install oath-toolkit | ||||
| brew install swiftbar | ||||
| brew install terminal-notifier | ||||
| brew install bind | ||||
| ``` | ||||
|  | ||||
| On Macos add server address, username, password and 2fa seed in keychain with these names: | ||||
|   | ||||
							
								
								
									
										2
									
								
								domains.txt.sample
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								domains.txt.sample
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| www.example.com | ||||
| en.wikipedia.org | ||||
							
								
								
									
										23
									
								
								routing.sh
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								routing.sh
									
									
									
									
									
								
							| @@ -1,6 +1,7 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| ROUTE_FILE=routes.txt | ||||
| DOMAIN_FILE=domains.txt | ||||
|  | ||||
| VPN_SLICE=vpn-slice | ||||
|  | ||||
| @@ -50,12 +51,32 @@ if test -f "$ROUTE_FILE"; then | ||||
|     echo "Loading subnets from $ROUTE_FILE" | ||||
|     while read p; do | ||||
|         case "$p" in \#*) continue ;; esac | ||||
|         add_subnet $p | ||||
|         if [ "$p" != "" ]; then | ||||
|             echo "Subnet: ${p}" | ||||
|             add_subnet $p | ||||
|         fi | ||||
|     done <$ROUTE_FILE | ||||
|  | ||||
| else | ||||
|     echo "$ROUTE_FILE does not exist. This should not happen." | ||||
| fi | ||||
|  | ||||
| if test -f "$DOMAIN_FILE"; then | ||||
|     echo "Loading domains from $DOMAIN_FILE" | ||||
|     while read d; do | ||||
|         case "$d" in \#*) continue ;; esac | ||||
|         echo "Domain: ${d}" | ||||
|         if [ "$d" != "" ]; then | ||||
|             for p in `dig +short "$d" a | grep '^[.0-9]*$'`; do | ||||
|                 echo "Resolved IP for domain ${d}: ${p}" | ||||
|                 add_subnet $p/32 | ||||
|             done | ||||
|         fi | ||||
|     done <$DOMAIN_FILE | ||||
|  | ||||
| else | ||||
|     echo "$DOMAIN_FILE does not exist. Ignoring." | ||||
| fi | ||||
|  | ||||
| # Load default script | ||||
| $VPN_SLICE -S | ||||
|   | ||||
		Reference in New Issue
	
	Block a user