Published on iptel.org (http://www.iptel.org)

permissions

By greger
Created 2006-11-26 09:57

Standard-dep

The 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.


Miklos Tirpak
Juha Heinanen


i [1] is a forkingi [2] 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-URIi [3] of branchi [4] 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.

i [5] 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, “Call Routing” [6]. 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-URIi [7] 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, “Call Routing” [8].

Section 1.1.1, “Call Routing” [9] have appropriate permissions according to the configuration files. This function uses default configuration files specified in default_allow_file and default_deny_file.

Section 1.1.1, “Call Routing” [10] 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.

Section 1.1.1, “Call Routing” [11] 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.

Section 1.1.2, “Registration Permissions” [12] 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.

Section 1.1.2, “Registration Permissions” [13] 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.

Section 1.1.2, “Registration Permissions” [14] 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.

Example 11. allow_register(basename) usage

...
if (method=="REGISTER") {
    if (allow_register("register")) {
        save("location");
        break;
    } else {
        sl_send_reply("403", "Forbidden");
    };
};
...