JustinTulloss / zeromq.node

Node.js bindings to the zeromq library
MIT License
1.65k stars 284 forks source link

Curve Auth error #304

Open felipegs opened 10 years ago

felipegs commented 10 years ago

I'am trying to configure zeromq with curve authentication,

var socket = zeromq.socket('rep'); socket.identity = 'server' + process.pid;

socket.zap_domain = "test";

socket.curve_server = 1;

and I got this error Error: Invalid argument at null.curve_server (/Users/felipe/Documents/workspace/cockpit-proxy/node_modules/zmq/lib/index.js:236:22) at Object.<anonymous> (/Users/felipe/Documents/workspace/cockpit-proxy/lib/receiver.js:43:21) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3

msealand commented 10 years ago

What version of libzmq do you have installed? You'll need at least 4.0 for curve authentication to work.

felipegs commented 10 years ago

$ brew info zeromq zeromq: stable 4.0.4, HEAD with libsodium Plain auth it is ok!

msealand commented 10 years ago

Do you have libsodium installed? libzmq needs it for curve encryption. If you don't, you may need to install libsodium, and then reinstall libzmq for it to pick it up.

EDIT: D'oh, I just saw that you said libsodium was installed already... sorry.

msealand commented 10 years ago

Do you happen to remember which order you installed libsodium and zeromq? I tried reproducing this and I was able to trigger the error by installing zeromq first and then libsodium. I then fixed it by uninstalling both and installing libsodium first and zeromq second. (This was on a Mac using Homebrew)

felipegs commented 10 years ago

Yes, that's it. I installed again libsodium and zeromq, and it works perfectly!

Thanks

On 20 May 2014 21:13, Michael Sealand notifications@github.com wrote:

Do you happen to remember which order you installed libsodium and zeromq? I tried reproducing this and I was able to trigger the error by installing zeromq first and then libsodium. I then fixed it by uninstalling both and installing libsodium first and zeromq second. (This was on a Mac using Homebrew)

— Reply to this email directly or view it on GitHubhttps://github.com/JustinTulloss/zeromq.node/issues/304#issuecomment-43699048 .

Felipe Santos

allofthesepeople commented 10 years ago

Did the above but am still getting this; appears lib sodium is available:

$ brew info zmq
zeromq: stable 4.0.4 (bottled), HEAD
http://www.zeromq.org/
/usr/local/Cellar/zeromq/4.0.4 (62 files, 2.8M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/commits/master/Library/Formula/zeromq.rb
==> Dependencies
Build: pkg-config ✔
Optional: libsodium ✔
==> Options
--universal
    Build a universal binary
--with-libsodium
    Build with libsodium support
--with-pgm
    Build with PGM extension
--HEAD
    install HEAD version
==> Caveats
To install the zmq gem on 10.6 with the system Ruby on a 64-bit machine,
you may need to do:

    ARCHFLAGS="-arch x86_64" gem install zmq -- --with-zmq-dir=/usr/local/opt/zeromq

Any other ideas?

allofthesepeople commented 10 years ago

This seems to be an issue with the mac install (possibly my setup), just did a clean install on vagrant and all is working as expected.

allofthesepeople commented 10 years ago

For anyone else running into this:

unlike building from source, you must specify --with-libsodium for homebrew (brew install zeromq --with-libsodium).

mattias01 commented 10 years ago

@allofthesepeople Thanks! To get it to work with czmq I did:

brew uninstall czmq
brew uninstall zeromq
brew uninstall libsodium
brew install libsodium
brew install zeromq --with-libsodium
brew install czmq
allofthesepeople commented 10 years ago

@mattias01 no problem, glad it helped someone else