[GH-ISSUE #326] Auto configure as default DNS: Windows and OSX #115

Closed
opened 2026-02-26 04:34:05 +03:00 by kerem · 11 comments
Owner

Originally created by @mageddo on GitHub (Feb 27, 2023).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/326

Originally assigned to: @mageddo on GitHub.

Auto Configure

Be able to automatically configure DPS as the default DNS Server in the current OS and restore previous server when it shutdown

Windows

=> Steps

  • Create automated process to configure DPS as Windows default DNS (administrator permission required)
  • Restore the previous configured DNS server as DPS stops
  • Udate the running it docs

=> Docs
How programatically set a DNS for windows

Mac

Steps

  • Find Interfaces which have a ipv4 inet address
  • Should have a mac address or be loopback
  • Must be up

Reference

TBD

Originally created by @mageddo on GitHub (Feb 27, 2023). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/326 Originally assigned to: @mageddo on GitHub. ### Auto Configure Be able to automatically configure DPS as the default DNS Server in the current OS and restore previous server when it shutdown ### ✅ Windows => Steps * ✅ Create automated process to configure DPS as Windows default DNS (administrator permission required) * ✅ Restore the previous configured DNS server as DPS stops * ✅ Udate the running it docs => Docs How programatically set a DNS for windows * [ref 1][1] * [ref 2][2] ### ✅ Mac Steps * Find Interfaces which have a ipv4 inet address * Should have a mac address or be loopback * Must be up Reference * [List interfaces, maybe not necessary as vanilla Java can do it][4] * [Change DNS Command][5] * [ref 1][3] * https://superuser.com/questions/86184/change-dns-server-from-terminal-or-script-on-mac-os-x TBD [1]: https://stackoverflow.com/questions/7415771/how-to-change-dns-servers-programmatically-in-windows [2]: https://social.msdn.microsoft.com/Forums/en-US/47eab641-3b06-45d6-9271-a2b633312445/how-do-i-programmatically-change-dns-server-addresses?forum=vbgeneral [3]: https://stackoverflow.com/questions/5806240/its-possible-to-change-dns-programmatically-on-mac-os [4]: https://osxdaily.com/2014/09/03/list-all-network-hardware-from-the-command-line-in-os-x/ [5]: https://osxdaily.com/2015/06/02/change-dns-command-line-mac-os-x/
kerem 2026-02-26 04:34:05 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@mageddo commented on GitHub (Mar 4, 2023):

Fixed for mac since DPS 3.7.0

<!-- gh-comment-id:1454356196 --> @mageddo commented on GitHub (Mar 4, 2023): Fixed for mac since DPS 3.7.0
Author
Owner

@mageddo commented on GitHub (Mar 4, 2023):

Looks like all it's working for MAC I'm discussing at this thread #158

<!-- gh-comment-id:1454366511 --> @mageddo commented on GitHub (Mar 4, 2023): Looks like all it's working for MAC I'm discussing at [this thread](https://github.com/mageddo/dns-proxy-server/issues/158#issuecomment-1454365859) #158
Author
Owner

@mageddo commented on GitHub (Mar 6, 2023):

This a lot more difficult than I expected, can't use netsh because of netsh Windows language depending output.

Trying to use WMI instead, the JNA api to call WMI really sucks

<!-- gh-comment-id:1456122328 --> @mageddo commented on GitHub (Mar 6, 2023): This a lot more difficult than I expected, can't use netsh because of netsh Windows language depending output. Trying to use WMI instead, the JNA api to call WMI really sucks
Author
Owner

@mageddo commented on GitHub (Mar 6, 2023):

Better try a new WMI client: https://github.com/freemansoft/jacob-project

<!-- gh-comment-id:1456187271 --> @mageddo commented on GitHub (Mar 6, 2023): Better try a new WMI client: https://github.com/freemansoft/jacob-project
Author
Owner

@mageddo commented on GitHub (Mar 7, 2023):

Generated a version which comes with bundled dll: https://github.com/mageddo-projects/jacob-project

<!-- gh-comment-id:1458978555 --> @mageddo commented on GitHub (Mar 7, 2023): Generated a version which comes with bundled dll: https://github.com/mageddo-projects/jacob-project
Author
Owner

@mageddo commented on GitHub (Mar 8, 2023):

Rollback wmi based solution and used windows registry

<!-- gh-comment-id:1459262282 --> @mageddo commented on GitHub (Mar 8, 2023): Rollback wmi based solution and used windows registry
Author
Owner

@mageddo commented on GitHub (Mar 8, 2023):

CD failed https://github.com/mageddo/dns-proxy-server/actions/runs/4361050714/jobs/7624564619

<!-- gh-comment-id:1460171302 --> @mageddo commented on GitHub (Mar 8, 2023): CD failed https://github.com/mageddo/dns-proxy-server/actions/runs/4361050714/jobs/7624564619
Author
Owner

@mageddo commented on GitHub (Mar 10, 2023):

It turns out that for some reason jna-platform dependency will broken arm64 native image generation because it's conflicting with quarkus somehow, so I need to think in some options to lead with this:

✔️ => 1 Remove quarkus dependency

Just remove Quarkus from the project and use some very basic http server to provide the statics and create the few rest apis, dependency injection can be replaced by dagger.

I think it will also reduce the size of the binary considerably and maybe simplify the complexity to build an static binary on the feature, see #285

=> 2 Wait quarkus issue to be solved

It can take a lot of time and the DPS release is broken while this, see https://github.com/quarkusio/quarkus/issues/31750 for the quarkus issue

=> Disclaimer

I don't realized another way to fix this issue as I really didn't get what on quarkus and jna make it happens, actually I know that JNA approach to load the libraries on a static field is bad approach when running on native-images but is something really difficult to fix, it requires a lot of refactoring

<!-- gh-comment-id:1463275444 --> @mageddo commented on GitHub (Mar 10, 2023): It turns out that for some reason jna-platform dependency will broken arm64 native image generation because it's conflicting with quarkus somehow, so I need to think in some options to lead with this: ### ✔️ => 1 Remove quarkus dependency Just remove Quarkus from the project and use some very basic http server to provide the statics and create the few rest apis, dependency injection can be replaced by dagger. I think it will also reduce the size of the binary considerably and maybe simplify the complexity to build an static binary on the feature, see #285 ### => 2 Wait quarkus issue to be solved It can take a lot of time and the DPS release is broken while this, see https://github.com/quarkusio/quarkus/issues/31750 for the quarkus issue ### => Disclaimer I don't realized another way to fix this issue as I really didn't get what on quarkus and jna make it happens, actually I know that JNA approach to load the libraries on a static field is bad approach when running on native-images but is something really difficult to fix, it requires a lot of refactoring
Author
Owner

@mageddo commented on GitHub (Mar 10, 2023):

Okay, I'll decide this in some hours

<!-- gh-comment-id:1463275860 --> @mageddo commented on GitHub (Mar 10, 2023): Okay, I'll decide this in some hours
Author
Owner

@mageddo commented on GitHub (Mar 12, 2023):

Hope all is fixed now, waiting for the released

<!-- gh-comment-id:1465284741 --> @mageddo commented on GitHub (Mar 12, 2023): Hope all is fixed now, waiting for the released
Author
Owner

@mageddo commented on GitHub (Mar 13, 2023):

The issue is fixed, people can check on 3.9.2, for this new feature. I'm not closing this feature yet because I hope will be able to fix #306 in next hours then I would prefer to do a manual acceptance tests with the two features alive.

<!-- gh-comment-id:1466481644 --> @mageddo commented on GitHub (Mar 13, 2023): The issue is fixed, people can check on 3.9.2, for this new feature. I'm not closing this feature yet because I hope will be able to fix #306 in next hours then I would prefer to do a manual acceptance tests with the two features alive.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#115
No description provided.