Copyright © 2003 Miklos Tirpak
default_allow_file
(string)default_deny_file
(string)check_all_branches
(integer)allow_suffix
(string)deny_suffix
(string)db_url
(string)db_mode
(integer)trusted_table
(string)source_col
(string)proto_col
(string)from_col
(string)allow_routing()
allow_routing(basename)
allow_routing(allow_file, deny_file)
allow_register(basename)
allow_register(allow_file, deny_file)
allow_trusted()
default_allow_file
parameterdefault_deny_file
parametercheck_all_branches
parameterallow_suffix
parameterdeny_suffix
parameterdb_url
parameterdb_mode
parametertrusted_table
parametersource_col
parameterproto_col
parameterfrom_col
parameterallow_routing
usageallow_routing(basename)
usageallow_routing(allow_file, deny_file)
usageallow_register(basename)
usageallow_register(allow_file, deny_file)
usageallow_trusted()
usageThe module can be used to determine if a call has appropriate permission to be established. Permission rules are stored in plaintext configuration files similar to hosts.allow and hosts.deny files used by tcpd.
When allow_routing
function is
called it tries to find a rule that matches selected fields of the
message.
OPENSER is a forking proxy and therefore a single message can be sent to different destinations simultaneously. When checking permissions all the destinations must be checked and if one of them fails, the forwarding will fail.
The matching algorithm is as follows, first match wins:
Create a set of pairs of form (From, R-URI of branch 1), (From, R-URI of branch 2), etc.
Routing will be allowed when all pairs match an entry in the allow file.
Otherwise routing will be denied when one of pairs matches an entry in the deny file.
Otherwise, routing will be allowed.
A non-existing permission control file is treated as if it were an empty file. Thus, permission control can be turned off by providing no permission control files.
From header field and Request-URIs are always compared with regular expressions! For the syntax see the sample file: config/permissions.allow.
In addition to call routing it is also possible to check REGISTER messages and decide--based on the configuration files--whether the message should be allowed and the registration accepted or not.
Main purpose of the function is to prevent registration of "prohibited" IP addresses. One example, when a malicious user registers a contact containing IP address of a PSTN gateway, he might be able to bypass authorization checks performed by the SIP proxy. That is undesirable and therefore attempts to register IP address of a PSTN gateway should be rejected. Files config/register.allow and config/register.deny contain an example configuration.
Function for registration checking is called
allow_register
and the algorithm
is very similar to the algorithm described in
Section 1.1.1. The only difference is in
the way how pairs are created.
Instead of From header field the function uses To header field because To header field in REGISTER messages contains the URI of the person being registered. Instead of the Request-URI of branches the function uses Contact header field.
Thus, pairs used in matching will look like this: (To, Contact 1), (To, Contact 2), (To, Contact 3), and so on..
The algorithm of matching is same as described in Section 1.1.1.
A request can be trusted either via authentication, either based on
its source. allow_trusted
checks based on request's source address, protocol and FROM field
if request can be trusted.
The following modules must be loaded before this module:
No dependencies on other OpenSER modules.
The following libraries or applications must be installed before running OpenSER with this module loaded:
None.
default_allow_file
(string)Default allow file used by functions without parameters. If you don't specify full pathname then the directory in which is the main config file is located will be used.
Default value is "permissions.allow".
default_deny_file
(string)Default file containing deny rules. The file is used by functions without parameters. If you don't specify full pathname then the directory in which the main config file is located will be used.
Default value is "permissions.deny".
check_all_branches
(integer)If set then allow_routing functions will check Request-URI of all branches (default). If disabled then only Request-URI of the first branch will be checked.
Do not disable this parameter unless you really know what you are doing. |
Default value is 1.
allow_suffix
(string) Suffix to be appended to basename to create filename of the allow file when version
with one parameter of either allow_routing
or
allow_register
is used.
Including leading dot. |
Default value is ".allow".
deny_suffix
(string) Suffix to be appended to basename to create filename of the deny file when version
with one parameter of either allow_routing
or
allow_register
is used.
Including leading dot. |
Default value is ".deny".
db_url
(string) DB URL used by allow_trusted
function to load all trusted sources.
Default value is "NULL".
db_mode
(integer) Specifies the way allow_trusted
function should use access the data from DB. A 0 value means no cache -
each time, the function will query the DB. A non-0 values means cache -
DB containts is loaded at startup, the function using the memory cache.
Default value is "0 (no cache)".
trusted_table
(string) Name of the DB table to be used by
allow_trusted
for getting the
trust rules.
Default value is "trusted".
source_col
(string) Name of the DB column to contain the source address for the
trusted rules (used by
allow_trusted
)
Default value is "src_ip".
proto_col
(string) Name of the DB column to contain the incoming protocol used by the
trusted rules (used by
allow_trusted
)
Default value is "proto".
from_col
(string) Name of the DB column to contain the incoming FROM URI pattern used
by the trusted rules (used by
allow_trusted
)
Default value is "from_pattern".
allow_routing()
Returns true if all pairs constructed as described in Section 1.1.1 have appropriate permissions according to the
configuration files. This function uses default configuration files specified in
default_allow_file
and default_deny_file
.
allow_routing(basename)
Returns true if all pairs constructed as described in Section 1.1.1 have appropriate permissions according to the configuration files given as parameters.
Meaning of the parameters is as follows:
basename - Basename from which allow and deny
filenames will be created by appending contents of
allow_suffix
and deny_suffix
parameters.
If the parameter doesn't contain full pathname then the function expects the file to be located in the same directory as the main configuration file of the server.
allow_routing(allow_file, deny_file)
Returns true if all pairs constructed as described in Section 1.1.1 have appropriate permissions according to the configuration files given as parameters.
Meaning of the parameters is as follows:
allow_file - File containing allow rules.
If the parameter doesn't contain full pathname then the function expects the file to be located in the same directory as the main configuration file of the server.
deny_file - File containing deny rules.
If the parameter doesn't contain full pathname then the function expects the file to be located in the same directory as the main configuration file of the server.
allow_register(basename)
The function returns true if all pairs constructed as described in Section 1.1.2 have appropriate permissions according to the configuration files given as parameters.
Meaning of the parameters is as follows:
basename - Basename from which allow and deny
filenames will be created by appending contents of
allow_suffix
and deny_suffix
parameters.
If the parameter doesn't contain full pathname then the function expects the file to be located in the same directory as the main configuration file of the server.
allow_register(allow_file, deny_file)
The function returns true if all pairs constructed as described in Section 1.1.2 have appropriate permissions according to the configuration files given as parameters.
Meaning of the parameters is as follows:
allow_file - File containing allow rules.
If the parameter doesn't contain full pathname then the function expects the file to be located in the same directory as the main configuration file of the server.
deny_file - File containing deny rules.
If the parameter doesn't contain full pathname then the function expects the file to be located in the same directory as the main configuration file of the server.
allow_trusted()
Checks based on request's source address, protocol and FROM field if request can be trusted without authentication. Possible protocol values are "any" (that matches any protocol), "tcp", "udp", "tls" and "sctp".
Take a look at http://openser.org/.
First at all check if your question was already answered on one of our mailing lists:
User Mailing List - http://openser.org/mailman/listinfo/users
Developer Mailing List - http://openser.org/mailman/listinfo/devel
E-mails regarding any stable OpenSER release should be sent to
<users@openser.org>
and e-mails regarding development versions
should be sent to <devel@openser.org>
.
If you want to keep the mail private, send it to
<team@openser.org>
.
Please follow the guidelines provided at: http://openser.org/bugs.