Python Module issue

Hi,

I have an issue using the unbound python module. I am trying to use it to change the behavior of the dns query, but I fail at loading the module.

I am running on Debian Wheezy, with these packages:

apt-cache policy unbound python-unbound

unbound:

Installed: 1.4.17-3

Candidate: 1.4.17-3

Version table:

*** 1.4.17-3 0

500 http://mirror.clibre.uqam.ca/debian/ wheezy/main amd64 Packages

100 /var/lib/dpkg/status

python-unbound:

Installed: 1.4.17-3

Candidate: 1.4.17-3

Version table:

*** 1.4.17-3 0

500 http://mirror.clibre.uqam.ca/debian/ wheezy/main amd64 Packages

100 /var/lib/dpkg/status

I installed everything using apt-get.

In my configuration file the settings are the following:

python:

python-script: “/etc/unbound/UnboundOfflineModule.py”

server:

module-config: “python validator iterator” # I tried mixing the validator and python module with no success

I do not use chroot config at the moment for the debug and verbosity is at 5.

The python script is located here:

ls /etc/unbound/UnboundOfflineModule.py

-rw-r–r-- 1 root root 3.6K Jul 8 09:41 /etc/unbound/UnboundOfflineModule.py

I also tried to set the owner of the file to be unbound and it didn’t change anything, the error stays the same.

Loading my personal unbound configuration file using this command throws these messages:

/usr/sbin/unbound -c /etc/unbound/unbound-edge-1.conf

[1373291338] unbound[2306:0] debug: creating udp4 socket 172.30.36.75 53

[1373291338] unbound[2306:0] debug: creating tcp4 socket 172.30.36.75 53

[1373291338] unbound[2306:0] debug: creating tcp4 socket 0.0.0.0 8961

[1373291338] unbound[2306:0] debug: switching log to syslog

Then it crashes

The errors I can retrieve from the logs are:

==> /var/log/daemon.log <==

Jul 8 09:43:54 offline unbound: [2229:0] debug: setup SSL certificates

Jul 8 09:43:54 offline unbound: [2229:0] warning: did not exit gracefully last time (2199)

Jul 8 09:43:54 offline unbound: [2230:0] debug: chdir to /etc/unbound

Jul 8 09:43:54 offline unbound: [2230:0] debug: drop user privileges, run as unbound

Jul 8 09:43:54 offline unbound: [2230:0] debug: module config: “python validator iterator”

Jul 8 09:43:54 offline unbound: [2230:0] notice: init module 0: python

Jul 8 09:43:54 offline unbound: [2230:0] error: pythonmod: can’t parse Python script /etc/unbound/UnboundOfflineModule.py

Jul 8 09:43:54 offline unbound: [2230:0] error: module init for module python failed

Jul 8 09:43:54 offline unbound: [2230:0] fatal error: failed to setup modules

The unboundmodule.py is located here: /usr/lib/python2.7/dist-packages/unboundmodule.py

On the other hand, my python script is well installed and working, that I can confirm because in there I wrote a main function to which I added a command line interface and I can use it at the command line. So I know it is not missing a python library or even because it is not on the python path.

Do you have any idea of what could be the problem of parsing the python script? What I am missing to get this to work?

Regards

Dominick

Dominick Rivard,
Solutions Architect

image001

5275 Queen Mary
Montréal, Qc
H3W 1Y3
Tel: 514-385-4448 ext 126
Fax: 514-385-6660

Notice: This message is confidential and privileged. If you are not the addressee, please inform the sender by return e-mail immediately and delete this message and destroy all copies.

Avis : Ce message est confidentiel et protégé par le secret professionnel. Si vous n’êtes pas le destinataire, veuillez informer l’expéditeur par courrier électronique immédiatement et effacer ce message et en détruire toute copie.

Hi,

While I am still trying to fix my own issue, I figured out that I am unable from the command line tool ipython to import the _unboundmodule. See the error:

In [1]: import unboundmodule

(attachments)

image001.jpg