Closed NelsonVides closed 4 years ago
Thanks for the changes! The code looks good to me but dialyzer has some objections. Did you have a chance to try the new auth methods with Tigase 8? From what I know this server supports
SCRAM-SHA-256
method.
Will try Tigase, didn't think about it. Also, I have no idea what's wrong with dialyzer, it doesn't complain locally to me 🤷♂
Dialyzer fixed, test with tigase done successfully. This was the configuration used to connect to tigase:
Specs =
[{username, <<"tigase">>},
{server, <<"localhost">>},
{host, <<"127.0.0.1">>},
{resource, <<"res1">>},
{password, <<"123456">>},
{carbons, false},
{stream_management, false},
{starttls, required},
{auth, {escalus_auth, auth_sasl_scram_sha256}}].
escalus_connection:start(Specs).
🙂
You can test with:
Thanks for the tip @Neustradamus!
I tested escalus implementation against lightwitch.org. Below there are steps I used:
lightwitch.org
dig SRV _xmpp-client._tcp.lightwitch.org
; <<>> DiG 9.10.6 <<>> SRV _xmpp-client._tcp.lightwitch.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26720
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;_xmpp-client._tcp.lightwitch.org. IN SRV
;; ANSWER SECTION: _xmpp-client._tcp.lightwitch.org. 3599 IN SRV 10 0 5222 meaveen.lightwitch.org.
;; Query time: 165 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Thu Mar 26 11:43:46 CET 2020 ;; MSG SIZE rcvd: 103
3. I learned that the XMPP server is running on address meaveen.lightwitch.org
4. In erlang shell (`rebar3 shell) I prepared the following helper fun returning connection spec (mind that my password was sanitized)
```erlang
Spec = fun(Auth) ->
[{username, <<"michalwski">>},
{server, <<"lightwitch.org">>},
{host, <<"meaveen.lightwitch.org">>},
{resource, <<"res1">>},
{password, <<"THIS_IS_NOT_MY_REAL_PASSWORD">>},
{carbons, false},
{stream_management, false},
{starttls, required},
{auth, {escalus_auth, Auth}}]
end.
AuthMethod
values: auth_scram_sha256
, auth_scram_sha384
, auth_scram_sha512
{ok, Client, _} = escalus_connection:start(Spec(AuthMethod)).
All methods worked as expected!
Nice :) I do not know why there is not SCRAM-SHA-224 in Metronome IM, @maranda has removed maybe...
Here, a refactor on escalus scram and a bunch of SCRAM-SHA-XXX new methods :)
PD: Don't say anything about the hour, I needed so much to write some code to cope with the stress. I was missing this 😂