Module: kamailio
Branch: master
Commit: 852706359470d586238e7df2c1aec2511e272d04
URL: https://github.com/kamailio/kamailio/commit/852706359470d586238e7df2c1aec25…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-07-11T11:38:58+02:00
permissions: docs - elaborated more the help for allow_trusted()
---
Modified: src/modules/permissions/doc/permissions_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/852706359470d586238e7df2c1aec25…
Patch: https://github.com/kamailio/kamailio/commit/852706359470d586238e7df2c1aec25…
---
diff --git a/src/modules/permissions/doc/permissions_admin.xml b/src/modules/permissions/doc/permissions_admin.xml
index 500dc48627..935620c0df 100644
--- a/src/modules/permissions/doc/permissions_admin.xml
+++ b/src/modules/permissions/doc/permissions_admin.xml
@@ -1185,12 +1185,12 @@ if ($var(group) != -1) {
</section>
<section id ="permissions.f.allow_trusted">
<title>
- <function moreinfo="none">allow_trusted([src_ip_pvar, proto_pvar, uri_pvar])</function>
+ <function moreinfo="none">allow_trusted([src_ip_pvar, proto_pvar, furi_pvar])</function>
</title>
<para>
Checks based either on request's source address and transport
protocol or source address and transport protocol given
- in pvar arguments, and From URI of request (or uri_pvar if provided)
+ in pvar arguments, and From URI of request (or furi_pvar if provided)
if request can be trusted without
authentication. Returns <quote>1</quote> if a match is found
as described in <xref linkend="sec-trusted-requests"/>
@@ -1200,9 +1200,14 @@ if ($var(group) != -1) {
matching peer to AVP peer_tag_avp.
</para>
<para>
- Source address, transport protocol and uri given in pvar
- arguments must be in string format. Valid transport
- protocol values are (ignoring case) "any", "udp, "tcp", "tls",
+ NOTE: source IP is matched using string comparison. Be careful if the
+ IP can have different forms, for a safer alternative for matching IP
+ addresses, look at allow_source_address or allow_address().
+ </para>
+ <para>
+ Source address, transport protocol and uri given in the
+ arguments must be in string format and they can contain script variables.
+ Valid transport protocol values are (ignoring case) "any", "udp, "tcp", "tls",
"ws", "wss" and "sctp".
</para>
<para>
@@ -1214,11 +1219,15 @@ if ($var(group) != -1) {
...
if (allow_trusted()) {
t_relay();
-};
+}
...
if (allow_trusted("$si", "$proto")) {
t_relay();
-};
+}
+...
+if (allow_trusted("$si", "any", "$ai")) {
+ t_relay();
+}
...
</programlisting>
</example>
Module: kamailio
Branch: master
Commit: 581f80a09af73fd917834b5bcbca6143016b419d
URL: https://github.com/kamailio/kamailio/commit/581f80a09af73fd917834b5bcbca614…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2018-07-11T10:47:04+02:00
modules: readme files regenerated - permissions ... [skip ci]
---
Modified: src/modules/permissions/README
---
Diff: https://github.com/kamailio/kamailio/commit/581f80a09af73fd917834b5bcbca614…
Patch: https://github.com/kamailio/kamailio/commit/581f80a09af73fd917834b5bcbca614…
---
diff --git a/src/modules/permissions/README b/src/modules/permissions/README
index 631fdeae79..6e2e3b972d 100644
--- a/src/modules/permissions/README
+++ b/src/modules/permissions/README
@@ -78,7 +78,7 @@ Emmanuel Schmidbauer
4.8. allow_source_address([group_id])
4.9. allow_source_address_group()
4.10. allow_address_group(addr, port)
- 4.11. allow_trusted([src_ip_pvar, proto_pvar])
+ 4.11. allow_trusted([src_ip_pvar, proto_pvar, uri_pvar])
5. RPC Commands
@@ -183,7 +183,7 @@ Chapter 1. Admin Guide
4.8. allow_source_address([group_id])
4.9. allow_source_address_group()
4.10. allow_address_group(addr, port)
- 4.11. allow_trusted([src_ip_pvar, proto_pvar])
+ 4.11. allow_trusted([src_ip_pvar, proto_pvar, uri_pvar])
5. RPC Commands
@@ -342,7 +342,7 @@ Chapter 1. Admin Guide
* transport protocol is either "ANY" or equal to the transport
protocol of request or the transport protocol given in pvar, and
* regular expression is either empty (NULL in database) or matches
- the From URI of request.
+ the request's From (or optionally provided) URI.
Otherwise the request is rejected.
@@ -715,7 +715,7 @@ modparam("permissions", "load_backends", 1)
4.8. allow_source_address([group_id])
4.9. allow_source_address_group()
4.10. allow_address_group(addr, port)
- 4.11. allow_trusted([src_ip_pvar, proto_pvar])
+ 4.11. allow_trusted([src_ip_pvar, proto_pvar, uri_pvar])
4.1. allow_routing()
@@ -948,19 +948,19 @@ if ($var(group) != -1) {
};
...
-4.11. allow_trusted([src_ip_pvar, proto_pvar])
+4.11. allow_trusted([src_ip_pvar, proto_pvar, uri_pvar])
Checks based either on request's source address and transport protocol
or source address and transport protocol given in pvar arguments, and
- From URI of request if request can be trusted without authentication.
- Returns “1” if a match is found as described in Section 1.5, “Trusted
- Requests” and “-1” otherwise. If a match is found and peer_tag_avp has
- been defined, adds a non-NULL tag column value of the matching peer to
- AVP peer_tag_avp.
-
- Source address and transport protocol given in pvar arguments must be
- in string format. Valid transport protocol values are (ignoring case)
- "any", "udp, "tcp", "tls", "ws", "wss" and "sctp".
+ From URI of request (or uri_pvar if provided) if request can be trusted
+ without authentication. Returns “1” if a match is found as described in
+ Section 1.5, “Trusted Requests” and “-1” otherwise. If a match is found
+ and peer_tag_avp has been defined, adds a non-NULL tag column value of
+ the matching peer to AVP peer_tag_avp.
+
+ Source address, transport protocol and uri given in pvar arguments must
+ be in string format. Valid transport protocol values are (ignoring
+ case) "any", "udp, "tcp", "tls", "ws", "wss" and "sctp".
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
Module: kamailio
Branch: master
Commit: caaef0457e3c5e061ee961588394a1105e0c5850
URL: https://github.com/kamailio/kamailio/commit/caaef0457e3c5e061ee961588394a11…
Author: Roman Romanchenko <rromanchenko(a)sipwise.com>
Committer: Roman Romanchenko <rromanchenko(a)sipwise.com>
Date: 2018-07-11T11:17:49+03:00
permissions: Improve From pattern matching in kamailio permissions module
- allow_trusted() now can take optional parameter of value to match.
- provided parameter will be used instead of From header in match_res() and match_hash_table()
- documentation extended with 3-arguments allow_trusted() function description
---
Modified: src/modules/permissions/doc/permissions_admin.xml
Modified: src/modules/permissions/hash.c
Modified: src/modules/permissions/hash.h
Modified: src/modules/permissions/permissions.c
Modified: src/modules/permissions/trusted.c
Modified: src/modules/permissions/trusted.h
---
Diff: https://github.com/kamailio/kamailio/commit/caaef0457e3c5e061ee961588394a11…
Patch: https://github.com/kamailio/kamailio/commit/caaef0457e3c5e061ee961588394a11…
…dule
- allow_trusted() now can take optional parameter of value to match.
- provided parameter will be used instead of From header in match_res() and match_hash_table()
- documentation extended with 3-arguments allow_trusted() function description
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1584
-- Commit Summary --
* permissions: Improve From pattern matching in kamailio permissions module
-- File Changes --
M src/modules/permissions/doc/permissions_admin.xml (8)
M src/modules/permissions/hash.c (22)
M src/modules/permissions/hash.h (4)
M src/modules/permissions/permissions.c (2)
M src/modules/permissions/trusted.c (98)
M src/modules/permissions/trusted.h (5)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1584.patchhttps://github.com/kamailio/kamailio/pull/1584.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1584