packer: do not query http if https works#94
Closed
oliverpool wants to merge 1 commit intogokrazy:mainfrom
Closed
Conversation
Contributor
|
With commit 9a95191, I have added a first test for the 'gok update' code path. It’s using a fake HTTP server right now, but I want to switch that to using running the test instance in a VM, and then we can test switching a running instance to TLS and similar. |
stapelberg
added a commit
that referenced
this pull request
Nov 29, 2025
stapelberg
added a commit
to stapelberg/tools
that referenced
this pull request
Nov 29, 2025
stapelberg
added a commit
that referenced
this pull request
Nov 29, 2025
While adding the integration test for https://gokrazy.org/userguide/tls-for-untrusted-networks/, I noticed that the packer does not actually successfully complete the initial HTTPS deployment (where -insecure is used). After writing the image to disk and rebooting, the packer was stuck at: device not yet reachable: Get "https://localhost:9080/": http: server gave HTTP response to HTTPS client related to #94
stapelberg
added a commit
that referenced
this pull request
Dec 9, 2025
This check was broken: it tried to construct a http URL by changing the updateBaseUrl schema instead of constructing such a URL based on the configured HTTPPort. I also don’t think this check is useful: HTTPS will be used for updates regardless of the check. Even if an attacker intercepted HTTP traffic and removed the redirect, that has no bearing on the update, so why bother checking. One thing the check (implicitly) did is the required fallback on initial installation when --insecure is specified. We now solve that by falling back from HTTPS to HTTP explicitly (only when --insecure is specified, of course). related to #94
Contributor
|
I have fixed this issue in commit ba6a893 instead. As you suspected when you said this code is subtle, there was more to it: the initial deployment with the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to #78 and #79:
Currently when I try to make an update and nothing is listening on port 80, I get:
I don't really understand why http is probed, if I want to update via https. At least it should check against to custom port 8080.
In this PR, I propose to probe directly on the https endpoint instead (but this part of the code seems to be quite subtle, and maybe I did something wrong).