8000 Implement HTTP proxy option (#515). by solemnwarning · Pull Request #521 · jetkvm/kvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement HTTP proxy option (#515). #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

solemnwarning
Copy link

This commit adds a "Proxy" field to the network settings screen, which can be used to specify a HTTP proxy for any outgoing requests from the device.

For testing, I have confirmed direct connections to check for updates work when the device is on an unrestricted network with no proxy set, and proxied connections to check for updates work when the device is on a network without a direct route to the Internet.

I haven't tested the HTTP ti 8000 me syncing or actual download/install of updates as I'm not sure how to exercise them.

@CLAassistant
Copy link
CLAassistant commented May 24, 2025

CLA assistant check
All committers have signed the CLA.

@solemnwarning
Copy link
Author

Is this change waiting on me to resolve the linter error or will someone do that when reviewing/merging it? The "File is not properly formatted (goimports)" message isn't exactly clear what it wants.

@solemnwarning
Copy link
Author
solemnwarning commented May 26, 2025

I've verified software updates work now through the following process:

Build and install app using following commands:

$ make build_release VERSION=0.3.0
$ ssh root@jetkvm 'cat > /userdata/jetkvm/jetkvm_app.update' < bin/jetkvm_app
$ ssh root@jetkvm 'reboot'

After which I could install the official 0.4.1 app update from the restricted network.

Copy link
Contributor
@ym ym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please fix the linter errors and rename 'proxy' to 'http_proxy'? 'Proxy' sounds too generic, and doesn't include SOCKS5 or other types of proxy.

@solemnwarning
Copy link
Author

@ym if you can tell me what exactly the linter wants I'll get right on it (all I found when googling the error string was other linter runs).

FYI SOCKS proxies could be supported in the future (the Go HTTP client does in fact have built-in support), I just limited it to plain HTTP for the time being to keep it simple, but I'll do the rename anyway since its specifically for the HTTP client (unless you think there may be other connections made by the JetKVM in the future which should be able to be proxied).

@ym
Copy link
Contributor
ym commented May 27, 2025

You can run the linter locally using the following command:

golangci-lint run --verbose

To install golangci-lint, please refer to the official installation guide:
https://golangci-lint.run/welcome/install/#local-installation

@@ -111,10 +113,16 @@ func queryHttpTime(
ctx context.Context,
url string,
timeout time.Duration,
proxyFunc func(*http.Request) (*url.URL, error),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is correct, I suspect we shouldn't really be trusting the clocks on HTTP Proxy server :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the device is on a network where a proxy is required to access the Internet and we want to sync time from a HTTP server, then we don't have much choice here... plus these are plaintext HTTP requests, so if the device is on a hostile network then those servers could be impersonated anyway.

Ensuring integrity of a time source is difficult when you don't have a valid one to start with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I'm thinking about it, I wonder if the software should set the device clock to the software build time at boot and reject network times which are older than that, as a protection against a hostile time source being combined with old certificates. Its not perfect, but assuming the software continues to be updated semi-regularly its an improvement.

Copy link
Contributor
@IDisposable IDisposable May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I'm thinking about it, I wonder if the software should set the device clock to the software build time at boot and reject network times which are older than that, as a protection against a hostile time source being combined with old certificates.

I like that idea!

Of course that would not be in the scope of this PR :)

Copy link
Contributor
@IDisposable IDisposable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

This commit adds a "Proxy" field to the network settings screen, which
can be used to specify a HTTP proxy for any outgoing requests from the
device.
@solemnwarning solemnwarning requested a review from ym May 31, 2025 19:32
@solemnwarning
Copy link
Author

@ym is there anything still blocking this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0