Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MacOS manual DNS patch and revert #252

Merged
merged 2 commits into from
Jan 17, 2020

Conversation

joaufi
Copy link

@joaufi joaufi commented Dec 10, 2019

Description

  • Removed the hard-coded skip_dns_patch = True to allow manual patching of /etc/resolv.conf on Mac OS (darwin)
  • Original /etc/resolv.conf is moved to /etc/resolv.conf.backup before overwrite
  • Added script that is called as final step before shutting down that uses the backup file to overwrite the patched /etc/resolv.conf file; backup file is removed in this process (mv -f)
  • Added requirements.txt file for local development / IDE help e.g. pip install -r requirements.txt

Testing

  • Ran locally on Mac OS Catalina version 10.15.1 and observed:
    1. /etc/resolv.conf being overwritten with values from manual-dns-patch.sh after original conf file is moved to /etc/resolv.conf.backup
    2. On SystemExit (using KeyboardInterrupt) observed /etc/resolv.conf.backup being used to overwrite /etc/resolv.conf
    3. Checked values before / after and they are accurate

Note

Running the subprocess as the final step before exiting seems pretty sloppy but this is currently just a hacky fix. If openpyn is force killed or quits in a way that doesn't allow it to shutdown gracefully then /etc/resolv.conf will be replaced on next system restart (Mac OS automatic process from my understanding). The /etc/resolv.conf.backup file will hang around though. 馃

Johnathan Fisher added 2 commits December 9, 2019 23:51
- Added Mac OS (Darwin) manual DNS patching of /etc/resolv.conf
- /etc/resolv.conf that existed originally is moved to
  /etc/resolv.conf.backup before conf file is overwritten
- On SystemExit backup file is used to overwrite /etc/resolv.conf
  thus reverting openpyn's manual patching back to user settings;
  backup file is removed by this process (uses `mv -f`)
@jotyGill
Copy link
Owner

Hi joaufi,
Thanks for the pull.

First I'll have to merge the other quite big pull. I'll piggyback merge this later.
As openpyn needs to be installed at the os level (not using --user). I don't want to specify the versions of dependencies, it could lead to breakage of other stuff. besides to develop you only need to install it using -e .

git clone https://github.com/jotyGill/openpyn-nordvpn.git
cd openpyn-nordvpn
git checkout test
sudo python3 -m pip install -e .
I should mention this somewhere..
So if you could just remove requirements.txt that would be good.

@jotyGill jotyGill merged commit 9f57378 into jotyGill:test Jan 17, 2020
@jotyGill jotyGill mentioned this pull request Oct 27, 2021
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.

None yet

2 participants