-
Notifications
You must be signed in to change notification settings - Fork 89
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
modules: introduce hostctl (static dns for development) #75
base: main
Are you sure you want to change the base?
Conversation
# TODO: Uninstall when leaving the devshell | ||
# trap uninstall EXIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems hard to get right, particularly because when the user runs two dev-shells and exits one.
Modifying the system is a bit heavy-handed for a development shell. I was secretly hoping for an unprivileged solution when I saw this PR. Perhaps (userns) containers are a more appropriate solution for most use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is indeed a long term heavily politically involved solution to this: https://github.com/apetresc/nss-hostslocal. That would require lobbying for changing the way how linux system generally resolve hostfiles these days.
This particular PR is not going to get merged for this reason.
However, in a dev team setting, where you can exert certain powers over an individual's machine, this is a solution that (somewhat) works.
Co-authored-by: Robert Hensing <[email protected]>
Co-authored-by: Robert Hensing <[email protected]>
Do you think this PR is worth pursuing? It would need to have some tests. |
It might. I can try to free some time in the next few month, please keep nudging in case I'm not reactive 😄 |
Have you considered using something like userhosts? https://github.com/figiel/hosts I packaged it in the past for the purpose of using it inside a shell. It uses ldpreload to override a number of the DNS resolving functions. It doesn't need root and is basically set/reset using envvars. That said, at the moment it doesn't support osx. Also, if you have a webbrowser open already, it won't pick up the new hosts, as they are only available within the shell. |
I created #225 based on libuserhosts as a different implementation of configuring hosts entries. |
hostctl module allows to temporarily set static dns entries for development per project
What we get: