Home Creators Posts Import Register Favorites Logout

Content

The first project is landing!

I've written an autoupdater for ioquake3, with the intention of the game operating much like Google Chrome...it just stays up to date and you don't really notice. This has been a long-time wishlist item for the ioq3 team...as they are locked out of platforms like Steam, they've been stuck telling people to download the game over and over, maybe migrating their mods, or live without new features and fixes.

Once this solidifies, the official builds will just keep staying up to date, which is pretty sweet. And of course, this is optional, so it won't interfere with distro packages and such.

It's early days for this project still, but the approach feels really good--it gives me that weird calm zen feeling you get when a piece of code can't be reduced any further but still performs a disproportionately useful task.

The project is currently sitting in a GitHub Pull Request:

https://github.com/ioquake/ioq3/pull/290

The gory technical details are here:

https://raw.githubusercontent.com/rcgordon/ioq3/4729c683fd0cca6223955da36eff8b7285e6ad31/autoupdater-readme.txt

This was the "functional" project I mentioned. The "fun" project is about to drop, too, but I have to coordinate with a few others, so it'll be a few days still, I think. Stay tuned!

Files

Comments

Retro Rabbit Hole

Hi! I love the idea but I think there's a problem with the way this is implemented. When statically linking libcurl you may or may not be able to use the system's ca-certs, libcurl doesn't check that many locations iirc. I don't know how much of a concern this is on Win32 as I believe libcurl can be configured to use the system trust anchor there when building it (be sure to do that). On Linux the situation is a bit hairier as there's no one place where the trust anchor is. I think you should ship a trusted anchor with the updater. Either the pubkey of the cert used by the server, or the CA used by the cert on the server. Then with auto-updates it should also be possible to update this cert. Then you can hardcode the cert-chain location on a relative path from the auto-updater binary itself. If this is only to work with ioq3 and not be generic auto-updater you can also work around this issue entirely by not using https at all but using a different cryptographic hashing system with a known secret. Of course this secret will have to be managed by the ioq3 team then. I don't know if the infrastructure for such a thing is in place.

Ryan C. Gordon

Realistically, I'm not sure how important SSL is here, beyond SSL being just a good default in 2017. What we really need is the manifest to be signed, so we know if it was tampered with. Every file downloaded has an sha256 in the manifest, so if we can trust that, we don't need to worry about MitM attacks, or the more likely attack vector of compromising the files on a web server with a valid SSL certificate. That being said: I assume libcurl is a fairly reliable component on Linux systems, and is shipped with macOS by default too, so maybe we don't ever supply our own (and on Windows, use the OS-provided WinInet APIs instead of curl)...there are options here in any case, we just have to decide which is the best sometime soon.

Retro Rabbit Hole

Yeah, the real issue is that without access to the trust anchor some systems may never be able to validate the ssl cert. Presumably then the auto-updater fails.

Ryan C. Gordon

Following up on this, here's what we ended up doing: on Unix and macOS, we dynamically load libcurl at runtime, so we don't ever ship our own copy. We dynamically load it because we can reasonably look for libcurl.so.4 (or .3) with the symbols we need, but linking directly to a system copy causes problems, because some name it differently ("libcurl-gnutls.so.4" on Ubuntu, etc), and some version the symbols ("curl_global_init@@CURL_LIBSSL_3"), so this works out more cleanly. SSL support is provided by the OS in this case, so we assume it's configured properly with the right certificate trust details, etc. On Windows, we use WinInet instead of libcurl, which more or less works the same way (it handles proxies and SSL details for us at the OS level). After that, we added RSA signatures to the manifest, so this can be trusted with or without SSL, as neither a MitM attack or compromising the web server will let an attacker replace the update files (unless they also have the private signing key, which should be NO WHERE near the web server). I think this resolves all the concerns.