Commit bd5bed02 authored by Zenon Mousmoulas's avatar Zenon Mousmoulas

Better handling of auth+acct/auth/acct in freeradius-proxy.tpl

parent e830cdb3
......@@ -49,16 +49,53 @@ home_server ${srv} {
}
% endfor
% for realm in sorted([r for r in inst['realms'] if 'proxy_to' in inst['realms'][r]], cmp=wildcard_realm_least_precedence, reverse=True):
<%
realm_servers = {}
for t in ['auth', 'acct', 'auth+acct']:
realm_servers[t] = set([s for s in inst['realms'][realm]['proxy_to']
if servers[s]['rad_pkt_type'] == t])
%>\
% if len(realm_servers['auth+acct']) == len(inst['realms'][realm]['proxy_to']):
home_server_pool ${realm | realm_disarm} {
type = fail-over
% for srv in inst['realms'][realm]['proxy_to']:
% for srv in realm_servers['auth+acct']:
home_server = ${srv}
% endfor
}
% else:
% if len(realm_servers['auth']) > 0:
home_server_pool ${realm | realm_disarm}_auth {
type = fail-over
% for srv in realm_servers['auth']:
home_server = ${srv}
% endfor
}
% endif
% if len(realm_servers['acct']) > 0:
home_server_pool ${realm | realm_disarm}_acct {
type = fail-over
% for srv in realm_servers['auth']:
home_server = ${srv}
% endfor
}
% endif
% endif
% if len(realm_servers['auth+acct']) == len(inst['realms'][realm]['proxy_to']) \
or len(realm_servers['auth']) > 0:
realm ${realm | realm_regex} {
% if len(realm_servers['auth+acct']) == len(inst['realms'][realm]['proxy_to']):
pool = ${realm | realm_disarm}
% else:
auth_pool = ${realm | realm_disarm}_auth
% if len(realm_servers['acct']) > 0:
acct_pool = ${realm | realm_disarm}_acct
% else:
acct_pool = discard_accounting
% endif
% endif
nostrip
}
% endif
% endfor
#}}}
% endif
......
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