Repository navigation
Helpdesk access from the U-Boot environment: fw_setenv vtesse <server> (#64) - #66
Conversation
- vtesse (the server) and vtesse_port, vtesse_session / vtesse_id_from, vtesse_password, vtesse_ip, vtesse_gw are read with fw_printenv and override /etc/vtesse.conf key by key (command line first). - With only vtesse set, the defaults of OpenIPC's VTun client: port 5000, session = MAC of the default-route interface, password = SHA-1 of "<MAC>\n" (echo "$MAC" | sha1sum), so the same server accepts it. - --show-config prints the settings in effect, --no-env ignores the variables. - S99vtesse and vtesse.init start without /etc/vtesse.conf when vtesse is set; --install needs no keys then and stores given keys with fw_setenv; --uninstall leaves the variables. - The default interface for the device ID must have a MAC (shared in env.c). - tests/test_env.c: SHA-1 vectors and the VTun password; test_install.sh: the environment with a fake fw_printenv / fw_setenv.
PR Summary by QodoEnable helpdesk access through the U-Boot environment
AI Description
Diagram
High-Level Assessment
Files changed (18)
|
Code Review by Qodo
1.
|
- A failed fw_setenv stops --install before the service starts; storing vtesse_session clears vtesse_id_from and the reverse. - --root does not use this machine's U-Boot environment. - With the server in the environment and no config file, --install with some keys stores them there instead of demanding a full config. - The MAC-derived password also applies with an explicit vtesse_session (default-route interface). - vtesse_port must be 1..65535: a typo is refused, not turned into 5000. - READMEs: the variables are readable with root or a flash dump, and the derived password is no secret.
99087cc to
16a18e9
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit 16a18e9 |
- A failed fw_setenv restores the variables already written in that run. - An environment-only --install refuses --gw without --ip / vtesse_ip. - --show-config also lists routes, UDP relays and the SOCKS5 user. - --uninstall --root does not report this machine's variables.
16a18e9 to
d2aad04
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit d2aad04 |
- The derived password uses the default-route interface, as OpenIPC's tunnel does, whatever vtesse_id_from names for the session. - An invalid port= in the file is refused instead of becoming 5000. - A U-Boot value too long for its field is reported, not silently dropped.
91f2834 to
b85f3e8
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit b85f3e8 |
- Every vtesse_* variable overrides its key also without vtesse; only the server variable allows a missing file and brings the VTun defaults. - --install writes the variables in one fw_setenv -s - batch on stdin: the password never shows in the process list, and nothing is half written (replaces the rollback). - --show-config refuses a session name the client would refuse.
b85f3e8 to
5be36d4
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit 5be36d4 |
|
/review |
|
Code review by qodo was updated up to the latest commit fe6ddad |
|
Code review by qodo was updated up to the latest commit 25d2365 |
|
/review |
|
Code review by qodo was updated up to the latest commit 62894b6 |
|
/review |
|
Code review by qodo was updated up to the latest commit 4bc239a |
|
/review |
|
Code review by qodo was updated up to the latest commit d079193 |
|
/review |
|
Code review by qodo was updated up to the latest commit 890a797 |
- --install with the server in the U-Boot environment, no config file and no fw_setenv keeps the given keys in /etc/vtesse.conf instead of refusing for a missing server and password; a key whose variable is already set is refused, as the variable would override the file. - ve_set_script() restores the previous SIGPIPE disposition after the write, so the commands started later do not inherit SIG_IGN. - With no config file, --install --host NEW names the new server.
- While vtesse (the server) is set, build_config() takes the server, the defaults and the derived password as coming from the environment: a keys-only /etc/vtesse.conf no longer breaks a later --install, and gets no port or id_from defaults. - Without fw_setenv, a given key whose vtesse_* variable is set is refused also when the config file exists (env_conflict replaces build_env_file).
- --show-config checks the file's udp_relay entries as a start does. - ve_load() uses nothing from a fw_printenv that failed, and says so when it printed vtesse variables (no fw_env.config stays silent). - ve_set() is gone: --install writes only through the fw_setenv -s batch.
- The fw_setenv script is built with a bounds check (script_add); too long settings stop --install instead of overrunning the buffer. - --install refuses control characters in any value. - While vtesse is set, a valid vtesse_port lets a reinstall keep a file whose port is invalid (the variable wins at runtime). - S99vtesse: with --no-env in ARGS the environment does not stand in for a missing config file.
- While vtesse is set, vtesse_session or vtesse_id_from lets a reinstall keep a file with both session and id_from (the variable replaces both).
- --install writes the U-Boot environment only when fw_printenv read it (ve_t.ok) and fw_setenv is in PATH: u-boot-tools without fw_env.config (a PC, a router) no longer make an install with keys fail; the step is skipped as without fw_setenv.
- vtesse_session and vtesse_id_from both set: the client refuses to start instead of picking one by the order of the variables. - With only the server in the environment, a start (not --show-config) waits up to 60 s for a default route through an interface with a MAC before the VTun defaults fall back to eth0: Wi-Fi uplinks get their route after S99vtesse.
- A default route is destination and mask 0 (a VPN's 0.0.0.0/1 is not). - The boot wait ends at any default route; through PPPoE or tun (no MAC) eth0 is taken at once instead of after 60 s. - ip prefixes are parsed digits only: "/garbage" is refused, not /0.
|
/review |
890a797 to
76df998
Compare
|
Code review by qodo was updated up to the latest commit 76df998 |
Closes #64. Version 1.15.0.
Helpdesk access with one command, the way OpenIPC does it for VTun:
What changes
cli/env.c: reads the variables with onefw_printenv;vtesse= host, optionalvtesse_port,vtesse_session/vtesse_id_from,vtesse_password,vtesse_ip,vtesse_gw. Everything else stays in/etc/vtesse.conf.tunnel: port 5000, session = MAC of the default-route interface without colons, password =echo "$MAC" | sha1sum(SHA-1 of the upper-case MAC with colons and a newline; a small SHA-1 inenv.c). The interface must have a MAC the client accepts./etc/vtesse.conf, defaults. A missing config file is fine whenvtesseis set.--show-config(the settings in effect, then exit) and--no-env.S99vtesseandvtesse.initstart without/etc/vtesse.confwhenvtesseis set.--install: works without keys and without a config whenvtesseis set; keys given are also stored withfw_setenvwhen available (never with--root).--uninstallleaves the variables and says so.docs/usage.md(new section),docs/security.md(the derived password is not a secret), READMEs (one paragraph each), CHANGELOG.Tests
tests/test_env.c: SHA-1 vectors (empty,abc, two-block, 1 M ×a, padding at 55/56/64 bytes) and the VTun password; run natively and under qemu (arm32, big-endian mips).tests/test_install.shwith a fakefw_printenv/fw_setenv: defaults with only the server (compared withsha1sumof the real interface MAC), env overriding the file key by key,--no-env, no file and no variable refused,--installwithout keys, nofw_setenvunder--root,--uninstallleaving the variables.-D_FORTIFY_SOURCE=3,LWIP=0and minimal builds without warnings;bench/bench.sh tap-testpasses./tmp, the real environment only read): with onlyvtesse=<server>,--show-configgave session and password byte for byte equal to what the stocktunnelscript computes on the same camera.