mod_security(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– mod_security β€” the manual page, but make it make sense πŸ’–

okay bestie, welcome to the mod_security page β€” that's section 3 of the Erlang manual, the module-definition corner of the library. Sit down, grab a strawberry drink πŸ“, and let's get into it.


✨ NAME ✨

mod_security β€” Security Audit and Trailing Functionality πŸ’…


🌸 DESCRIPTION 🌸

ngl there is literally no description text here, the original page just goes straight into the functions. iconic of it, honestly. so let's go. πŸ¦‹


πŸ’– FUNCTIONS πŸ’–

  • block_user(User, Address, Port, Dir, Seconds) -> true | {error, Reason} β€” the "you are SO blocked rn" function 🚫
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/4 and block_user/5 each blocks the user User from directory Dir for a specified amount of time. like, a timeout, but for a person. πŸ’€

  • list_auth_users(Address, Port, Dir) -> Users | [] β€” "who's actually logged in bestie" πŸ‘‘
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/1, list_auth_users/2, and list_auth_users/3 each returns a list of users that are currently authenticated. heads up tho πŸ‘€ β€” these authentications are only stored for SecurityAuthTimeout seconds, and then they get discarded. gone. deleted. no trace. ✨

  • list_blocked_users(Address, Port, Dir) -> Users | [] β€” the block list, the naughty list if you will πŸ“‹
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/1, list_blocked_users/2, and list_blocked_users/3 each returns a list of users that are currently blocked from access. main character energy: denied. 🚫✨

  • unblock_user(User, Address, Port, Dir) -> true | {error, Reason} β€” the redemption arc πŸ•ŠοΈ
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/2, unblock_user/3, and unblock_user/4 each removes the user User from the list of blocked users for Port (and Dir). forgive and forget fr fr 🫢


πŸŽ€ CALLBACKS πŸŽ€

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

event/4 or event/5 is called whenever an event occurs in the mod_security Erlang web server API module. quick vibe check: event/4 gets called if Address is undefined, otherwise it's event/5. 🧚

the argument What specifies the type of event that has occurred, and it's one of these:

  • auth_fail β€” a failed user authentication. we've all been there 😭
  • 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. yeah, sneaky. don't say I didn't warn you πŸ™ˆ

and that's the whole page, bestie, no skips, no skimming πŸ’– this one comes to you courtesy of Ericsson AB, from inets 9.7.2, and it's the mod_security(3) page from the Erlang manual β€” so you know it's the real deal. periodt. πŸ‘‘βœ¨

πŸ“¦ where this page comes from