<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1998</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>mod_security</title>
    <prepared>Mattias Nilsson</prepared>
    <docno></docno>
    <date>1997-11-18</date>
    <rev>1.0</rev>
    <file>mod_security.sgml</file>
  </header>
  <module>mod_security</module>
  <modulesummary>Security Audit and Trailing Functionality</modulesummary>
  <description>
    <p>Security Audit and Trailing Functionality</p>
  </description>
  <funcs>
    <func>
      <name>list_auth_users(Port) -> Users | []</name>
      <name>list_auth_users(Address, Port) -> Users | []</name>
      <name>list_auth_users(Port, Dir) -> Users | []</name>
      <name>list_auth_users(Address, Port, Dir) -> Users | []</name>
      <fsummary>List users that have authenticated within the SecurityAuthTimeout time for a given address (if specified), port number and directory  (if specified).</fsummary>
      <type>
        <v>Port    = integer()</v>
        <v>Address = {A,B,C,D} | string() | undefined</v>
        <v>Dir     = string()</v>
        <v>Users   = list() = [string()]</v>
      </type>
      <desc>
        <marker id="list_auth_users"></marker>
        <p><c>list_auth_users/1</c>, <c>list_auth_users/2</c> and 
          <c>list_auth_users/3</c> returns a list of users that are 
          currently authenticated. Authentications are stored for
          SecurityAuthTimeout seconds, and are then discarded.</p>
      </desc>
    </func>
    <func>
      <name>list_blocked_users(Port) -> Users | []</name>
      <name>list_blocked_users(Address, Port) -> Users | []</name>
      <name>list_blocked_users(Port, Dir) -> Users | []</name>
      <name>list_blocked_users(Address, Port, Dir) -> Users | []</name>
      <fsummary>List users that are currently blocked from access to a  specified port number, for a given address (if specified).</fsummary>
      <type>
        <v>Port    = integer()</v>
        <v>Address = {A,B,C,D} | string() | undefined</v>
        <v>Dir     = string()</v>
        <v>Users   = list() = [string()]</v>
      </type>
      <desc>
        <marker id="list_blocked_users"></marker>
        <p><c>list_blocked_users/1</c>, <c>list_blocked_users/2</c> and 
          <c>list_blocked_users/3</c> returns a list of users that are 
          currently blocked from access.</p>
      </desc>
    </func>
    <func>
      <name>block_user(User, Port, Dir, Seconds) -> true | {error, Reason}</name>
      <name>block_user(User, Address, Port, Dir, Seconds) -> true | {error, Reason}</name>
      <fsummary>Block user from access to a directory for a certain amount of time.</fsummary>
      <type>
        <v>User    = string()</v>
        <v>Port    = integer()</v>
        <v>Address = {A,B,C,D} | string() | undefined</v>
        <v>Dir     = string()</v>
        <v>Seconds = integer() | infinity</v>
        <v>Reason  = no_such_directory</v>
      </type>
      <desc>
        <marker id="block_user"></marker>
        <p><c>block_user/4</c> and <c>block_user/5</c> blocks the user 
          <c>User</c> from the directory <c>Dir</c> for a specified 
          amount of time.</p>
      </desc>
    </func>
    <func>
      <name>unblock_user(User, Port)          -> true | {error, Reason}</name>
      <name>unblock_user(User, Address, Port) -> true | {error, Reason}</name>
      <name>unblock_user(User, Port, Dir)     -> true | {error, Reason}</name>
      <name>unblock_user(User, Address, Port, Dir) -> true | {error, Reason}</name>
      <fsummary>Remove a blocked user from the block list</fsummary>
      <type>
        <v>User   = string()</v>
        <v>Port   = integer()</v>
        <v>Address = {A,B,C,D} | string() | undefined</v>
        <v>Dir    = string()</v>
        <v>Reason = term()</v>
      </type>
      <desc>
        <marker id="unblock_user"></marker>
        <p><c>unblock_user/2</c>, <c>unblock_user/3</c> and 
          <c>unblock_user/4</c> removes the user <c>User</c> from 
          the list of blocked users for the Port (and Dir) specified.</p>
      </desc>
    </func>
  </funcs>

  <section>
    <marker id="callback_module"></marker>
    <title>The SecurityCallbackModule</title>
    <p>The SecurityCallbackModule is a user written module that can receive 
      events from the mod_security Erlang Webserver API module. 
      This module only exports the function(s),
      <seealso marker="#callback_module_event">event/4,5</seealso>, 
      which are described below.
      </p>
  </section>

  <funcs>
    <func>
      <name>event(What, Port, Dir, Data) -> ignored</name>
      <name>event(What, Address, Port, Dir, Data) -> ignored</name>
      <fsummary>This function is called whenever an event occurs in mod_security</fsummary>
      <type>
        <v>What  = atom()</v>
        <v>Port  = integer()</v>
        <v>Address = {A,B,C,D} | string() &lt;v>Dir   = string()</v>
        <v>Data  = [Info]</v>
        <v>Info  = {Name, Value}</v>
      </type>
      <desc>
        <marker id="callback_module_event"></marker>
        <p><c>event/4</c> or <c>event/4</c> is called whenever an event 
          occurs in the mod_security Erlang Webserver API module (<c>event/4</c> is
          called if Address is undefined and <c>event/5</c> otherwise). 
          The <c>What</c> argument specifies the type of event that has 
          occurred, and should be one of the following reasons; 
          <c>auth_fail</c> (a failed user authentication), 
          <c>user_block</c> (a user is being blocked from access) or 
          <c>user_unblock</c> (a user is being removed from the block list).</p>
        <note>
          <p>Note that the <c>user_unblock</c> event is not triggered when 
            a user is removed from the block list explicitly using the 
            <c>unblock_user</c> function.</p>
        </note>
      </desc>
    </func>
  </funcs>
  
</erlref>


