Commit 6cb974a2 authored by Angel L. Mateo's avatar Angel L. Mateo
Browse files

Add freeradius::module::ippool

to configure freeradius' pools
parent 23208d60
# == Define: freeradius::module::ippool
#
define freeradius::module::ippool (
String $range_start,
String $range_stop,
String $netmask,
$ensure = 'present',
Optional[Integer] $cache_size = undef,
String $filename = "\${db_dir}/db.${name}",
String $ip_index = "\${db_dir}/db.${name}.index",
Freeradius::Boolean $override = 'no',
Integer $maximum_timeout = 0,
Optional[String] $key = undef,
) {
freeradius::module { "ippool_${name}":
ensure => $ensure,
content => template('freeradius/ippool.erb'),
}
}
<%- require 'ipaddr' -%>
# Do server side ip pool management. Should be added in
# post-auth and accounting sections.
#
# The module also requires the existence of the Pool-Name
# attribute. That way the administrator can add the Pool-Name
# attribute in the user profiles and use different pools for
# different users. The Pool-Name attribute is a *check* item
# not a reply item.
#
# The Pool-Name should be set to the ippool module instance
# name or to DEFAULT to match any module.
#
# Example:
# radiusd.conf: ippool students { [...] }
# ippool teachers { [...] }
# users file : DEFAULT Group == students, Pool-Name := "students"
# DEFAULT Group == teachers, Pool-Name := "teachers"
# DEFAULT Group == other, Pool-Name := "DEFAULT"
#
# Note: If you change the range parameters you must then erase the
# db files.
#
ippool <%= @name %> {
# The main db file used to allocate addresses.
filename = <%= @filename %>
# The start and end ip addresses for this pool.
range_start = <%= @range_start %>
range_stop = <%= @range_stop %>
# The network mask used for this pool.
netmask = <%= @netmask %>
# The gdbm cache size for the db files. Should
# be equal to the number of ip's available in
# the ip pool
<%- if @cache_size -%>
cache_size = <%= @cache_size %>
<%- else -%>
cache_size = <%= (IPAddr.new @range_stop).to_i() - (IPAddr.new @range_start).to_i() + 1 %>
<%- end -%>
# Helper db index file used in multilink
<%- if @ip_index -%>
ip_index = <%= @ip_index %>
<%- else -%>
ip_index = ${db_dir}/db.<%= @name %>.index
<%- end -%>
# If set, the Framed-IP-Address already in the
# reply (if any) will be discarded, and replaced
# ith a Framed-IP-Address assigned here.
override = <%= @override %>
# Specifies the maximum time in seconds that an
# entry may be active. If set to zero, means
# "no timeout". The default value is 0
maximum_timeout = <%= @maximum_timeout %>
# The key to use for the session database (which
# holds the allocated ip's) normally it should
# just be the nas ip/port (which is the default).
#
# If your NAS sends the same value of NAS-Port
# all requests, the key should be based on some
# other attribute that is in ALL requests, AND
# is unique to each machine needing an IP address.
# key = "%{NAS-IP-Address} %{NAS-Port}"
<%- if @key -%>
key = "<%= @key %>"
<%- end -%>
}
Markdown is supported
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