Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to decode radius packet without secret? #10

Closed
chrisdew opened this issue Aug 6, 2014 · 4 comments
Closed

How to decode radius packet without secret? #10

chrisdew opened this issue Aug 6, 2014 · 4 comments

Comments

@chrisdew
Copy link
Contributor

chrisdew commented Aug 6, 2014

Wireshark can decode the fields of a radius packet without a secret.

This makes me think that the secret is not needed for decoding. Why does the node-radius API require it?

I have a server with multiple secrets, and need to know the value of an attribute inside of the radius packet, in order to choose which secret to use.

How can I achieve this?

@muirmanders
Copy link
Contributor

The secret is needed to decrypt the User-Password if present, and to verify the authenticator and/or Message-Authenticator . If the packet can be decoded but the authenticator does not match, the library throws a radius.InvalidSecretError exception with the decoded packet set as the exception's "decoded" attribute.

var decoded;
try {
  decoded = radius.decode({packet: msg, secret: ''});
} catch (e) {
  if (e instanceof radius.InvalidSecretError) {
    decoded = e.decoded;
  } else {
    // handle other decoding error
  }
}

@chrisdew
Copy link
Contributor Author

chrisdew commented Aug 6, 2014

Thanks for your quick answer.

Would you be interested in a pull request so that decode doesn't raise an InvalidSecretError if secret is explicitly set as null.

If it's not going to make it into the mainline code, I'll just use the code you wrote above.

@muirmanders
Copy link
Contributor

I would prefer adding a separate method to make it clear it is unsafe since it wouldn't force the user of the library to handle un-authenticatable messages. Also, passing in a null secret could very well be the result of an application error when using the library, in which case the accept-all-packets behavior might be unexpected.

@muirmanders muirmanders reopened this Aug 6, 2014
@chrisdew
Copy link
Contributor Author

chrisdew commented Sep 8, 2014

Code was written and merged in 36248dc and 475bba0

@chrisdew chrisdew closed this as completed Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants