Hi all,
I'm a little stuck here :-/ I can't get allow_trusted function from the premissions module to word. I'm receiving the following error:
May 26 18:36:24 [18825] DBG:core:parse_msg: method: <PUBLISH> May 26 18:36:24 [18825] DBG:core:parse_msg: uri: sip:saghul@10.69.69.1:5070 May 26 18:36:24 [18825] DBG:core:parse_msg: version: <SIP/2.0> May 26 18:36:24 [18825] DBG:core:parse_headers: flags=2 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bK1f7d.e63e45e5.0>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=2 May 26 18:36:24 [18825] DBG:core:parse_headers: this is the first via May 26 18:36:24 [18825] DBG:core:receive_msg: After parse_msg... May 26 18:36:24 [18825] DBG:core:receive_msg: preparing to run routing scripts... May 26 18:36:24 [18825] DBG:core:parse_headers: flags=100 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 234, <received> = <10.69.69.2>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 235, <rport> = <5060>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bKqtsklyyn>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=100 May 26 18:36:24 [18825] DBG:core:parse_headers: parse_headers: this is the second via May 26 18:36:24 [18825] DBG:maxfwd:is_maxfwd_present: value = 69 May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown protocol udp
Configuration is realli simple:
modparam("permissions", "db_url", "mysql://...") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted")
if (!allow_trusted("$si", "$proto")) { xlog("L_INFO","\n\n--NOT trusted! - $si - $proto"); sl_send_reply("403", "Forbidden"); exit; }
The trusted table seems OK:
mysql> select * from trusted; +----+------------+-------+--------------+------+ | id | src_ip | proto | from_pattern | tag | +----+------------+-------+--------------+------+ | 1 | 10.69.69.1 | any | NULL | NULL | +----+------------+-------+--------------+------+
What am I doing wrong?
Thanks in advance!! Regards,
Hello,
On 05/26/2009 07:46 PM, Saúl Ibarra wrote:
Hi all,
I'm a little stuck here :-/ I can't get allow_trusted function from the premissions module to word. I'm receiving the following error:
May 26 18:36:24 [18825] DBG:core:parse_msg: method: <PUBLISH> May 26 18:36:24 [18825] DBG:core:parse_msg: uri: sip:saghul@10.69.69.1:5070 May 26 18:36:24 [18825] DBG:core:parse_msg: version: <SIP/2.0> May 26 18:36:24 [18825] DBG:core:parse_headers: flags=2 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bK1f7d.e63e45e5.0>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=2 May 26 18:36:24 [18825] DBG:core:parse_headers: this is the first via May 26 18:36:24 [18825] DBG:core:receive_msg: After parse_msg... May 26 18:36:24 [18825] DBG:core:receive_msg: preparing to run routing scripts... May 26 18:36:24 [18825] DBG:core:parse_headers: flags=100 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 234, <received> = <10.69.69.2>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 235, <rport> = <5060>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bKqtsklyyn>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=100 May 26 18:36:24 [18825] DBG:core:parse_headers: parse_headers: this is the second via May 26 18:36:24 [18825] DBG:maxfwd:is_maxfwd_present: value = 69 May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown protocol udp
looks like the function accepts only upper case protocol id while the PV is returning lowercase, try to use transformation:
http://www.kamailio.org/dokuwiki/doku.php/transformations:devel#s.toupper
allow_trusted("$si", "$(proto{s.toupper})")
Cheers, Daniel
Configuration is realli simple:
modparam("permissions", "db_url", "mysql://...") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted")
if (!allow_trusted("$si", "$proto")) { xlog("L_INFO","\n\n--NOT trusted! - $si - $proto"); sl_send_reply("403", "Forbidden"); exit; }
The trusted table seems OK:
mysql> select * from trusted; +----+------------+-------+--------------+------+ | id | src_ip | proto | from_pattern | tag | +----+------------+-------+--------------+------+ | 1 | 10.69.69.1 | any | NULL | NULL | +----+------------+-------+--------------+------+
What am I doing wrong?
Thanks in advance!! Regards,
2009/5/26 Daniel-Constantin Mierla miconda@gmail.com:
looks like the function accepts only upper case protocol id while the PV is returning lowercase, try to use transformation:
http://www.kamailio.org/dokuwiki/doku.php/transformations:devel#s.toupper
allow_trusted("$si", "$(proto{s.toupper})")
Yes, the doc says:
Source address and transport protocol given in pvar arguments must be in string format. Valid transport protocol values are "UDP, "TCP", "TLS", and "SCTP".
However, wouldn't have the same beahviour if the second parameter is not set? AFAIK then the function would use the real transport protocolo (UDP in this case) and check it with the value in the table (ANY in this case).
Thank you all! That was so quick! I'll test right away.
2009/5/26, Daniel-Constantin Mierla miconda@gmail.com:
Hello,
On 05/26/2009 07:46 PM, Saúl Ibarra wrote:
Hi all,
I'm a little stuck here :-/ I can't get allow_trusted function from the premissions module to word. I'm receiving the following error:
May 26 18:36:24 [18825] DBG:core:parse_msg: method: <PUBLISH> May 26 18:36:24 [18825] DBG:core:parse_msg: uri: sip:saghul@10.69.69.1:5070 May 26 18:36:24 [18825] DBG:core:parse_msg: version: <SIP/2.0> May 26 18:36:24 [18825] DBG:core:parse_headers: flags=2 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bK1f7d.e63e45e5.0>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=2 May 26 18:36:24 [18825] DBG:core:parse_headers: this is the first via May 26 18:36:24 [18825] DBG:core:receive_msg: After parse_msg... May 26 18:36:24 [18825] DBG:core:receive_msg: preparing to run routing scripts... May 26 18:36:24 [18825] DBG:core:parse_headers: flags=100 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 234, <received> = <10.69.69.2>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 235, <rport> = <5060>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bKqtsklyyn>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=100 May 26 18:36:24 [18825] DBG:core:parse_headers: parse_headers: this is the second via May 26 18:36:24 [18825] DBG:maxfwd:is_maxfwd_present: value = 69 May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown protocol udp
looks like the function accepts only upper case protocol id while the PV is returning lowercase, try to use transformation:
http://www.kamailio.org/dokuwiki/doku.php/transformations:devel#s.toupper
allow_trusted("$si", "$(proto{s.toupper})")
Cheers, Daniel
Configuration is realli simple:
modparam("permissions", "db_url", "mysql://...") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted")
if (!allow_trusted("$si", "$proto")) { xlog("L_INFO","\n\n--NOT trusted! - $si - $proto"); sl_send_reply("403", "Forbidden"); exit; }
The trusted table seems OK:
mysql> select * from trusted; +----+------------+-------+--------------+------+ | id | src_ip | proto | from_pattern | tag | +----+------------+-------+--------------+------+ | 1 | 10.69.69.1 | any | NULL | NULL | +----+------------+-------+--------------+------+
What am I doing wrong?
Thanks in advance!! Regards,
-- Daniel-Constantin Mierla http://www.asipto.com/
Yeah! That did the trick, thanks!! :)
On 05/26/2009 08:38 PM, Saúl Ibarra wrote:
Yeah! That did the trick, thanks!! :)
great, welcome ... as Juha said, for next release you do not need this workaround, he just committed a fix: http://lists.sip-router.org/pipermail/sr-dev/2009-May/001913.html
Cheers, Daniel
Try setting from_pattern and tag to non-NULL values (empty is fine, but not NULL).
Saúl Ibarra wrote:
Hi all,
I'm a little stuck here :-/ I can't get allow_trusted function from the premissions module to word. I'm receiving the following error:
May 26 18:36:24 [18825] DBG:core:parse_msg: method: <PUBLISH> May 26 18:36:24 [18825] DBG:core:parse_msg: uri: sip:saghul@10.69.69.1:5070 May 26 18:36:24 [18825] DBG:core:parse_msg: version: <SIP/2.0> May 26 18:36:24 [18825] DBG:core:parse_headers: flags=2 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bK1f7d.e63e45e5.0>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=2 May 26 18:36:24 [18825] DBG:core:parse_headers: this is the first via May 26 18:36:24 [18825] DBG:core:receive_msg: After parse_msg... May 26 18:36:24 [18825] DBG:core:receive_msg: preparing to run routing scripts... May 26 18:36:24 [18825] DBG:core:parse_headers: flags=100 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 234, <received> = <10.69.69.2>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 235, <rport> = <5060>; state=6 May 26 18:36:24 [18825] DBG:core:parse_via_param: found param type 232, <branch> = <z9hG4bKqtsklyyn>; state=16 May 26 18:36:24 [18825] DBG:core:parse_via: end of header reached, state=5 May 26 18:36:24 [18825] DBG:core:parse_headers: via found, flags=100 May 26 18:36:24 [18825] DBG:core:parse_headers: parse_headers: this is the second via May 26 18:36:24 [18825] DBG:maxfwd:is_maxfwd_present: value = 69 May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown protocol udp
Configuration is realli simple:
modparam("permissions", "db_url", "mysql://...") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted")
if (!allow_trusted("$si", "$proto")) { xlog("L_INFO","\n\n--NOT trusted! - $si - $proto"); sl_send_reply("403", "Forbidden"); exit; }
The trusted table seems OK:
mysql> select * from trusted; +----+------------+-------+--------------+------+ | id | src_ip | proto | from_pattern | tag | +----+------------+-------+--------------+------+ | 1 | 10.69.69.1 | any | NULL | NULL | +----+------------+-------+--------------+------+
What am I doing wrong?
Thanks in advance!! Regards,
Saúl Ibarra writes:
May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown protocol udp
from README file:
1.4.10. allow_trusted([src_ip_pvar, proto_pvar]) ... Source address and transport protocol given in pvar arguments must be in string format. Valid transport protocol values are "UDP, "TCP", "TLS", and "SCTP".
-- juha
Juha Heinanen wrote:
Saúl Ibarra writes:
May 26 18:36:24 [18825] ERROR:permissions:allow_trusted_2: unknown protocol udp
from README file:
1.4.10. allow_trusted([src_ip_pvar, proto_pvar]) ... Source address and transport protocol given in pvar arguments must be in string format. Valid transport protocol values are "UDP, "TCP", "TLS", and "SCTP".
That seems to contradict:
http://www.kamailio.org/docs/modules/1.5.x/permissions.html#id2506350
"Possible values that can be stored in proto_col are “any”, “udp”, “tcp”, “tls”, “sctp”, and “none”. Value “any” matches always and value “none” never. "