djjudas21 / puppet-freeradius

Puppet module to install and configure FreeRADIUS
Apache License 2.0
8 stars 49 forks source link

Unable to manage sql.conf #13

Closed chihoko closed 9 years ago

chihoko commented 9 years ago

Firstly, great module! It would be nice to be able to manage sql.conf if mysql support is enabled (requires at least the sql credentials). How do you see managing these as well as sql/mysql/schema.sql and sql/mysql/dialup.conf?

djjudas21 commented 9 years ago

Personally, I don't build MySQL connections by using sql.conf. My FreeRADIUS installation is complex and open 3 separate database handles so I open these separately by using loadable modules.

One of my module files contains this:

# uobsql-read

sql uobsql-read {
        # Set the database to one of:
        # mysql, mssql, oracle, postgresql
        database = "mysql"

        #  Which FreeRADIUS driver to use.
        driver = "rlm_sql_${database}"

        # Connection info:
        server = "db-read.example.ac.uk"
        #port = 3306
        login = "radiusd"
        password = "*******"

        # Print all SQL statements when in debug mode (-x)
        sqltrace = no
        sqltracefile = ${logdir}/sqltrace-auth.sql

        # number of sql connections to make to server
        num_sql_socks = 2

        # number of seconds to dely retrying on a failed database
        # connection (per_socket)
        connect_failure_retry_delay = 60

        # lifetime of an SQL socket.  If you are having network issues
        # such as TCP sessions expiring, you may need to set the socket
        # lifetime.  If set to non-zero, any open connections will be
        # closed "lifetime" seconds after they were first opened.
        lifetime = 0

        # Maximum number of queries used by an SQL socket.  If you are
        # having issues with SQL sockets lasting "too long", you can
        # limit the number of queries performed over one socket.  After
        # "max_qeuries", the socket will be closed.  Use 0 for "no limit".
        max_queries = 0
}

And that module (and the other SQL modules) are deployed like this:

# Load global SQL module
freeradius::module { 'uobsql-read':
  source => 'puppet:///modules/uob_freeradius/modules/uobsql-read',
}

You're right though, I should probably think about adding support to use the default MySQL connector for people who want to keep it simple. I'l give this some thought because it's not that simple.

Thanks, Jonathan

djjudas21 commented 9 years ago

I've started some work on this. Have a look at the sql feature branch, particularly at the new resource freeradius::sql.

https://github.com/djjudas21/puppet-freeradius/tree/sql

chihoko commented 9 years ago

Thanks, looks good. I'll hopefully have a chance to test it later this week.

djjudas21 commented 9 years ago

I just rolled version 0.2.0 which is now available of Puppet Forge. It includes native support for SQL. I'll close this issue now, but feel free to open more if there are bugs in the implementation.

Cheers, Jonathan