Commit 3119bb92 authored by Jonathan Gazeley's avatar Jonathan Gazeley
Browse files

Provide a better way to manage attribute filters

parent 5ee7a74f
......@@ -2,19 +2,36 @@
define freeradius::attr (
$source,
$ensure = present,
$key = 'User-Name',
) {
$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_package = $::freeradius::params::fr_package
$fr_service = $::freeradius::params::fr_service
$fr_basepath = $::freeradius::params::fr_basepath
$fr_group = $::freeradius::params::fr_group
$fr_modconfigpath = $::freeradius::params::fr_modconfigpath
$fr_modulepath = $::freeradius::params::fr_modulepath
file { "${fr_basepath}/attr.d/${name}":
# Decide on location for attribute filters
$location = $::freeradius_maj_version ? {
2 => $fr_basepath,
3 => $fr_modconfigpath,
default => $fr_modconfigpath,
}
# Install the attribute filter snippet
file { "${location}/${name}":
ensure => $ensure,
mode => '0640',
owner => 'root',
group => $fr_group,
source => $source,
require => [File["${fr_basepath}/attr.d"], Package[$fr_package], Group[$fr_group]],
require => [Package[$fr_package], Group[$fr_group]],
notify => Service[$fr_service],
}
# Reference all attribute snippets in one file
concat::fragment { "attr-${name}":
target => "${fr_modulepath}/attr_filter",
content => template("freeradius/attr.fr${::freeradius_maj_version}.erb"),
}
}
......@@ -99,6 +99,16 @@ class freeradius (
notify => Service[$freeradius::fr_service],
}
# Set up attribute filter file
concat { "${freeradius::fr_modulepath}/attr_filter":
owner => 'root',
group => $freeradius::fr_group,
mode => '0640',
require => [Package[$freeradius::fr_package], Group[$freeradius::fr_group]],
notify => Service[$freeradius::fr_service],
}
# Install a slightly tweaked stock dictionary that includes
# our custom dictionaries
concat { "${freeradius::fr_basepath}/dictionary":
......
attr_filter filter.<%= @name %> {
key = %{<%= @key %>}
attrsfile = ${confdir}/attr.d/<%= @name %>
}
attr_filter attr_filter.<%= @name %> {
key = "%{<%= @key %>}"
filename = ${modconfdir}/${.:name}/<%= @name %>
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment