apnex/bind-cli

UnhandledPromiseRejectionWarning

Opened this issue · 3 comments

I tried installation on CentOS 7 with bind9 but I always get some error.

Tried using rndc configuration as per readme instruction:

[root@dns named]# bind-cli record.create noc-dub-dns02.lab.noc 192.168.168.101
[INFO]: bind [record.create] records [noc-dub-dns02.lab.noc:192.168.168.101]
rndc: connection to remote host closed
This may indicate that
* the remote server is using an older version of the command protocol,
* this host is not authorized to connect,
* the clocks are not synchronized,
* the key signing algorithm is incorrect, or
* the key is invalid.
rndc: connection to remote host closed
This may indicate that
* the remote server is using an older version of the command protocol,
* this host is not authorized to connect,
* the clocks are not synchronized,
* the key signing algorithm is incorrect, or
* the key is invalid.

Tried with generated rdcn configuration via webmin:

[root@dns etc]# bind-cli record.create noc-dub-dns02.lab.noc 192.168.168.101
[INFO]: bind [record.create] records [noc-dub-dns02.lab.noc:192.168.168.101]
WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
(node:16412) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined
    at /usr/lib/node_modules/bind-cli/lib/xzonedb.js:39:15
    at new Promise (<anonymous>)
    at Object.self.parse (/usr/lib/node_modules/bind-cli/lib/xzonedb.js:38:9)
    at Object.self.refresh (/usr/lib/node_modules/bind-cli/lib/xzonedb.js:22:26)
(node:16412) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:16412) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

apnex commented

Hi cyb3rw0lf - I've briefly poked around with this on a CentOS7 installation and have been able to reproduce the issue - it is caused by a combination of changes in NAMED installation paths, directory permissions, and an assumption in the bind-cli code that the xzonedb.json file lives at /var/bind. The fix for this will require a combination of code tweaks (to handle different paths), and some updates to the readme steps. Let me dig a little deeper and get this sorted. In the interim - you can use the Docker instructions to use this.

apnex commented

Ok, got this working - found 3 issues:

  1. Centos 7/8 assumes /var/named, bind-cli assumes /var/bind
    -- Ensure that /var/bind is created with correct permissions for named:named user

  2. Centos 7/8 assumes /etc/ rather than /etc/bind for conf rndc/bind conf files
    -- I've updated readme to reflect the conf locations

  3. Session.key location for nsupdate needed to be hard set
    -- I've updated named.conf to specify session.key location for nsupdate

You'll need to clear any jnl or zone files, and restart named service for changes to take effect.

This is a somewhat 'manual' update to have this working on Centos - I intend to create an installer bash script to automate this process

Let me know how you go

same here, centos 7
cheers

bind-cli zone.list
WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
(node:944) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined
    at /usr/lib/node_modules/bind-cli/lib/xzonedb.js:39:15
    at new Promise (<anonymous>)
    at Object.self.parse (/usr/lib/node_modules/bind-cli/lib/xzonedb.js:38:9)
    at Object.self.refresh (/usr/lib/node_modules/bind-cli/lib/xzonedb.js:22:26)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:944) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.