Commit ca24df07 authored by Jonathan Gazeley's avatar Jonathan Gazeley
Browse files

First pass support for native SQL connections

parent 6833798e
Loading
Loading
Loading
Loading
+38 −1
Original line number Diff line number Diff line
@@ -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.

manifests/sql.pp

0 → 100644
+29 −0
Original line number Diff line number Diff line
# 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],
  }

}