# /usr/local/etc/raddb/mgetty.config
prefix = /usr/local
exec_prefix = ${prefix}
sysconfdir = ${prefix}/etc
localstatedir = /var
sbindir = ${exec_prefix}/sbin
logdir = ${localstatedir}/log/radius
raddbdir = ${sysconfdir}/raddb
radacctdir = ${logdir}/radacct
confdir = ${raddbdir}
run_dir = ${localstatedir}/run/radiusd
log_file = ${logdir}/radius.log
libdir = ${exec_prefix}/lib
pidfile = ${run_dir}/radiusd.pid
max_request_time = 30
delete_blocked_requests = no
cleanup_delay = 5
max_requests = 1024
bind_address = *
port = 0
hostname_lookups = no
allow_core_dumps = no
regular_expressions	= yes
extended_expressions	= yes
log_stripped_names = no
log_auth = yes
log_auth_badpass = yes
log_auth_goodpass = no
usercollide = yes
lower_user = before
lower_pass = no
nospace_user = no
nospace_pass = no
checkrad = ${sbindir}/checkrad
security {
	max_attributes = 200
	reject_delay = 1
	status_server = no
}
proxy_requests  = yes
$INCLUDE  ${confdir}/proxy.conf
$INCLUDE  ${confdir}/clients.conf
snmp	= no
$INCLUDE  ${confdir}/snmp.conf
thread pool {
	start_servers = 5
	max_servers = 32
	min_spare_servers = 3
	max_spare_servers = 10
	max_requests_per_server = 0
}
modules {
	sqlcounter monthlytraffic {
		counter-name = Monthly-Traffic
		check-name = Max-Monthly-Traffic
		sqlmod-inst = sql
		key = User-Name
		reset = monthly
		query = "SELECT (sum(AcctInputOctets)+sum(AcctOutputOctets)) FROM radacct WHERE UserName='%u' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
	}
	pap {
		encryption_scheme = clear
	}
	chap {
		authtype = CHAP
	}
	pam {
		pam_auth = radiusd
	}
	unix {
		cache = no
		cache_reload = 600
		radwtmp = ${localstatedir}/log/wtmp
	}
	eap {
		default_eap_type = md5
		timer_expire     = 60
		md5 {
		}
		leap {
		}
	}
	mschap {
		authtype = MS-CHAP
	}
	ldap {
		server = "ldap.domain.ru"
		identity = "cn=admin,dc=domain,dc=ru"
		password = secrettpass
		basedn = "ou=users,dc=domain,dc=ru"
		filter = "(uid=%u)"
		start_tls = no
		tls_mode = no
		default_profile = "cn=radprofile,dc=domain,dc=ru"
		access_group = "cn=dialup-group,dc=domain,dc=ru"
		access_attr = "dialupAccess"
		dictionary_mapping = ${raddbdir}/ldap.attrmap
		ldap_connections_number = 5
		password_attribute = userPassword
		timeout = 4
		timelimit = 3
		net_timeout = 1
	}
	realm realmslash {
		format = prefix
		delimiter = "/"
	}
	realm suffix {
		format = suffix
		delimiter = "@"
	}
	realm realmpercent {
		format = suffix
		delimiter = "%"
	}
	preprocess {
		huntgroups = ${confdir}/huntgroups
		hints = ${confdir}/hints
		with_ascend_hack = no
		ascend_channels_per_line = 23
		with_ntdomain_hack = no
		with_specialix_jetstream_hack = no
		with_cisco_vsa_hack = no
	}
	files {
		usersfile = ${confdir}/users
		acctusersfile = ${confdir}/acct_users
		compat = no
	}
	detail {
		detailperm = 0600
	}
	acct_unique {
		key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port-Id"
	}
	$INCLUDE  ${confdir}/sql.conf
	radutmp {
		filename = ${logdir}/radutmp
		username = %{User-Name}
		case_sensitive = yes
		check_with_nas = yes		
		perm = 0600
		callerid = "yes"
	}
	radutmp sradutmp {
		filename = ${logdir}/sradutmp
		perm = 0644
		callerid = "no"
	}
	attr_filter {
		attrsfile = ${confdir}/attrs
	}
	counter daily {
		filename = ${raddbdir}/db.daily
		key = User-Name
		count-attribute = Acct-Session-Time
		reset = daily
		counter-name = Daily-Session-Time
		check-name = Max-Daily-Session
		allowed-servicetype = Framed-User
		cache-size = 5000
	}
	always fail {
		rcode = fail
	}
	always reject {
		rcode = reject
	}
	always ok {
		rcode = ok
		simulcount = 0
		mpp = no
	}
	expr {
	}
	digest {
	}
	exec {
		wait = yes
		input_pairs = request
	}
	exec echo {
		wait = yes
		program = "/bin/echo %{User-Name}"
		input_pairs = request
		output_pairs = reply
	}
	ippool legal_pool {
		range-start = 192.168.253.2
		range-stop = 192.168.253.254
		netmask = 255.255.255.0
		cache-size = 800
		session-db = ${raddbdir}/db.legalpool
		ip-index = ${raddbdir}/db.legalindex
		override = yes
	}
	ippool illegal_pool {
		range-start = 192.168.252.2
		range-stop = 192.168.252.254
		netmask = 255.255.255.0
		cache-size = 800
		session-db = ${raddbdir}/db.illegalpool
		ip-index = ${raddbdir}/db.illegalindex
		override = yes
	}
	$INCLUDE  ${confdir}/perl.conf
}
instantiate {
	expr
	sql
}
authorize {
	chap
	mschap
	files
	ldap
	files
	perl_limits
}
authenticate {
	Auth-Type PAP {
		pap
	}
	Auth-Type CHAP {
		chap
	}
	Auth-Type MS-CHAP {
		mschap
	}
	unix
	eap
}
preacct {
	preprocess
	suffix
	files
}
accounting {
	acct_unique
	unix		
	radutmp
	sradutmp
	legal_pool
	illegal_pool
	sql
}
session {
	radutmp
	sql
}
post-auth {
	legal_pool
	illegal_pool
}
pre-proxy {
}
post-proxy {
	eap
}
