> My guess is that it would be easy. The differences are mainly in
> exported callbacks and some missing or extra script functions.
> k version has the *challenge() functions (which were removed from ser,
> but could be re-added easily) and some pv stuff.
andrei,
i tried to add k compatible www_challenge/proxy_challenge functions to
modules_s/auth and it is not easy (at least for me). i created function
static inline int build_hf(struct sip_msg* msg, int stale, str* realm,
str* nonce, str* algorithm, int hftype, str* hf)
that just builds the hf str and then using it, it is easy to implement
current build_challenge_hf function:
int build_challenge_hf(struct sip_msg* msg, int stale, str* realm, str* nonce,
str* algorithm, int hftype)
{
str hf;
avp_value_t val;
if (build_hf(msg, stale, realm, nonce, algorithm, hftype, &hf)) {
val.s = hf;
if (add_avp(challenge_avpid.flags | AVP_VAL_STR, challenge_avpid.name,
val) < 0) {
ERR("auth: Error while creating attribute\n");
pkg_free(hf.s);
return -1;
}
pkg_free(hf.s);
return 0;
} else {
return -1;
}
}
but when i tried to implement k *_challenge functions using it, i was
not able to figure out how to create nonce parameter. also, qop is
module param in s auth.
-- juha
i have now converted k/auth_radius module to use the famed
s/auth module. all functionality of existing auth_radius is preserved
except for this:
If an empty string "" is used (as realm parameter) then the
server will generate it from the request. In case of REGISTER
requests To header
field domain will be used (because this header field
represents a user being registered), for all other messages
From header field domain will be used.
so the user needs to always give the realm ($td/$fd/...).
regarding s/auth module, there are differences in parameters as compared
to k auth module and www_challenge()/proxy_challenge() have been
replaced by digest_challenge avp. this will be shown in README example.
is it ok if i commit the changes or does anyone else care if i'm the
only radius user?
-- juha
i have noticed that after i restart sip router, it does not immediately
try to do tcp quick connect when it relays request over tcp.
after restarting sr, i start twinkle and relaying over tcp fails:
Jul 1 21:19:53 localhost /usr/sbin/sip-proxy[24197]: INFO: Routing initial SUBSCRIBE <sip:jh@vm.test.fi> to <sip:127.0.0.1:5082;transport=tcp>
Jul 1 21:19:53 localhost /usr/sbin/sip-proxy[24197]: INFO: t_relay failed with result -1
Jul 1 21:19:53 localhost /usr/sbin/sip-proxy[24197]: INFO: Routing initial PUBLISH <sip:jh@test.fi> to <sip:127.0.0.1:5082;transport=tcp>
Jul 1 21:19:53 localhost /usr/sbin/sip-proxy[24197]: INFO: t_relay failed with result -1
then i restarted twinkle and quick connect was correctly done:
Jul 1 21:20:23 localhost /usr/sbin/sip-proxy[24199]: INFO: Routing initial SUBSCRIBE <sip:jh@vm.test.fi> to <sip:127.0.0.1:5082;transport=tcp>
Jul 1 21:20:23 localhost /usr/sbin/sip-proxy[24199]: INFO: <core> [tcp_main.c:1926]: tcp_send: quick connect for 0xb4e70878
why is quick connect not done reliably?
-- juha
since people seemed to agree that s auth module is superior to k one, i
decided to try porting k auth_radius module to use s auth api and was
able to compile and build it against s auth api.
when testing the result, i get errors about "unknown command, missing
loadmodule" when script has proxy_challenge() call.
i then went and checked s auth module and found this in README:
1.4.2. proxy_challenge(realm, qop)
The function challenges a user agent. ...
however, auth_mod.c does not include such function:
/*
* Exported functions
*/
static cmd_export_t cmds[] = {
{"consume_credentials", consume_credentials, 0, 0, REQUEST_ROUTE},
{"bind_auth_s", (cmd_function)bind_auth_s, 0, 0, 0 },
{0, 0, 0, 0, 0}
};
i don't find it even with grep on s modules. where is it?
-- juha