diff --git a/README.md b/README.md index a90c348581074680ac23e664c94bcd653651dab6..89bc830f2064a041e43e608b6fabcb811cc22434 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ The maximum number of requests which the server keeps track of. This should be 2 Limit on the total number of servers running. Default: `4096` ##### `mysql_support` -Install support for MySQL. Default: `false` +Install support for MySQL. Note this only installs the package. Use `freeradius::sql` to configure SQL support. Default: `false` ##### `perl_support` Install support for Perl. Default: `false` @@ -238,6 +238,43 @@ freeradius::site { 'inner-tunnel': } ``` +#### `freeradius::sql` + +Configure SQL connections. You can define multiple database connections by +invoking this resource multiple times. If you are using MySQL, don't forget to +also set `mysql_support => true` in the base `freeradius` class. + +##### `database` + +Default: `undef`. Required. Specify which FreeRADIUS database driver to use. Choose one of `mysql`, `mssql`, `oracle`, `postgresql` + +##### `server` + +Default: `localhost`. Specify hostname of IP address of the database server. + +##### `login` + +Default: `radius`. Username to connect to the databae. + +##### `password` + +Default: `undef`. Required. Password to connect to the database. + +##### `radius_db` + +Default: `radius`. Name of the database. Normally you should leave this alone. If you are using Oracle then use this instead: +`(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=your_sid)))`. + +```puppet +freeradius::sql { 'mydatabase': + database => 'mysql', + server => '192.168.0.1', + login => 'radius', + password => 'topsecret', + radius_db => 'radius', +} +``` + #### `freeradius::statusclient` Define RADIUS clients, specifically to connect to the status server for monitoring. diff --git a/manifests/sql.pp b/manifests/sql.pp new file mode 100644 index 0000000000000000000000000000000000000000..e1c9c9327e7b66240f9adc2e1875b180d1d74208 --- /dev/null +++ b/manifests/sql.pp @@ -0,0 +1,29 @@ +# Configure SQL support for FreeRADIUS +define freeradius::sql ( + $database, + $password, + $server = 'localhost', + $login = 'radius', + $radius_db = 'radius', +) { + $fr_package = $::freeradius::params::fr_package + $fr_service = $::freeradius::params::fr_service + $fr_basepath = $::freeradius::params::fr_basepath + $fr_group = $::freeradius::params::fr_group + + # Validate our inputs + if ($database != 'mysql' and $database != 'mssql' and $database != 'oracle' and $database != 'postgresql') { + error('$database must be one of mysql, mssql, oracle, postgresql') + } + + # Generate a module config, based on sql.conf + file { "${fr_basepath}/modules/${name}": + mode => '0640', + owner => 'root', + group => $fr_group, + content => template('freeradius/sql.conf.erb'), + require => [Package[$fr_package], Group[$fr_group]], + notify => Service[$fr_service], + } + +}