Next: 10. Virtual robot Up: Sympa Mailing Lists Management Software version Previous: 8. Authentication Contents Index
Subsections

- 9.1 rules specifications
- 9.2 LDAP Named Filters
  - 9.2.1 Definition
  - 9.2.2 Search Condition
- 9.3 scenario inclusion
- 9.4 Hidding scenario files

#
9. Authorization scenarios

List parameters controlling the behavior of commands are linked to different authorization scenarios. For example : the `send private` parameter is related to the send.private scenario. There are four possible locations for a authorization scenario. When Sympa seeks to apply an authorization scenario, it looks first in the related list directory `/home/sympa/expl/`<`list`>`/scenari`. If it does not find the file there, it scans the current robot configuration directory `/home/sympa/etc/my.domain.org/scenari`, then the site's configuration directory `/home/sympa/etc/scenari`, and finally `/home/sympa/bin/etc/scenari`, which is the directory installed by the Makefile.

An authorization scenario is a small configuration language to describe who can perform an operation and which authentication method is requested for it. An authorization scenario is an ordered set of rules. The goal is to provide a simple and flexible way to configure authorization and required authentication method for each operation.

Each authorization scenario rule contains :

- a condition : the condition is evaluated by Sympa. It can use variables such as sender for the sender e-mail, list for the listname etc.
- an authentication method. The authentication method can be `smtp`, `md5` or `smime`. The rule is applied by Sympa if both condition and authentication method match the runtime context. `smtp` is used if Sympa use the SMTP `from:` header , `md5` is used if a unique md5 key as been returned by the requestor to validate her message, `smime` is used for signed messages (see 19.4.3, page ).
- a returned atomic action that will be executed by Sympa if the rule matches

Example

> del.auth

    title.us deletion performed only by list owners, need authentication
    title.fr suppression réservée au propriétaire avec authentification
    title.es eliminación reservada sólo para el propietario, necesita autentificación

      is_owner([listname],[sender])  smtp       -> request_auth
      is_listmaster([sender])        smtp       -> request_auth
      true()                         md5,smime  -> do_it

#
9.1 rules specifications

An authorization scenario consists of rules, evaluated in order beginning with the first. Rules are defined as follows :

    <rule> ::= <condition> <auth_list> -> <action>

    <condition> ::= [!] <condition
                    | true ()
                    | all ()
                    | equal (<var>, <var>)
                    | match (<var>, /perl_regexp/)
                    | is_subscriber (<listname>, <var>)
                    | is_owner (<listname>, <var>)
                    | is_editor (<listname>, <var>)
                    | is_listmaster (<var>)
                    | older (<date>, <date>)    # true if first date is anterior to the second date
                    | newer (<date>, <date>)    # true if first date is posterior to the second date
    <var> ::= [email] | [sender] | [user-><user_key_word>] | [previous_email]
                      | [remote_host] | [remote_addr] | [user_attributes-><user_attributes_keyword>]
    	 	  | [subscriber-><subscriber_key_word>] | [list-><list_key_word>]
    		  | [conf-><conf_key_word>] | [msg_header-><smtp_key_word>] | [msg_body]
    	 	  | [msg_part->type] | [msg_part->body] | [msg_encrypted] | [is_bcc] | [current_date] | <string>

    [is_bcc] ::= set to 1 if the list is neither in To: nor Cc:

    [sender] ::= email address of the current user (used on web or mail interface). Default value is 'nobody'

    [previous_email] ::= old email when changing subscribtion email in preference page.

    [msg_encrypted] ::= set to 'smime' if the message was S/MIME encrypted

    <date> ::= '<date_element> [ +|- <date_element>]'

    <date_element> ::= <epoch_date> | <var> | <date_expr>

    <epoch_date> ::= <integer>

    <date_expr> ::= <integer>y<integer>m<integer>d<integer>h<integer>min<integer>sec

    <listname> ::= [listname] | <listname_string>

    <auth_list> ::= <auth>,<auth_list> | <auth>

    <auth> ::= smtp|md5|smime

    <action> ::=   do_it [,notify]
                 | do_it [,quiet]
                 | reject(<tpl_name>)
                 | request_auth
                 | owner
    	     | editor
    	     | editorkey

    <tpl_name> ::= corresponding template (<tpl_name>.tpl) is send to the sender

    <user_key_word> ::= email | gecos | lang | password | cookie_delay_user
    	            | <additional_user_fields>

    <user_attributes_key_word> ::= one of the user attributes provided by the SSO system via environment variables. The [user_attributes] structure is available only if user authenticated with a generic_sso.

    <subscriber_key_word> ::= email | gecos | bounce | reception
    	                  | visibility | date | update_date
    			  | <additional_subscriber_fields>

    <list_key_word> ::= name | host | lang | max_size | priority | reply_to |
    		    status | subject | account | total

    <conf_key_word> ::= domain | email | listmaster | default_list_priority |
    		      sympa_priority | request_priority | lang | max_size

(Refer to 11.10, page for date format definition)

perl_regexp can contain the string [host] (interpreted at run time as the list or robot domain). The variable notation [msg_header-`><`smtp_key_word`>`] is interpreted as the SMTP header value only when evaluating the authorization scenario for sending messages. It can be used, for example, to require editor validation for multipart messages. [msg_part-`>`type] and [msg_part-`>`body] are the MIME parts content-types and bodies ; the body is available for MIME parts in text/xxx format only.

A bunch of authorization scenarios is provided with the Sympa distribution ; they provide a large set of configuration that allow to create lists for most usage. But you will probably create authorization scenarios for your own need. In this case, don't forget to restart Sympa and wwsympa because authorization scenarios are not reloaded dynamicaly.

These standard authorization scenarios are located in the `/home/sympa/bin/etc/scenari/` directory. Default scenarios are named `<`command`>`.default.

You may also define and name your own authorization scenarios. Store them in the `/home/sympa/etc/scenari` directory. They will not be overwritten by Sympa release. Scenarios can also be defined for a particular virtual robot (using directory `/home/sympa/etc/`<`robot`>`/scenari`) or for a list ( `/home/sympa/expl/`<`robot`>`/`<`list`>`/scenari` ).

Example:

Copy the previous scenario to `scenari/subscribe.rennes1` :

    equal([sender], 'userxxx@univ-rennes1.fr') smtp,smime -> reject
    match([sender], /univ-rennes1\.fr\$/) smtp,smime -> do_it
    true()                               smtp,smime -> owner

You may now refer to this authorization scenario in any list configuration file, for example :

    subscribe rennes1

#
9.2 LDAP Named Filters

At the moment Named Filters are only used in authorization scenarios. They enable to select a category of people who will be authorized or not to realise some actions.

As a consequence, you can grant privileges in a list to people belonging to an directory thanks to an authorization scenario.

## 9.2.1 Definition

People are selected through an defined in a configuration file. This file must have the extension '.ldap'.It is stored in `/home/sympa/etc/search_filters/`.

You must give several informations in order to create a Named Filter:

- host
  A list of host:port LDAP directories (replicates) entries.

- suffix
  Defines the naming space covered by the search (optional, depending on the LDAP server).

- filter
  Defines the LDAP search filter (RFC 2254 compliant). But you must absolutely take into account the first part of the filter which is: ('mail_attribute' = [sender]) as shown in the example. you will have to replce 'mail_attribute' by the name of the attribute for the email. Sympa verifies if the user belongs to the category of people defined in the filter.

- scope
  By default the search is performed on the whole tree below the specified base object. This may be changed by specifying a scope :

  - base : Search only the base object.
  - one
    Search the entries immediately below the base object.
  - sub
    Search the whole tree below the base object. This is the default.

example.ldap : we want to select the professors of mathematics in the university of Rennes1 in France

    	host		ldap.univ-rennes1.fr:389,ldap2.univ-rennes1.fr:390
    	suffix		dc=univ-rennes1.fr,dc=fr
    	filter		(&(canonic_mail = [sender])(EmployeeType = prof)(subject = math))
    	scope		sub

## 9.2.2 Search Condition

The search condition is used in authorization scenarios which are defined and described in (see 9)

The syntax of this rule is:

    	search(example.ldap,[sender])      smtp,smime,md5    -> do_it

The variables used by 'search' are :

- the name of the LDAP Configuration file
- the [sender]
  That is to say the sender email address.

Note that Sympa processes maintain a cache of processed search conditions to limit access to the LDAP directory ; each entry has a lifetime of 1 hour in the cache.

The method of authentication does not change.

# 9.3 scenario inclusion

Scenarios can also contain includes :

        subscribe
            include commonreject
            match(, /cru\.fr$/)          smtp,smime -> do_it
    	true()                               smtp,smime -> owner

In this case sympa applies recursively the scenario named `include.commonreject` before introducing the other rules. This possibility was introduced in order to facilitate the administration of common rules.

You can define a set of common scenario rules, used by all lists. include.`<`action`>`.header is automatically added to evaluated scenarios.

# 9.4 Hidding scenario files

Because Sympa is distributed with many default scenario files, you may want to hidde some of them to list owners (to make list admin menus shorter and readable). To hidde a scenario file you should create an empty file with the `:ignore` suffix. Depending on where this file has been created will make it ignored at either a global, robot or list level.

Example :

    /home/sympa/etc/\samplerobot/scenari/send.intranetorprivate:ignore

The `intranetorprivate` `send` scenario will be hidden (on the web admin interface), at the my.domain.orgrobot level only.

Next: 10. Virtual robot Up: Sympa Mailing Lists Management Software version Previous: 8. Authentication Contents Index