Commit fc9aed4d authored by Jonathan's avatar Jonathan Committed by GitHub
Browse files

Merge pull request #59 from amateo/feature/huntgroup

Add configuration for preprocess module and huntgroups
parents c31750cc 1b08f414
Loading
Loading
Loading
Loading
+13 −0
Changes for manifests/module/huntgroup.pp: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
# == Define: freeradius::module::huntgroup
#
define freeradius::module::huntgroup (
  Variant[String,Array] $conditions,
  Variant[String,Integer] $order     = 50,
  String $huntgroup                  = 'huntgroup',
) {
  concat::fragment {"Huntgroup ${name}":
    target  => $huntgroup,
    order   => $order,
    content => template('freeradius/huntgroup.erb')
  }
}
+38 −0
Changes for manifests/module/preprocess.pp: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
# == Class: freeradius::module::preprocess
#
class freeradius::module::preprocess (
  Enum['present','absent'] $ensure                   = 'present',
  String $moddir                                     = "\${modconfdir}/\${.:instance}",
  String $huntgroups                                 = "\${moddir}/huntgroups",
  String $hints                                      = "\${moddir}/hints",
  Freeradius::Boolean $with_acend_hack               = 'no',
  Integer $ascend_channels_per_line                  = 23,
  Freeradius::Boolean $with_ntdomain_hack            = 'no',
  Freeradius::Boolean $with_specialix_jetstream_hack = 'no',
  Freeradius::Boolean $with_cisco_vsa_hack           = 'no',
) {
  $fr_moduleconfigpath = $::freeradius::params::fr_moduleconfigpath
  $fr_group            = $::freeradius::params::fr_group
  $fr_service          = $::freeradius::params::fr_service

  freeradius::module {'preprocess':
    ensure  => $ensure,
    content => template('freeradius/preprocess.erb'),
  }


  $huntgroup_path = $huntgroups ? {
    "\${moddir}/huntgroups" => "${fr_moduleconfigpath}/preprocess/huntgroups",
    default                 => $huntgroups,
  }

  concat {'huntgroup':
    ensure  => $ensure,
    path    => $huntgroup_path,
    owner   => 'root',
    group   => $fr_group,
    mode    => '0640',
    require => Freeradius::Module['preprocess'],
    notify  => Service[$fr_service],
  }
}
+10 −0
Changes for templates/huntgroup.erb: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line

#
##########################################################
# Huntgroup Puppet Name: <%= @name %>
#
<%- if @conditions.is_a?(Array) -%>
<%= @conditions.collect { |cond| @name + " " + cond }.join("\n") %>
<%- else -%>
<%= @name %> <%= @conditions %>
<%- end -%>
+62 −0
Changes for templates/preprocess.erb: 62 added lines, 0 removed lines.
Original line number Diff line number Diff line
# -*- text -*-
#
#  $Id: 8baec7961ba75fe52546cb1331868b0b2b1c38f4 $

# Preprocess the incoming RADIUS request, before handing it off
# to other modules.
#
#  This module processes the 'huntgroups' and 'hints' files.
#  In addition, it re-writes some weird attributes created
#  by some NAS, and converts the attributes into a form which
#  is a little more standard.
#
preprocess {
	# Search for files in a subdirectory of mods-config which
	# matches this instance of the preprocess module.
  moddir = <%= @moddir %>

huntgroups = <%= @huntgroups %>
  hints = <%= @hints %>

	# This hack changes Ascend's weird port numbering
	# to standard 0-??? port numbers so that the "+" works
	# for IP address assignments.
  with_ascend_hack = <%= @with_ascend_hack %>
ascend_channels_per_line = <%= @ascend_channels_per_line %>

	# Windows NT machines often authenticate themselves as
	# NT_DOMAIN\username
	#
	# If this is set to 'yes', then the NT_DOMAIN portion
	# of the user-name is silently discarded.
	#
	# This configuration entry SHOULD NOT be used.
	# See the "realms" module for a better way to handle
	# NT domains.
  with_ntdomain_hack = <%= @with_ntdomain_hack %>

	# Specialix Jetstream 8500 24 port access server.
	#
	# If the user name is 10 characters or longer, a "/"
	# and the excess characters after the 10th are
	# appended to the user name.
	#
	# If you're not running that NAS, you don't need
	# this hack.
  with_specialix_jetstream_hack = <%= @with_specialix_jetstream_hack %>

	# Cisco (and Quintum in Cisco mode) sends it's VSA attributes
	# with the attribute name *again* in the string, like:
	#
	#   H323-Attribute = "h323-attribute=value".
	#
	# If this configuration item is set to 'yes', then
	# the redundant data in the the attribute text is stripped
	# out.  The result is:
	#
	#  H323-Attribute = "value"
	#
	# If you're not running a Cisco or Quintum NAS, you don't
	# need this hack.
  with_cisco_vsa_hack = <%= @with_cisco_vsa_hack %>
}