Hi Christopher, What is the error you are getting from unbound? Can you share some bits of your configuration file? I am mainly interested in the following options: chroot: directory: module-config: python-script:
-- George On 24/10/2018 14:29, Christopher Hearn via Unbound-users wrote: > Thanks for the reply George. When I run what you suggested, I see > /usr/lib/python2.7/dist-packages, and the unboundmodule.py is indeed in > there. If I run my python script on it’s own from my shell, it works > fine. unbound itself still does not see it, nor any of the other > dependencies in that directory. Any idea why this might be? > >> On Oct 24, 2018, at 6:00 AM, [email protected] >> <mailto:[email protected]> wrote: >> >> Date: Tue, 23 Oct 2018 18:13:23 +0200 >> From: George Thessalonikefs <[email protected] >> <mailto:[email protected]>> >> To: [email protected] <mailto:[email protected]> >> Subject: Re: unbound v1.6.0 python module on debian 9 >> Message-ID: <[email protected] >> <mailto:[email protected]>> >> Content-Type: text/plain; charset=utf-8 >> >> Hi Christopher, >> >> On 23/10/2018 17:24, Christopher Hearn via Unbound-users wrote: >>> I?m trying to set up a server running unbound and a python script. >>> This is working OK on an older server running version 1.4.2. On the >>> newer one, I can?t seem to get unbound to see the python script >>> dependencies. I do recall on the old server, this was because chroot >>> was enabled. Once I disabled it in the config file via chroot: ??, >>> it was fine. It?s disabled on the new one too, but still doesn?t >>> seem to help. If I symlink the requested file from >>> /usr/lib/python2.7/dist-packages/unboundpython.py to /etc/unbound/, >>> that resolves that error, but more come up because of course it can?t >>> see the other libraries. This leads me to believe that unbound isn?t >>> looking out of /etc/unbound/ even though chroot is disabled. Is >>> there something else I?m missing? >>> >> >> I am assuming that you want to use a python script with unbound's python >> module. >> >> I see that when initializing the python module, unbound appends to the >> sys path also the directory reported by Python as the >> "platform-dependent include directory" [1]. >> >> You can find that directory by starting up the Python interpreter (the >> same that unbound will also use; in case of Python virtual environments) >> and typing: >> >> import distutils.sysconfig >> >> distutils.sysconfig.get_python_lib(1,0) >> '/usr/local/lib/python2.7/site-packages' (in my case) >> >> As a side note you can also achieve the same with chroot enabled but >> then you would need to link the same python directory structure inside >> the chroot in order for unbound to find the libraries. >> >> [1] >> https://docs.python.org/3.7/distutils/apiref.html?highlight=get_python_lib#distutils.sysconfig.get_python_lib >> >> -- George >
