---
name: "mod_security"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/mod_security"
---

# mod\_security(3erl)

Security Audit and Trailing Functionality

## NAME

mod\_security - Security Audit and Trailing Functionality

## DESCRIPTION

Security Audit and Trailing Functionality

## EXPORTS

**block\_user(User, Port, Dir, Seconds) -\> true \| {error, Reason}**\
 **block\_user(User, Address, Port, Dir, Seconds) -\> true \| {error, Reason}**\

Types:

User = string()\
 Port = integer()\
 Address = {A,B,C,D} \| string() \| undefined\
 Dir = string()\
 Seconds = integer() \| infinity\
 Reason = no\_such\_directory\

*block\_user/4* and *block\_user/5* each blocks the user *User* from directory *Dir* for a specified amount of time.

**list\_auth\_users(Port) -\> Users \| \[\]**\
 **list\_auth\_users(Address, Port) -\> Users \| \[\]**\
 **list\_auth\_users(Port, Dir) -\> Users \| \[\]**\
 **list\_auth\_users(Address, Port, Dir) -\> Users \| \[\]**\

Types:

Port = integer()\
 Address = {A,B,C,D} \| string() \| undefined\
 Dir = string()\
 Users = list() = \[string()\]\

*list\_auth\_users/1*, *list\_auth\_users/2*, and *list\_auth\_users/3* each returns a list of users that are currently authenticated. Authentications are stored for *SecurityAuthTimeout* seconds, and then discarded.

**list\_blocked\_users(Port) -\> Users \| \[\]**\
 **list\_blocked\_users(Address, Port) -\> Users \| \[\]**\
 **list\_blocked\_users(Port, Dir) -\> Users \| \[\]**\
 **list\_blocked\_users(Address, Port, Dir) -\> Users \| \[\]**\

Types:

Port = integer()\
 Address = {A,B,C,D} \| string() \| undefined\
 Dir = string()\
 Users = list() = \[string()\]\

*list\_blocked\_users/1*, *list\_blocked\_users/2*, and *list\_blocked\_users/3* each returns a list of users that are currently blocked from access.

**unblock\_user(User, Port) -\> true \| {error, Reason}**\
 **unblock\_user(User, Address, Port) -\> true \| {error, Reason}**\
 **unblock\_user(User, Port, Dir) -\> true \| {error, Reason}**\
 **unblock\_user(User, Address, Port, Dir) -\> true \| {error, Reason}**\

Types:

User = string()\
 Port = integer()\
 Address = {A,B,C,D} \| string() \| undefined\
 Dir = string()\
 Reason = term()\

*unblock\_user/2*, *unblock\_user/3*, and *unblock\_user/4* each removes the user *User* from the list of blocked users for *Port* (and *Dir*).

## SECURITYCALLBACKMODULE

The *SecurityCallbackModule* is a user-written module that can receive events from the *mod\_security* Erlang web server API module. This module only exports the functions event/\[4,5\] which are described here.

## EXPORTS

**Module:event(What, Port, Dir, Data) -\> ignored**\
 **Module:event(What, Address, Port, Dir, Data) -\> ignored**\

Types:

What = atom()\
 Port = integer()\
 Address = {A,B,C,D} \| string()\
 Dir = string()\
 Data = \[Info\]\
 Info = {Name, Value}\

*event/4* or *event/5* is called whenever an event occurs in the *mod\_security* Erlang web server API module. (*event/4* is called if *Address* is undefined, otherwise *event/5*. Argument *What* specifies the type of event that has occurred and is one of the following reasons:

- ***auth\_fail*:**

  A failed user authentication.

- ***user\_block*:**

  A user is being blocked from access.

- ***user\_unblock*:**

  A user is being removed from the block list.

**Note:**

The event *user\_unblock* is not triggered when a user is removed from the block list explicitly using the *unblock\_user* function.
