(Socks) Proxy: use DNS of proxy

This issue has been tracked since 2022-11-07.

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type


🔖 Feature description

After some testing it currently seems like the that if a proxy is configured, uptime-kuma is using its own local or defined DNS server even when a proxy is defined instead of using the proxy DNS.

✔️ Solution

Add option that when a proxy is configured, to also use conduct DNS resolution through this proxy.


No response

📝 Additional Context

No response

rezzorix wrote this answer on 2022-11-10

@louislam this actually could also be considered a bug …. normally one would expect the proxy dns is used… no?

jbrunner wrote this answer on 2022-11-23

@louislam this actually could also be considered a bug …. normally one would expect the proxy dns is used… no?

IMO this is not a bug. It should be possible to switch between socks5 and socks5h.

rezzorix wrote this answer on 2022-11-23

@jbrunner not sure if you understood what I was writing... it is not possible to switch.

My point was:
Currently defining a socks will still have the uptime-container resolver try to resolve a domain.
It is not possible to define the socks resolver - which by default the logic should be: IF socks configured THEN use socks resolver.

Example of usage:
Connecting via socks to check certain hostnames on a network only accessible via socks.
You would never be able to resolve any of the hostnames if the uptime-kuma resolver is used.

jbrunner wrote this answer on 2022-11-23

@rezzorix Maybe I missed your point. I'm new to uptime-kuma and missed the feature to resolve DNS trough socks. The proposed solution works for my HTTP checks as expected.

If you change the default behaviour of the existing "Socks v5" config, you might break existing implementations.

The proposed solution provides an additional option in the UI:

  • "Socks v5" (Existing behaviour. Value is: socks5)
  • "Socks v4 (+DNS)" (New. Value is: socks5h)

IMO using socks5 does not explicit mean to resolve dns through socks. For example: curl does not resolve DNS trough socks by default:

curl -x socks5://localhost:1008 http://example.com
cur -x socks5h://localhost:1008 http://example.com
rezzorix wrote this answer on 2022-11-25

@jbrunner yes you are right, using socks5 does not explicit resolve dns through socks.

The RFC1928 does not state anything about DNS/resolving at all.

On Wikipedia it states for Socks4 & 5 that

"The server should resolve the domain name and make connection to the destination host if it can."

I have found 21+ year old bugzilla postings where exactly what I described is discussed:
SOCKS5: DNS lookups (host resolving) should occur on proxy, not client side.

If I read these threads right, then consensus is/was what I would have also expected:
That resolving should occur on proxy... but again, thats only 1 source and an old one too.

So agreed, rather than calling it a bug, it is probably better called a feature or specific configuration option that is missing in uptime-kuma.

Would be good if we could define within uptime-kuma that if proxy is used - the resolving also happens on proxy side.

For the how-to..... my coding skills are unfortunately not sufficient to tell 🙈

jbrunner wrote this answer on 2022-11-25

@rezzorix there is nothing to code. socks-proxy-agent used in server/proxy.js ships with this feature. Just provide socks5h as desired protocoll.

Anyways: According to the implementation of socks-proxy-agent the "socks" protocol defaults to "socks5h".

This makes this issue and my pull request obsolete. Just choose "SOCKS" instead of "SOCKS v5" in the UI and the proxy resolves DNS trough socks.

rezzorix wrote this answer on 2022-11-25

Oh that's very cool. Thanks for your input; really appreciate this 😃
Will try this out right away.

More Details About Repo
Owner Name louislam
Repo Name uptime-kuma
Full Name louislam/uptime-kuma
Language JavaScript
Created Date 2021-07-03
Updated Date 2022-11-30
Star Count 23666
Watcher Count 159
Fork Count 1992
Issue Count 694


Issue Title Created Date Updated Date