2.0/Modules/m sql authentication

From AnopeWiki
Jump to: navigation, search
Language

English

Section Database
Module m_sql_authentication
Author Anope

Description

This modules interfaces services with a SQL backend, such as Mysql, Redis, or SQLite, to manage users.

  • Enabeled/Disabeled using the ./extra command line configuration tool.
  • NOTE: Requres a SQL backend module to be present and properly configured.
name= 
Name of module
engine= 
Name of backend method to use
query= 
The command used to get the data from the backend database.
disable_reason= 
Reason to display while preventing users from registering nicks via nickserv. They will need to be created in another method (such as forum registration, etc).
disable_email_reason= 
Reason to display when preventing users from changing their email address. They will need alternative methods to update email address, such as via forum profile changes.

Default Configuration

/*
 * m_sql_authentication [EXTRA]
 *
 * This module allows authenticating users against an external SQL database using a custom
 * query.
 */
#module
{
        name = "m_sql_authentication"
 
        /* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
        engine = "mysql/main"
 
        /* Query to execute to authenticate. A non empty result from this query is considered a success,
         * and the user will be authenticated.
         *
         * @a@ is replaced with the user's account name
         * @p@ is replaced with the user's password
         * @n@ is replaced with the user's nickname
         * @i@ is replaced with the user's IP
         *
         * Note that @n@ and @i@ may not always exist in the case of a user identifying outside of the normal
         * nickserv/identify command, such as through the web panel.
         *
         * Furthermore, if a field named email is returned from this query the user's email is
         * set to its value.
         *
         *
         * We've included some example queries for some popular website/forum systems.
         *
         * Drupal 6: "SELECT `mail` AS `email` FROM `users` WHERE `name` = @a@ AND `pass` = MD5(@p@) AND `status` = 1"
         * e107 cms: "SELECT `user_email` AS `email` FROM `e107_user` WHERE `user_loginname` = @a@ AND `user_password` = MD5(@p@)"
         * SMF Forum: "SELECT `email_address` AS `email` FROM `smf_members` WHERE `member_name` = @a@ AND `passwd` = SHA1(CONCAT(LOWER(@a@), @p@)
)"
         * vBulletin: "SELECT `email` FROM `user` WHERE `username` = @a@ AND `password` = MD5(CONCAT(MD5(@p@), `salt`))"
         * IP.Board: "SELECT `email` FROM `ibf_members` WHERE `name` = @a@ AND `members_pass_hash` = MD5(CONCAT(MD5(`members_pass_salt`), MD5(@p@
)))"
         */
        query = "SELECT `email_addr` AS `email` FROM `my_users` WHERE `username` = @a@ AND `password` = MD5(CONCAT('salt', @p@))"
 
        /*
         * If set, the reason to give the users who try to "/msg NickServ REGISTER".
         * If not set, then registration is not blocked.
         */
        #disable_reason = "To register on this network visit http://some.misconfigured.site/register"
 
        /*
         * If set, the reason to give the users who try to "/msg NickServ SET EMAIL".
         * If not set, then email changing is not blocked.
         */
        #disable_email_reason = "To change your email address visit http://some.misconfigured.site"
}