k4yt3x / wg-meshconf

WireGuard full mesh configuration generator.
GNU General Public License v3.0
938 stars 105 forks source link

cannot find wg binary in mac bigsur #15

Closed bikramtuladhar closed 3 years ago

bikramtuladhar commented 3 years ago
which wg

Response:

/usr/local/bin/wg

Adding peer

wg-meshconf addpeer Name --address 10.1.0.1/16 --endpoint xx.xx.xx.xx

Response:

Traceback (most recent call last):
  File "/usr/local/bin/wg-meshconf", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/wg_meshconf/wg_meshconf.py", line 161, in main
    args.saveconfig,
  File "/usr/local/lib/python3.7/site-packages/wg_meshconf/database_manager.py", line 120, in addpeer
    privatekey = self.wireguard.genkey()
  File "/usr/local/lib/python3.7/site-packages/wg_meshconf/wireguard.py", line 47, in genkey
    stdout=subprocess.PIPE,
  File "/usr/local/Cellar/python@3.7/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/Cellar/python@3.7/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python@3.7/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/wg': '/usr/bin/wg'
k4yt3x commented 3 years ago

wg-meshconf defaults wg's path to be /usr/bin/wg, and I assume you already have that figured out. Instead of providing an option to specify wg binary's location, I'm thinking maybe I can just embed wg's pubkey and privkey function directly into the script to break the external dependency.

k4yt3x commented 3 years ago

I was able to remove the script's external dependency on the wg binary. Update the package and you should be able to use it without wg at all. Also thanks to @dimon222's help which made things a lot easier.

bikramtuladhar commented 3 years ago

thank you @k4yt3x and @dimon222