Skip to content
Snippets Groups Projects
Select Git revision
  • c9f7265ef42b15c85a47b787147ffaed8eb465b3
  • master default protected
  • release-1.3.10
  • popover-bootstrap-3.4
  • zf-3.x
  • 3.0.9
  • 3.0.8
  • 1.3.10
  • 3.0.7
  • 3.0.6
  • 3.0.5
  • 3.0.4
  • 3.0.3
  • 3.0.2
  • 3.0.1
  • 3.0.0
  • 1.3.9
  • 1.3.8
  • 1.3.7
  • 1.3.6
  • 1.3.5
  • 1.3.4
  • 1.3.3
  • 1.3.2
  • 1.3.1
25 results

installation.md

Blame
  • Forked from lib / unicaen / auth
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    client.pp 2.01 KiB
    # Install FreeRADIUS clients (WISMs or testing servers)
    define freeradius::client (
      $shortname,
      $secret,
      $ip             = undef,
      $ip6            = undef,
      $virtual_server = undef,
      $nastype        = undef,
      $netmask        = undef,
      $redirect       = undef,
      $port           = undef,
      $srcip          = undef,
      $firewall       = false,
      $ensure         = present,
    ) {
      $fr_package  = $::freeradius::params::fr_package
      $fr_service  = $::freeradius::params::fr_service
      $fr_basepath = $::freeradius::params::fr_basepath
      $fr_group    = $::freeradius::params::fr_group
      $fr_version  = $::freeradius::params::fr_version
    
      # Calculate CIDR format IP now that FreeRADIUS has obsoleted use of separate netmask.
      # This workaround means no syntax change is necessary, although we print a warning.
      $cidr = $netmask ? {
        undef   => $ip,
        default => "${ip}/${netmask}",
      }
      $cidr6 = $netmask ? {
        undef   => $ip6,
        default => "${ip6}/${netmask}",
      }
    
      if ($netmask and $fr_version == 3) {
        warning("netmask field found in client ${shortname} is deprecated, use CIDR notation instead. Please fix your configuration.")
      }
    
      file { "${fr_basepath}/clients.d/${shortname}.conf":
        ensure  => $ensure,
        mode    => '0640',
        owner   => 'root',
        group   => $fr_group,
        content => template("freeradius/client.conf.fr${fr_version}.erb"),
        require => [File["${fr_basepath}/clients.d"], Group[$fr_group]],
        notify  => Service[$fr_service],
      }
    
      if ($firewall and $ensure == 'present') {
        if $port {
          if $ip {
            firewall { "100-${shortname}-${port}-v4":
              proto  => 'udp',
              dport  => $port,
              action => 'accept',
              source => $cidr,
            }
          } elsif $ip6 {
            firewall { "100-${shortname}-${port}-v6":
              proto    => 'udp',
              dport    => $port,
              action   => 'accept',
              provider => 'ip6tables',
              source   => $cidr6,
            }
          }
        } else {
          fail('Must specify $port if you specify $firewall')
        }
      }
    }