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

Support SCRAM-SHA-1, SCRAM-SHA-256 and SCRAM-SHA-512 🔐 #1

Closed
4 tasks done
alexanderadam opened this issue Sep 4, 2019 · 18 comments
Closed
4 tasks done

Support SCRAM-SHA-1, SCRAM-SHA-256 and SCRAM-SHA-512 🔐 #1

alexanderadam opened this issue Sep 4, 2019 · 18 comments

Comments

@alexanderadam
Copy link

alexanderadam commented Sep 4, 2019

First of all: thank you so much for your work! 🙏

It would be nice if those authentication methods would be supported:

See also XMPP wiki

PS: Just to be sure: the strongest variants should obviously be preferred because SHA-1 (see RFC 4270 and RFC 6194) and MD5 (RFC 6331) are considered obsolete

PPS: I'm not sure whether it's worth anything but Kafka and MongoDB also use SCRAM for authentication. Therefore the Ruby Kafka client and the Ruby MongoDB driver could be used as an inspiration.

@alexanderadam alexanderadam changed the title Support SCRAM-SHA-256(-PLUS), SCRAM-SHA-512(-PLUS): Support SCRAM-SHA-256(-PLUS), SCRAM-SHA-512(-PLUS) 🔐 Sep 5, 2019
@naqvis
Copy link
Owner

naqvis commented Sep 5, 2019

Thanks @alexanderadam. I did the development and testing against ejabberd and that didn't support such SASL methods. I'll try to put some effort into looking into the specs and find some servers which support this mechanism for testing purposes.

@alexanderadam
Copy link
Author

alexanderadam commented Sep 5, 2019

Maybe it would make sense to add a docker-compose.yml and/or Dockerfile for development?

There are various example available already (i.e. for ejabberd or prosody). This way you could easily spin up a server in development and configure it like you want (i.e. ejabberd for SCRAM or prosody for SCRAM).

Maybe it would even make sense to test the same image(s) on a CI system that's free for Free Software (i.e. Travis or CircleCI).

This way you (and of course also other developers) could just spin up a local server with docker-compose up and would be able to develop against a proper XMPP server.

Or record XMPP requests with VCR.cr and use the records in specs (this would be much faster of course.

And I don't know if you know it already but there's a wonderful spec library for Crystal called Spectator. It's maintainer is currently adding stubbing and mocking support to it which might come handy, too (I mention this because it's obviously easier to switch a test suite in early staged of a project).

PS: I see that the major servers have support for SCRAM-SHA-1 but @Neustradamus do you know which servers support SCRAM-SHA-256 or SCRAM-SHA-512?

PPS: @naqvis I added DIGEST-MD5 to the ticket. What do you think about it? Because on the one hand it's officially obsolete but on the other hand it's still the most common mechanism

EDIT: It seems that at least these servers are able to do SCRAM-SHA-256 and SCRAM-SHA-512:

@naqvis
Copy link
Owner

naqvis commented Sep 5, 2019

I'll be adding DIGEST-MD5 soon, while leaving other SCRAM methods for later.

@Neustradamus
Copy link

@naqvis: Why this old DIGEST-MD5 and not more secure SCRAM?

@naqvis
Copy link
Owner

naqvis commented Sep 6, 2019

@Neustradamus DIGEST-MD5 is still widely used and implemented by majority of XMPP servers. Will be adding other secure SCRAM Auth mechanisms on later basis.

@Neustradamus
Copy link

Neustradamus commented Sep 6, 2019

@naqvis: Yes of course but it must not privilegied, SCRAM is better...

Please look:

@naqvis
Copy link
Owner

naqvis commented Sep 9, 2019

Will be updating repo sometime this week with below listed SASL mechansims

  1. SCRAM-SHA-512
  2. SCRAM-SHA-256
  3. SCRAM-SHA-1
  4. DIGEST-MD5
  5. PLAIN - Already implemented
  6. Anonymous

DON'T have any plan to implement and support external channel bindings or -PLUS mechanisms.

Will comment, once updates are committed to repo.

@naqvis
Copy link
Owner

naqvis commented Sep 12, 2019

Updated repo with latest changes to support requested SASL Auth mechanisms.

@alexanderadam
Copy link
Author

awesome

You are unbelievable. I can't test this but I will close this for now (we could open this later on anyway if something is missing I guess).

Again: thank you so much! 🙏

@alexanderadam alexanderadam changed the title Support SCRAM-SHA-256(-PLUS), SCRAM-SHA-512(-PLUS) 🔐 Support SCRAM-SHA-1, SCRAM-SHA-256 and SCRAM-SHA-512 🔐 Sep 13, 2019
@Neustradamus
Copy link

@naqvis: Nice job!

@naqvis
Copy link
Owner

naqvis commented Nov 18, 2019

Thanks @Neustradamus

@Neustradamus
Copy link

@naqvis, @alexanderadam: What is missing/needed for -PLUS variant?

Have you found problems with SCRAM-SHA-512 with:

  • a Metronome IM server: lightwitch.org
  • a Jackal XMPP server: jackal.im

@alexanderadam
Copy link
Author

@Neustradamus I guess nothing is needed if you are gonna provide a PR. 👍

I'm sure naqvis would be happy to accept it.

@naqvis
Copy link
Owner

naqvis commented Jan 6, 2020

Warmly welcome PR

@Neustradamus
Copy link

@naqvis, @alexanderadam: OK one day maybe...

Can you test SCRAM-SHA-256 and SCRAM-SHA-512 with:

  • a Metronome IM server: lightwitch.org
  • a Jackal XMPP server: jackal.im

-> Observations?

@Neustradamus
Copy link

@naqvis, @alexanderadam: After 1/256/512, can you add 224/384 too and SCRAM-SHA3-512?

@Neustradamus
Copy link

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

3 participants