Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Anope with MySQL  (Read 7346 times)

0 Members and 1 Guest are viewing this topic.

Craig Fairhurst

  • Anope User
  • Offline Offline
  • Posts: 28
Anope with MySQL
« on: December 20, 2014, 07:46:03 PM »

Hi

I am trying to get Anope setup with MySQL, so that it reads its username and channel registration data from mysql. Has anybody got a tutorial that will help me I'm struggling to find any useful information.

Sub point: I am intending to pull username data from phpBB forum database however at the moment would be happy with any kind of MySQL interaction.

Here's my config:

services.conf:
Code: [Select]
/*
 * db_sql and db_sql_live
 *
 * db_sql module allows saving and loading databases using one of the SQL engines.
 * This module loads the databases once on startup, then incrementally updates
 * objects in the database as they are changed within Anope in real time. Changes
 * to the SQL tables not done by Anope will have no effect and will be overwritten.
 *
 * db_sql_live module allows saving and loading databases using one of the SQL engines.
 * This module reads and writes to SQL in real time. Changes to the SQL tables
 * will be immediately reflected into Anope. This module should not be loaded
 * in conjunction with db_sql.
 *
 */
module
{
        name = "db_sql"
        #name = "db_sql_live"

        /*
         * The SQL service db_sql(_live) should use, these are configured in modules.conf.
         * For MySQL, this should probably be mysql/main.
         */
        engine = "mysql/main"

        /*
         * An optional prefix to prepended to the name of each created table.
         * Do not use the same prefix for other programs.
         */
        prefix = "anope_db_"

        /* Whether or not to import data from another database module in to SQL on startup.
         * If you enable this, be sure that the database services is configured to use is
         * empty and that another database module to import from is loaded before db_sql.
         * After you enable this and do a database import you should disable it for
         * subsequent restarts.
         *
         * Note that you can not import databases using db_sql_live. If you want to import
         * databases and use db_sql_live you should import them using db_sql, then shut down
         * and start services with db_sql_live.
         */
        import = false
}

modules.conf:
Code: [Select]
/*
 * m_mysql [EXTRA]
 *
 * This module allows other modules to use MySQL.
 */
module
{
        name = "m_mysql"

        mysql
        {
                /* The name of this service. */
                name = "mysql/main"
                database = "anope"
                server = "127.0.0.1"
                username = "glx"
                password = "..."
                port = 3306
        }

}

/*
 * 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://www.mysite.com/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://www.mysite.com/password"
}

But nothing changes when i restart the services, no tables are created in the database and I'm left scratching my head as to what has actually changed because of the configuration above.

Any help would be appreciated.

Craig Fairhurst

  • Anope User
  • Offline Offline
  • Posts: 28
Re: Anope with MySQL
« Reply #1 on: December 20, 2014, 09:21:53 PM »

More config was requested on IRC here it is:
 - services.conf: http://pastebin.com/EKynHmUr
 - modules.conf: http://pastebin.com/KCP7YEFd

Craig Fairhurst

  • Anope User
  • Offline Offline
  • Posts: 28
Re: Anope with MySQL
« Reply #2 on: December 20, 2014, 09:38:12 PM »

And my logs: http://pastebin.com/MDaPNhhA

- as you can see, i am up and running now. Thanks to the guys on IRC :D

For anyone reading this coming from Google or wherever, the solution was obvious when running:
Code: [Select]
bin/services -support | grep mysql
« Last Edit: December 20, 2014, 11:48:18 PM by Craig Fairhurst »
Logged
Pages: [1]   Go Up