Unverified Commit 28c34bcb authored by Nathan Ward's avatar Nathan Ward Committed by GitHub
Browse files

Merge pull request #142 from SearchLightNZ/freeradius_3_0_21_config_updates

Make FreeRADIUS 3.0.21 the target version for config
parents c2d1984e c3f547b0
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -634,9 +634,11 @@ With `chase_referrals` control whether the server follows references returned by

##### `use_referral_credentials`
On rebind, use the credentials from the rebind url instead of admin credentials. Default: `no`.
This parameter should only be set when using FreeRADIUS 3.1.x.

##### `session_tracking`
If `yes`, then include draft-wahl-ldap-session tracking controls. Default: `undef`.
This parameter should only be set when using FreeRADIUS 3.1.x.

##### `uses`
How many times the connection can be used before being re-established. This is useful for things
@@ -653,6 +655,7 @@ Idle timeout (in seconds). A connection which is unused for this length of time

##### `connect_timeout`
Connection timeout (in seconds). The maximum amount of time to wait for a new connection to be established. Default: `3.0`.
This parameter should only be set when using FreeRADIUS 3.1.x.

##### `idle`
Sets the idle time before keepalive probes are sent. Default `60`
@@ -1536,6 +1539,7 @@ be closed. Default: 60.

Connection timeout (in seconds). The maximum amount of time to wait for a new
connection to be established. Default: '3.0'.
This parameter should only be set when using FreeRADIUS 3.1.x.

#### `freeradius::statusclient`

+10 −0
Original line number Diff line number Diff line
@@ -28,6 +28,16 @@ class freeradius (
    notify { 'This module is only compatible with FreeRADIUS 3.': }
  }

  # Guess if we are running FreeRADIUS 3.1.x
  if (
    ($package_ensure =~ /^3\.1\./) or
    ($facts['freeradius_version'] and $facts['freeradius_version'] =~ /^3\.1\./)
  ) {
    $fr_3_1 = true
  } else {
    $fr_3_1 = false
  }

  validate_re($log_destination, '^(files|syslog|stdout|stderr)$',
    "log_destination value (${log_destination}) is not a valid value")

+75 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ define freeradius::module::ldap (
  Optional[Enum['never','searching','finding','always']] $dereference = undef,
  Freeradius::Boolean $chase_referrals                                = 'yes',
  Freeradius::Boolean $rebind                                         = 'yes',
  Freeradius::Boolean $use_referral_credentials                       = 'no',
  Optional[Freeradius::Boolean] $use_referral_credentials             = undef,
  Optional[Freeradius::Boolean] $session_tracking                     = undef,
  Integer $timeout                                                    = 10,
  Integer $timelimit                                                  = 3,
@@ -61,7 +61,7 @@ define freeradius::module::ldap (
  Integer $retry_delay                                                = 30,
  Integer $lifetime                                                   = 0,
  Integer $idle_timeout                                               = 60,
  Float $connect_timeout                                              = 3.0,
  Optional[Float] $connect_timeout                                    = undef,
) {
  $fr_package          = $::freeradius::params::fr_package
  $fr_service          = $::freeradius::params::fr_service
@@ -79,6 +79,79 @@ define freeradius::module::ldap (
    default   => $server,
  }

  # Warn if the user tries to set a FreeRADIUS 3.1.x specific parameter, and
  # we detect that they are not on (or not installing) a FreeRADIUS 3.1.x
  # then show them some errors
  # Additionally, if we are on FreeRADIUS 3.1.x then allow defaults for some
  # parameters, otherwise leave them set as specified when this define
  # is called.
  if $::freeradius::fr_3_1 {
    if $connect_timeout != undef {
      warning(@("WARN"/L)
        The `connect_timeout` parameter requires FreeRADIUS 3.1.x, i.e. the \
        experimental branch. You are running `${facts['freeradius_version']}`. \
        In the future, attempting to set it on this version may fail.
        |-WARN
      )
    }

    if $session_tracking != undef {
      warning(@("WARN"/L)
        The `session_tracking` parameter requires FreeRADIUS 3.1.x, i.e. the \
        experimental branch. You are running `${facts['freeradius_version']}`. \
        In the future, attempting to set it on this version may fail.
        |-WARN
      )
    }

    if $use_referral_credentials != undef {
      warning(@("WARN"/L)
        The `use_referral_credentials` parameter requires FreeRADIUS 3.1.x, \
        i.e. the experimental branch. You are running \
        `${facts['freeradius_version']}`. In the future, attempting to set \
        it on this version may fail.
        |-WARN
      )
    }

    $resolved_connect_timeout = $connect_timeout ? {
      undef   => 3.0,
      default => $connect_timeout,
    }

    $resolved_session_tracking = $session_tracking

    $resolved_use_referral_credentials = $use_referral_credentials ? {
      undef   => 'no',
      default => $use_referral_credentials,
    }
  } else {
    if $connect_timeout != undef {
      fail(@("FAIL"/L)
        The `connect_timeout` parameter requires FreeRADIUS 3.1.x, i.e. the \
        experimental branch. You are running `${facts['freeradius_version']}`.
        |-FAIL
      )
    }

    if $session_tracking != undef {
      fail(@("FAIL"/L)
        The `session_tracking` parameter requires FreeRADIUS 3.1.x, i.e. the \
        experimental branch. You are running `${facts['freeradius_version']}`.
        |-FAIL
      )
    }

    if $use_referral_credentials != undef {
      fail(@("FAIL"/L)
        The `use_referral_credentials` parameter requires FreeRADIUS 3.1.x, \
        i.e. the experimental branch. You are running \
        `${facts['freeradius_version']}`.
        |-FAIL
      )
    }
  }

  # Generate a module config, based on ldap.conf
  file { "${fr_basepath}/mods-available/${name}":
    ensure  => $ensure,
+35 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ define freeradius::sql (
  Optional[Integer] $pool_min                    = 1,
  Optional[Integer] $pool_spare                  = 1,
  Optional[Integer] $pool_idle_timeout           = 60,
  Optional[Float] $pool_connect_timeout          = 3.0,
  Optional[Float] $pool_connect_timeout          = undef,
) {
  $fr_package          = $::freeradius::params::fr_package
  $fr_service          = $::freeradius::params::fr_service
@@ -52,6 +52,40 @@ define freeradius::sql (
    fail('$num_sql_socks must be an integer')
  }

  # Warn if the user tries to set a FreeRADIUS 3.1.x specific parameter, and
  # we detect that they are not on (or not installing) a FreeRADIUS 3.1.x
  # then show them some errors
  # Additionally, if we are on FreeRADIUS 3.1.x then allow defaults for some
  # parameters, otherwise leave them set as specified when this define
  # is called.
  if $::freeradius::fr_3_1 {
    if $pool_connect_timeout != undef {
      warning(@("WARN"/L)
        The `pool_connect_timeout` parameter requires FreeRADIUS 3.1.x, \
        i.e. the experimental branch. You are running \
        `${facts['freeradius_version']}`. In the future, attempting to set \
        it on this version may fail.
        |-WARN
      )
    }

    $resolved_pool_connect_timeout = $pool_connect_timeout ? {
      undef   => 3.0,
      default => $pool_connect_timeout,
    }

  } else {
    if $pool_connect_timeout != undef {
      fail(@("FAIL"/L)
        The `pool_connect_timeout` parameter requires FreeRADIUS 3.1.x, \
        i.e. the experimental branch. You are running \
        `${facts['freeradius_version']}`.
        |-FAIL
      )
    }
  }


  # Determine default location of query file
  $queryfile = "${fr_basepath}/sql/queries.conf"

+2 −1
Original line number Diff line number Diff line
@@ -14,7 +14,8 @@ describe 'freeradius::krb5' do

  it do
    is_expected.to contain_file('/etc/raddb/mods-available/test')
      .with_content(%r{^krb5 test \{\n\s+keytab = test_keytab\n\s+service_principal = test_principal\n})
      .with_content(%r{^\s+keytab = test_keytab$})
      .with_content(%r{^\s+service_principal = test_principal$})
      .with_ensure('present')
      .with_group('radiusd')
      .with_mode('0640')
Loading