evo-cli 0.36.5__tar.gz → 0.37.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {evo_cli-0.36.5 → evo_cli-0.37.0}/PKG-INFO +1 -1
- evo_cli-0.37.0/evo_cli/VERSION +1 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/openvpn.py +30 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/openvpn.py +95 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli.egg-info/PKG-INFO +1 -1
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_openvpn.py +143 -0
- evo_cli-0.36.5/evo_cli/VERSION +0 -1
- {evo_cli-0.36.5 → evo_cli-0.37.0}/Containerfile +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/HISTORY.md +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/LICENSE +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/MANIFEST.in +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/README.md +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/__main__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/base.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/cli.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/agent_toy.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/claude_code.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/cloudflare.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/cred.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/download.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/fix_claude.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/gdrive.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/gh.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_dag.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_git.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_hub.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_mirror.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_model.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_mutate.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_paths.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_render.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/_server.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/check.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/clone.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/edit.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/pull.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/serve.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/show.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/views.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/index-Cs7hXRPJ.css +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/index-CuNOlaH7.js +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/harness/web/index.html +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/hwid.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/hwid_reset.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/image.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/localproxy.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/mcp.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/miniconda.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/netcheck.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/ngrok.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/opencode.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/plantuml.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_dns.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_dnswatch.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_dpi.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_hosts.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_page.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_probe.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/_spoofdpi.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/check.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/fix.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/probe.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/route/status.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/serp.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/site2s.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/ssh.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/storage.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/sysmon.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/tts.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/update.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/commands/wifi.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/console.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/doctor.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/google_oauth.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/migrate.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/oauth_flow.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/registry.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/store.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/credentials/sync.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/align.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/core.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/creds.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/errors.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/gemini.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/imaging/ncnn.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/mcp_registry.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/serp/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/serp/client.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/serp/creds.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/serp/errors.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/serp/install.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/serp/render.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/chunking.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/core.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/creds.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/errors.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/gemini.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/http.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/openai.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/player.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli/tts/vbee.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli.egg-info/SOURCES.txt +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli.egg-info/dependency_links.txt +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli.egg-info/entry_points.txt +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli.egg-info/requires.txt +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/evo_cli.egg-info/top_level.txt +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/pyproject.toml +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/setup.cfg +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/__init__.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/fake_evo_agents.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/fixtures/hub/contract-0.2.0.json +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/fixtures/hub/mirror-demo.yaml +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_agent_toy.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_claude_code.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_cli.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_console.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_cred.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_download.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_fix_claude.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_gdrive.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_gh.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_harness.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_harness_clone.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_harness_dag.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_harness_hub.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_harness_show.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_image.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_mcp.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_ngrok.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_opencode.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_plantuml.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_route.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_serp.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_storage.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_sysmon.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_tts.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_update.py +0 -0
- {evo_cli-0.36.5 → evo_cli-0.37.0}/tests/test_wifi.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.37.0
|
|
@@ -286,6 +286,36 @@ def credentials(name, username, password_stdin, otp, qr, otp_url):
|
|
|
286
286
|
click.echo(f"Saved credentials for {name}. Sync explicitly with: evo cred sync push")
|
|
287
287
|
|
|
288
288
|
|
|
289
|
+
@openvpn_group.command(
|
|
290
|
+
"bypass",
|
|
291
|
+
help="Hosts kept off the tunnel while the LAN reaches them. Each connect probes them first (TCP, port 443 "
|
|
292
|
+
"unless host:port) and pins those that answer to the physical gateway; elsewhere they go through the VPN.",
|
|
293
|
+
)
|
|
294
|
+
@click.argument("name")
|
|
295
|
+
@click.argument("hosts", nargs=-1)
|
|
296
|
+
@click.option("--remove", is_flag=True, help="Remove the given hosts instead of adding them.")
|
|
297
|
+
@click.option("--clear", is_flag=True, help="Remove every host.")
|
|
298
|
+
def bypass(name, hosts, remove, clear):
|
|
299
|
+
profile = _guard(vpn.get_profile, name)
|
|
300
|
+
current = list(profile.get("bypass") or [])
|
|
301
|
+
given = [_guard(vpn.parse_bypass, host) for host in hosts]
|
|
302
|
+
if clear:
|
|
303
|
+
current = []
|
|
304
|
+
elif remove:
|
|
305
|
+
current = [host for host in current if host not in given]
|
|
306
|
+
else:
|
|
307
|
+
current = list(dict.fromkeys([*current, *given]))
|
|
308
|
+
if clear or given:
|
|
309
|
+
if current:
|
|
310
|
+
profile["bypass"] = current
|
|
311
|
+
else:
|
|
312
|
+
profile.pop("bypass", None)
|
|
313
|
+
_guard(vpn.save_profile, name, profile)
|
|
314
|
+
click.echo("\n".join(current) if current else f"{name}: no bypass hosts.")
|
|
315
|
+
if (clear or given) and _guard(vpn.request, name)["state"] != "STOPPED":
|
|
316
|
+
click.echo("Reconnect for the change to apply.", err=True)
|
|
317
|
+
|
|
318
|
+
|
|
289
319
|
@openvpn_group.command("otp", help="Print the current OTP for one explicitly selected profile (sensitive output).")
|
|
290
320
|
@click.argument("name", required=False)
|
|
291
321
|
def otp_code(name):
|
|
@@ -17,6 +17,7 @@ import subprocess
|
|
|
17
17
|
import sys
|
|
18
18
|
import time
|
|
19
19
|
from collections import deque
|
|
20
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
20
21
|
from pathlib import Path
|
|
21
22
|
from urllib.parse import parse_qs, urlparse
|
|
22
23
|
|
|
@@ -243,6 +244,95 @@ def default_gateway():
|
|
|
243
244
|
return None
|
|
244
245
|
|
|
245
246
|
|
|
247
|
+
def gateway_to(address):
|
|
248
|
+
"""The gateway ``address`` is routed through now, or None when it is on-link or the lookup fails."""
|
|
249
|
+
if sys.platform == "darwin":
|
|
250
|
+
command, pattern = ["route", "-n", "get", address], r"gateway:\s*(\S+)"
|
|
251
|
+
else:
|
|
252
|
+
command, pattern = ["ip", "-4", "route", "get", address], r"\bvia\s+(\S+)"
|
|
253
|
+
try:
|
|
254
|
+
output = subprocess.run(command, capture_output=True, text=True, timeout=5, check=False).stdout
|
|
255
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
256
|
+
return None
|
|
257
|
+
match = re.search(pattern, output)
|
|
258
|
+
return match.group(1) if match else None
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
BYPASS_PORT = 443
|
|
262
|
+
_LABEL = r"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?"
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def parse_bypass(value):
|
|
266
|
+
"""A host to keep off the tunnel while the LAN reaches it: "host" or "host:port" (the port its probe uses)."""
|
|
267
|
+
host, colon, port = value.strip().lower().partition(":")
|
|
268
|
+
if colon and not (port.isdigit() and 0 < int(port) < 65536):
|
|
269
|
+
raise CredentialError(f"Invalid port in '{value}'.")
|
|
270
|
+
if len(host) > 253 or not re.fullmatch(rf"{_LABEL}(?:\.{_LABEL})*", host):
|
|
271
|
+
raise CredentialError(f"'{value}' is not a host name or IPv4 address.")
|
|
272
|
+
return f"{host}:{int(port)}" if colon and int(port) != BYPASS_PORT else host
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def lan_bypass(entries, timeout=1.5):
|
|
276
|
+
"""The addresses of ``entries`` that the LAN reaches now through the physical gateway, to pin there.
|
|
277
|
+
|
|
278
|
+
Called before OpenVPN starts, so a probe that answers went over the LAN. On a network that reaches the
|
|
279
|
+
host by itself (inside the network the VPN leads to), a pushed route would only send it into a tunnel
|
|
280
|
+
that may not carry it. Elsewhere the probe fails and the host goes through the VPN as before. Names
|
|
281
|
+
resolve now, with the system's DNS; an address that changes during the session is not followed.
|
|
282
|
+
"""
|
|
283
|
+
gateway = default_gateway() if entries else None
|
|
284
|
+
if not gateway:
|
|
285
|
+
return []
|
|
286
|
+
targets = []
|
|
287
|
+
for entry in entries:
|
|
288
|
+
host, _, port = parse_bypass(entry).partition(":")
|
|
289
|
+
for address in remote_addresses([host]):
|
|
290
|
+
if (address, int(port or BYPASS_PORT)) not in targets:
|
|
291
|
+
targets.append((address, int(port or BYPASS_PORT)))
|
|
292
|
+
|
|
293
|
+
def answers(target):
|
|
294
|
+
if gateway_to(target[0]) != gateway:
|
|
295
|
+
return False
|
|
296
|
+
try:
|
|
297
|
+
with socket.create_connection(target, timeout=timeout):
|
|
298
|
+
return True
|
|
299
|
+
except OSError:
|
|
300
|
+
return False
|
|
301
|
+
|
|
302
|
+
with ThreadPoolExecutor(max_workers=8) as pool:
|
|
303
|
+
reached = list(pool.map(answers, targets))
|
|
304
|
+
return list(dict.fromkeys(address for (address, _), ok in zip(targets, reached) if ok))
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def lan_resolvers(path="/var/run/resolv.conf"):
|
|
308
|
+
"""The system's DNS servers that are reached through the physical gateway (macOS).
|
|
309
|
+
|
|
310
|
+
mDNSResponder sends each query out of the interface its server came from, so the system's own lookups
|
|
311
|
+
still work when a VPN pushes a route that covers the LAN's DNS server. A program with its own resolver
|
|
312
|
+
reads this file and follows the routing table instead, into a tunnel that does not answer: SpoofDPI
|
|
313
|
+
behind `evo route` then fails every name, and the browser shows ERR_TUNNEL_CONNECTION_FAILED. Pinning
|
|
314
|
+
these servers to the gateway keeps such resolvers where mDNSResponder already is. On-link servers need
|
|
315
|
+
no pin: a pushed route is never more specific than the link's own.
|
|
316
|
+
"""
|
|
317
|
+
try:
|
|
318
|
+
lines = Path(path).read_text().splitlines()
|
|
319
|
+
except OSError:
|
|
320
|
+
return []
|
|
321
|
+
candidates = []
|
|
322
|
+
for line in lines:
|
|
323
|
+
words = line.split()
|
|
324
|
+
if len(words) < 2 or words[0] != "nameserver":
|
|
325
|
+
continue
|
|
326
|
+
try:
|
|
327
|
+
address = ipaddress.IPv4Address(words[1])
|
|
328
|
+
except ValueError:
|
|
329
|
+
continue
|
|
330
|
+
if not (address.is_loopback or address.is_link_local) and str(address) not in candidates:
|
|
331
|
+
candidates.append(str(address))
|
|
332
|
+
gateway = default_gateway() if candidates else None
|
|
333
|
+
return [address for address in candidates if gateway and gateway_to(address) == gateway]
|
|
334
|
+
|
|
335
|
+
|
|
246
336
|
def remote_addresses(remotes):
|
|
247
337
|
"""IPv4 addresses of the profile's servers, resolved just before OpenVPN resolves them itself."""
|
|
248
338
|
addresses = []
|
|
@@ -727,6 +817,11 @@ def worker(name, timeout):
|
|
|
727
817
|
pinned = [] if takes_default_route(profile["config"]) else remotes
|
|
728
818
|
if profile.get("otp_url"):
|
|
729
819
|
pinned = [*pinned, urlparse(profile["otp_url"]).hostname]
|
|
820
|
+
if sys.platform == "darwin":
|
|
821
|
+
pinned = [*pinned, *lan_resolvers()]
|
|
822
|
+
if bypass := lan_bypass(profile.get("bypass") or []):
|
|
823
|
+
log.append(f"{time.strftime('%H:%M:%S')} evo: kept on the LAN: {', '.join(bypass)}")
|
|
824
|
+
pinned = [*pinned, *bypass]
|
|
730
825
|
if pinned:
|
|
731
826
|
command = pin_remotes(command, pinned)
|
|
732
827
|
if os.geteuid() != 0:
|
|
@@ -27,6 +27,8 @@ def store(tmp_path, monkeypatch):
|
|
|
27
27
|
# Keep Unix socket paths below the macOS 104-byte limit.
|
|
28
28
|
import tempfile
|
|
29
29
|
|
|
30
|
+
# The worker reads this machine's DNS servers on macOS; tests that need some set their own.
|
|
31
|
+
monkeypatch.setattr(vpn, "lan_resolvers", list)
|
|
30
32
|
with tempfile.TemporaryDirectory(prefix="evpn-", dir="/tmp") as runtime:
|
|
31
33
|
monkeypatch.setenv("EVO_OPENVPN_HOME", runtime)
|
|
32
34
|
yield tmp_path
|
|
@@ -42,6 +44,7 @@ def test_commands_registered():
|
|
|
42
44
|
"status",
|
|
43
45
|
"disconnect",
|
|
44
46
|
"log",
|
|
47
|
+
"bypass",
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
|
|
@@ -201,6 +204,146 @@ def test_split_tunnel_pins_its_server_around_openvpn(tmp_path, monkeypatch, plat
|
|
|
201
204
|
assert not (tmp_path / "pwned").exists()
|
|
202
205
|
|
|
203
206
|
|
|
207
|
+
@pytest.mark.parametrize(
|
|
208
|
+
"platform,output,gateway",
|
|
209
|
+
[
|
|
210
|
+
("darwin", " route to: 192.0.2.53\n gateway: 192.0.2.1\n interface: en0\n", "192.0.2.1"),
|
|
211
|
+
# On-link: no gateway line.
|
|
212
|
+
("darwin", " route to: 198.51.100.1\n interface: en0\n flags: <UP,HOST,DONE,LLINFO>\n", None),
|
|
213
|
+
("darwin", "", None),
|
|
214
|
+
("linux", "192.0.2.53 via 192.0.2.1 dev wlan0 src 192.0.2.7 uid 1000\n cache\n", "192.0.2.1"),
|
|
215
|
+
("linux", "198.51.100.1 dev wlan0 src 198.51.100.7 uid 1000\n cache\n", None),
|
|
216
|
+
],
|
|
217
|
+
)
|
|
218
|
+
def test_gateway_to_reads_the_route(monkeypatch, platform, output, gateway):
|
|
219
|
+
monkeypatch.setattr(vpn.sys, "platform", platform)
|
|
220
|
+
monkeypatch.setattr(vpn.subprocess, "run", lambda *a, **k: subprocess.CompletedProcess(a, 0, output, ""))
|
|
221
|
+
assert vpn.gateway_to("192.0.2.53") == gateway
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def test_lan_resolvers_are_the_dns_servers_behind_the_gateway(tmp_path, monkeypatch):
|
|
225
|
+
conf = tmp_path / "resolv.conf"
|
|
226
|
+
conf.write_text(
|
|
227
|
+
"# comment\nsearch example\n"
|
|
228
|
+
"nameserver 192.0.2.53\n" # behind the gateway: a pushed route could take it
|
|
229
|
+
"nameserver 198.51.100.1\n" # on-link
|
|
230
|
+
"nameserver 203.0.113.9\n" # already behind another gateway (a tunnel)
|
|
231
|
+
"nameserver 127.0.0.1\nnameserver 169.254.1.1\nnameserver fe80::1%en0\nnameserver\n"
|
|
232
|
+
"nameserver 192.0.2.53\n"
|
|
233
|
+
)
|
|
234
|
+
routes = {"192.0.2.53": "192.0.2.1", "203.0.113.9": "10.8.0.1"}
|
|
235
|
+
asked = []
|
|
236
|
+
monkeypatch.setattr(vpn, "gateway_to", lambda address: asked.append(address) or routes.get(address))
|
|
237
|
+
monkeypatch.setattr(vpn, "default_gateway", lambda: "192.0.2.1")
|
|
238
|
+
assert vpn.lan_resolvers(conf) == ["192.0.2.53"]
|
|
239
|
+
assert "127.0.0.1" not in asked and "169.254.1.1" not in asked
|
|
240
|
+
assert vpn.lan_resolvers(tmp_path / "missing") == []
|
|
241
|
+
# No physical gateway (the default route is a tunnel's): nothing to pin to.
|
|
242
|
+
monkeypatch.setattr(vpn, "default_gateway", lambda: None)
|
|
243
|
+
assert vpn.lan_resolvers(conf) == []
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
@pytest.mark.parametrize("platform,pinned", [("darwin", [["192.0.2.53"]]), ("linux", [])])
|
|
247
|
+
def test_worker_pins_the_lan_resolvers_on_macos(store, monkeypatch, platform, pinned):
|
|
248
|
+
# A full-tunnel profile pins nothing of its own, so only the resolvers show.
|
|
249
|
+
vpn.save_profile("m1", {"config": CERT_ONLY})
|
|
250
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO("\n"))
|
|
251
|
+
monkeypatch.setattr(vpn.os, "geteuid", lambda: 0)
|
|
252
|
+
monkeypatch.setattr(vpn.shutil, "which", lambda _: "/fake/openvpn")
|
|
253
|
+
monkeypatch.setattr(vpn.sys, "platform", platform)
|
|
254
|
+
monkeypatch.setattr(vpn, "lan_resolvers", lambda: ["192.0.2.53"])
|
|
255
|
+
seen = []
|
|
256
|
+
monkeypatch.setattr(vpn, "pin_remotes", lambda command, hosts: seen.append(hosts) or command)
|
|
257
|
+
|
|
258
|
+
def popen(command, **_):
|
|
259
|
+
raise OSError("stop before running anything")
|
|
260
|
+
|
|
261
|
+
monkeypatch.setattr(vpn.subprocess, "Popen", popen)
|
|
262
|
+
vpn.worker("m1", 10)
|
|
263
|
+
assert seen == pinned
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@pytest.mark.parametrize(
|
|
267
|
+
"value,expected",
|
|
268
|
+
[
|
|
269
|
+
("Chat.Example.com", "chat.example.com"),
|
|
270
|
+
("api-1.example.com:8443", "api-1.example.com:8443"),
|
|
271
|
+
("api.example.com:443", "api.example.com"),
|
|
272
|
+
("192.0.2.10", "192.0.2.10"),
|
|
273
|
+
("bad_host.example", None),
|
|
274
|
+
("-lead.example", None),
|
|
275
|
+
("a.example:0", None),
|
|
276
|
+
("a.example:http", None),
|
|
277
|
+
("a.example;reboot", None),
|
|
278
|
+
("", None),
|
|
279
|
+
],
|
|
280
|
+
)
|
|
281
|
+
def test_parse_bypass(value, expected):
|
|
282
|
+
if expected is None:
|
|
283
|
+
with pytest.raises(CredentialError):
|
|
284
|
+
vpn.parse_bypass(value)
|
|
285
|
+
else:
|
|
286
|
+
assert vpn.parse_bypass(value) == expected
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def test_lan_bypass_pins_only_what_the_lan_answers(monkeypatch):
|
|
290
|
+
names = {
|
|
291
|
+
"chat.example": ["192.0.2.10", "192.0.2.11"],
|
|
292
|
+
"api.example": ["192.0.2.20"],
|
|
293
|
+
"far.example": ["198.51.100.5"],
|
|
294
|
+
}
|
|
295
|
+
monkeypatch.setattr(vpn, "default_gateway", lambda: "192.0.2.1")
|
|
296
|
+
monkeypatch.setattr(vpn, "remote_addresses", lambda hosts: names.get(hosts[0], []))
|
|
297
|
+
# 198.51.100.5 is behind another gateway (a tunnel already up): never pinned to the LAN's.
|
|
298
|
+
monkeypatch.setattr(vpn, "gateway_to", lambda address: "10.8.0.1" if address == "198.51.100.5" else "192.0.2.1")
|
|
299
|
+
probed = []
|
|
300
|
+
|
|
301
|
+
def connect(target, timeout):
|
|
302
|
+
probed.append(target)
|
|
303
|
+
if target == ("192.0.2.11", 443) or target[0] == "198.51.100.5":
|
|
304
|
+
raise OSError("no answer")
|
|
305
|
+
return io.BytesIO()
|
|
306
|
+
|
|
307
|
+
monkeypatch.setattr(vpn.socket, "create_connection", connect)
|
|
308
|
+
found = vpn.lan_bypass(["chat.example", "api.example:8443", "far.example", "gone.example"])
|
|
309
|
+
assert found == ["192.0.2.10", "192.0.2.20"]
|
|
310
|
+
assert ("192.0.2.20", 8443) in probed and all(address != "198.51.100.5" for address, _ in probed)
|
|
311
|
+
monkeypatch.setattr(vpn, "default_gateway", lambda: None)
|
|
312
|
+
assert vpn.lan_bypass(["chat.example"]) == []
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def test_bypass_command_adds_removes_and_clears(store, monkeypatch):
|
|
316
|
+
vpn.save_profile("m1", {"config": CERT_ONLY})
|
|
317
|
+
runner = CliRunner()
|
|
318
|
+
result = runner.invoke(cli, ["openvpn", "bypass", "m1", "Chat.example", "api.example:8443", "chat.example"])
|
|
319
|
+
assert result.exit_code == 0, result.output
|
|
320
|
+
assert vpn.get_profile("m1")["bypass"] == ["chat.example", "api.example:8443"]
|
|
321
|
+
assert runner.invoke(cli, ["openvpn", "bypass", "m1"]).output.split() == ["chat.example", "api.example:8443"]
|
|
322
|
+
assert runner.invoke(cli, ["openvpn", "bypass", "m1", "bad_host"]).exit_code == 1
|
|
323
|
+
runner.invoke(cli, ["openvpn", "bypass", "m1", "--remove", "chat.example"])
|
|
324
|
+
assert vpn.get_profile("m1")["bypass"] == ["api.example:8443"]
|
|
325
|
+
assert "no bypass hosts" in runner.invoke(cli, ["openvpn", "bypass", "m1", "--clear"]).output
|
|
326
|
+
assert "bypass" not in vpn.get_profile("m1")
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def test_worker_pins_the_bypass_hosts_the_lan_reaches(store, monkeypatch):
|
|
330
|
+
vpn.save_profile("m1", {"config": CERT_ONLY, "bypass": ["chat.example"]})
|
|
331
|
+
monkeypatch.setattr(sys, "stdin", io.StringIO("\n"))
|
|
332
|
+
monkeypatch.setattr(vpn.os, "geteuid", lambda: 0)
|
|
333
|
+
monkeypatch.setattr(vpn.shutil, "which", lambda _: "/fake/openvpn")
|
|
334
|
+
monkeypatch.setattr(vpn.sys, "platform", "linux")
|
|
335
|
+
monkeypatch.setattr(vpn, "lan_bypass", lambda entries: ["192.0.2.10"] if entries == ["chat.example"] else [])
|
|
336
|
+
seen = []
|
|
337
|
+
monkeypatch.setattr(vpn, "pin_remotes", lambda command, hosts: seen.append(hosts) or command)
|
|
338
|
+
|
|
339
|
+
def popen(command, **_):
|
|
340
|
+
raise OSError("stop before running anything")
|
|
341
|
+
|
|
342
|
+
monkeypatch.setattr(vpn.subprocess, "Popen", popen)
|
|
343
|
+
vpn.worker("m1", 10)
|
|
344
|
+
assert seen == [["192.0.2.10"]]
|
|
345
|
+
|
|
346
|
+
|
|
204
347
|
def test_no_pin_without_a_physical_gateway_or_address(monkeypatch):
|
|
205
348
|
monkeypatch.setattr(vpn, "default_gateway", lambda: None)
|
|
206
349
|
assert vpn.pin_remotes(["openvpn"], ["198.51.100.7 1194"]) == ["openvpn"]
|
evo_cli-0.36.5/evo_cli/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.36.5
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|