Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

## Unreleased

- **Dependencies are installed with a mod.** A mod's `requires` (copied into its catalogue
entry by `catalog.py add`, and read again from the downloaded zip's `mod.json`) are met
by what's installed, or by the catalogue's version, installed first; a required mod that's
turned off is turned on. Loops, conflicts, a requirement newer than the catalogue's or not
in it, an unreadable range, and a mod for a newer HMG-API are refused before anything is
downloaded or installed. The result is checked as a whole: every mod that will be on keeps
what it requires (an update that breaks another mod's range is refused), and conflicts count
whichever side lists them. Every mod zip is downloaded and checked (SHA-256, signature,
author key, HMG-API, car) before the first install. When a mod zip requires more than the
plan said, nothing is installed and the new plan is shown for a second OK. Removing a mod
others require says which won't load.
- **A first install from the catalogue needs a known author.** The catalogue isn't signed, so
a new mod's author key from it must already be on the head unit's trusted author list (which
only HMG-API's releases bring), or the owner says yes for that mod.
- **Staged updates wait for apply.** The automatic check stages only plain updates (nothing new
installed or turned on, signed with the installed key) into `/data/hmgapi/pending/`, which
nothing loads; `engine apply` puts them in place first and keeps the previous version in
`/data/hmgapi/previous/`.
- **Home Wi-Fi joins on cars whose Wi-Fi library checks a checksum** (Ioniq 5 US 260507). The
stock library starts the car's Wi-Fi client only if `wpa_supplicant_crc32.conf` holds the
CRC-32 of `wpa_supplicant.conf`; HMG-API's saved networks didn't update it, so the client
Expand Down Expand Up @@ -36,7 +54,7 @@
- **HMG-API's own HTTPS** (`/data/hmgapi/lib/libhmgapi_fetch.so`, `core/fetch`): Android 4.4's
Java TLS can't reach GitHub, so the engine uses the unit's own `libssl.so` (TLS 1.2), on a
socket marked for home Wi-Fi only, with its own DNS lookup on home Wi-Fi's server. Tested
first as a mod on an Ioniq 5 US 260507 (HMG-API rc.10): the catalogue and three packages
first as a mod on an Ioniq 5 US 260507 (HMG-API rc.10): the catalogue and three mods
over home Wi-Fi, each with its SHA-256. Each socket has home Wi-Fi's mark and is bound to
`wlan0`, or the call fails (never an unmarked socket on the main table's mobile data, even
before the fwmark rule is in), with 20 s send and receive timeouts (connect, the handshake,
Expand Down
4 changes: 2 additions & 2 deletions core/fetch/fetch.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libhmgapi_fetch.so: one HTTPS request, or one DNS query, for HMG-API's engine (hmgapi.engine.NativeFetch):
* the catalogue, mod packages and HMG-API releases, over home Wi-Fi only (Catalog).
* the catalogue, mod zips and HMG-API releases, over home Wi-Fi only (Catalog).
*
* Android 4.4's Java TLS shares no cipher suite with GitHub, but the unit's own libssl.so
* (OpenSSL 1.0.1) has TLS 1.2 with ECDHE and AES-GCM. This opens a TCP connection, does the
Expand All @@ -9,7 +9,7 @@
*
* The server's certificate is NOT checked here: the unit's 2013 root store doesn't know GitHub's
* roots and its clock isn't reliable. Nothing fetched is trusted because of where it came from:
* a package must have the SHA-256 its catalogue entry names, and the engine checks its signature
* a mod zip must have the SHA-256 its catalogue entry names, and the engine checks its signature
* (the installed mod's author key; HMG-API's release key for HMG-API itself) and refuses a
* downgrade. A hostile network can make a check find nothing, not get code installed.
*
Expand Down
15 changes: 11 additions & 4 deletions core/hmgapid/hmgapid.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,15 @@ static int op_engine(int fd, int argc, char **argv)
if (!(seq(sub, "plan") || seq(sub, "apply") || seq(sub, "keep") || seq(sub, "restore") || seq(sub, "status")
|| seq(sub, "recover") || seq(sub, "install") || seq(sub, "remove") || seq(sub, "map") || seq(sub, "verify-map")
|| seq(sub, "usb-scan") || seq(sub, "update-hmgapi") || seq(sub, "apps") || seq(sub, "probe")
|| seq(sub, "map-car") || seq(sub, "report") || seq(sub, "problem") || seq(sub, "nemesis-sync"))) {
|| seq(sub, "map-car") || seq(sub, "report") || seq(sub, "problem") || seq(sub, "nemesis-sync")
|| seq(sub, "catalog") || seq(sub, "catalog-plan") || seq(sub, "catalog-install") || seq(sub, "updates")
|| seq(sub, "update") || seq(sub, "update-check") || seq(sub, "update-source"))) {
say(fd, "usage: engine plan | apply [--trial] [--force] | keep | restore | status | recover | install <zip> | remove <id>"
" | nemesis-sync | map | map-car [--local | --write | --forget] | verify-map | report [--usb]"
" | problem record [--no-log] [--crash-dumps] [--crash-reports] [--kernel] [--usb] [--seconds N] | problem stop\n");
" | problem record [--no-log] [--crash-dumps] [--crash-reports] [--kernel] [--usb] [--seconds N] | problem stop"
" | catalog [--refresh] | catalog-plan <id>... [--update] | catalog-install <id>... [--any-car[=<id>,...]]"
" [--any-author=<id>,...] | updates [--refresh] | update <id>... | --all | hmgapi [--force] | update-check"
" | update-source <id> catalogue | releases | off | default\n");
return 2;
}
a[n++] = APP_PROCESS;
Expand Down Expand Up @@ -1718,8 +1723,10 @@ static int op_allow(int fd, int argc, char **argv)
unsigned long long st[16];
if (seq(argv[1], "commands_reset") && argc == 3 && seq(argv[2], "on")) return forget_answers(fd);
if (!seq(argv[1], "startup_notice") && !seq(argv[1], "block_ambient_light") && !seq(argv[1], "trust_commands")
&& !seq(argv[1], "ota_updates") && !seq(argv[1], "home_wifi") && !seq(argv[1], "testing_maps") && !seq(argv[1], "no_local_points") && !answer_name(argv[1])) {
say(fd, "unknown switch (startup_notice, block_ambient_light, trust_commands, ota_updates, home_wifi, testing_maps, no_local_points, cmd.<mod>.<command>, "
&& !seq(argv[1], "ota_updates") && !seq(argv[1], "home_wifi") && !seq(argv[1], "testing_maps") && !seq(argv[1], "no_local_points")
&& !seq(argv[1], "no_update_check") && !seq(argv[1], "auto_stage_updates") && !answer_name(argv[1])) {
say(fd, "unknown switch (startup_notice, block_ambient_light, trust_commands, ota_updates, home_wifi, testing_maps, no_local_points, "
"no_update_check, auto_stage_updates, cmd.<mod>.<command>, "
"nocmd.<mod>.<command>, commands_reset)\n");
return 2;
}
Expand Down
Loading
Loading