檢視原始碼 mod_security 行為 (inets v9.3.1)

安全性稽核與追蹤功能

摘要

回呼函數

每當 mod_security Erlang 網頁伺服器 API 模組中發生事件時,就會呼叫 event/4event/5。(如果 Address 未定義,則呼叫 event/4,否則呼叫 event/5。)參數 What 指定發生的事件類型,可以是下列原因之一

函式

block_user/4block_user/5 各自會將使用者 User 在目錄 Dir 中封鎖指定的時間。

list_auth_users/1list_auth_users/2list_auth_users/3 各自會傳回目前已驗證的使用者清單。驗證會儲存 SecurityAuthTimeout 秒,然後捨棄。

list_blocked_users/1list_blocked_users/2list_blocked_users/3 各自會傳回目前被封鎖存取的使用者清單。

unblock_user/2unblock_user/3unblock_user/4 各自會從 Port(和 Dir)的封鎖使用者清單中移除使用者 User

回呼函數

此回呼函數的連結

event(What, Port, Dir, Data)

檢視原始碼 (自 OTP 18.1 起)
-callback event(What, Port, Dir, Data) -> term()
                   when
                       What :: auth_fail | user_block | user_unblock,
                       Port :: integer(),
                       Dir :: string(),
                       Data :: [Info],
                       Info :: {Name :: term(), Value :: term()}.
此回呼函數的連結

event(What, Address, Port, Dir, Data)

檢視原始碼 (自 OTP 18.1 起)
-callback event(What, Address, Port, Dir, Data) -> term()
                   when
                       What :: auth_fail | user_block | user_unblock,
                       Port :: integer(),
                       Address :: inet:ip4_address() | inet:ip6_address() | string(),
                       Dir :: string(),
                       Data :: [Info],
                       Info :: {Name :: term(), Value :: term()}.

每當 mod_security Erlang 網頁伺服器 API 模組中發生事件時,就會呼叫 event/4event/5。(如果 Address 未定義,則呼叫 event/4,否則呼叫 event/5。)參數 What 指定發生的事件類型,可以是下列原因之一

  • auth_fail - 使用者驗證失敗。

  • user_block - 使用者被封鎖存取。

  • user_unblock - 使用者正從封鎖清單中移除。

注意

當使用 unblock_user 函式明確從封鎖清單中移除使用者時,不會觸發 user_unblock 事件。

函式

此函式的連結

block_user(User, Port, Dir, Seconds)

檢視原始碼
-spec block_user(User, Port, Dir, Seconds) -> true | {error, Reason}
                    when
                        User :: string(),
                        Port :: inet:port_number(),
                        Dir :: string(),
                        Seconds :: non_neg_integer() | infinity,
                        Reason :: no_such_directory.

等同於 block_user/5

此函式的連結

block_user(User, Address, Port, Dir, Seconds)

檢視原始碼
-spec block_user(User, Address, Port, Dir, Seconds) -> true | {error, Reason}
                    when
                        User :: string(),
                        Port :: inet:port_number(),
                        Address :: inet:ip4_address() | inet:ip6_address() | string() | undefined,
                        Dir :: string(),
                        Seconds :: non_neg_integer() | infinity,
                        Reason :: no_such_directory.

block_user/4block_user/5 各自會將使用者 User 在目錄 Dir 中封鎖指定的時間。

-spec list_auth_users(Port) -> Users | [] when Port :: inet:port_number(), Users :: [string()].

等同於 list_auth_users/3

-spec list_auth_users(Port, Directory) -> Users | []
                         when Port :: inet:port_number(), Directory :: string(), Users :: [string()];
                     (Address, Port) -> Users | []
                         when
                             Port :: inet:port_number(),
                             Address :: inet:ip4_address() | inet:ip6_address() | string() | undefined,
                             Users :: [string()].

等同於 list_auth_users/3

此函式的連結

list_auth_users(Address, Port, Dir)

檢視原始碼
-spec list_auth_users(Address, Port, Dir) -> Users | []
                         when
                             Port :: inet:port_number(),
                             Address :: inet:ip4_address() | inet:ip6_address() | string() | undefined,
                             Dir :: string(),
                             Users :: [string()].

list_auth_users/1list_auth_users/2list_auth_users/3 各自會傳回目前已驗證的使用者清單。驗證會儲存 SecurityAuthTimeout 秒,然後捨棄。

此函式的連結

list_blocked_users(Port)

檢視原始碼
-spec list_blocked_users(Port) -> Users | []
                            when
                                Port :: integer(),
                                Users :: [{blocked_user, term(), term(), term(), term()}].

等同於 list_blocked_users/3

-spec list_blocked_users(Port, Directory) -> Users | []
                            when
                                Port :: integer(),
                                Directory :: string(),
                                Users :: [{blocked_user, term(), term(), term(), term()}];
                        (Address, Port) -> Users | []
                            when
                                Port :: integer(),
                                Address ::
                                    inet:ip4_address() | inet:ip6_address() | string() | undefined,
                                Users :: [{blocked_user, term(), term(), term(), term()}].

等同於 list_blocked_users/3

此函式的連結

list_blocked_users(Address, Port, Dir)

檢視原始碼
-spec list_blocked_users(Address, Port, Dir) -> Users | []
                            when
                                Port :: integer(),
                                Address ::
                                    inet:ip4_address() | inet:ip6_address() | string() | undefined,
                                Dir :: string(),
                                Users :: [{blocked_user, term(), term(), term(), term()}].

list_blocked_users/1list_blocked_users/2list_blocked_users/3 各自會傳回目前被封鎖存取的使用者清單。

此函式的連結

unblock_user(User, Port)

檢視原始碼
-spec unblock_user(User, Port) -> true | {error, Reason}
                      when User :: string(), Port :: integer(), Reason :: term().

等同於 unblock_user/4

-spec unblock_user(User, Port, Directory) -> true | {error, Reason}
                      when User :: string(), Port :: integer(), Directory :: string(), Reason :: term();
                  (User, Address, Port) -> true | {error, Reason}
                      when
                          User :: string(),
                          Port :: integer(),
                          Address :: inet:ip4_address() | inet:ip6_address() | string() | undefined,
                          Reason :: term().

等同於 unblock_user/4

此函式的連結

unblock_user(User, Address, Port, Dir)

檢視原始碼
-spec unblock_user(User, Address, Port, Dir) -> true | {error, Reason}
                      when
                          User :: string(),
                          Port :: integer(),
                          Address :: inet:ip4_address() | inet:ip6_address() | string() | undefined,
                          Dir :: string(),
                          Reason :: term().

unblock_user/2unblock_user/3unblock_user/4 各自會從 Port(和 Dir)的封鎖使用者清單中移除使用者 User