freeradius-clients.tpl 1.05 KB
Newer Older
1 2 3 4
## -*- coding: utf-8 -*-
<%!
import re
%>\
5 6 7 8 9 10 11 12 13
<%
for inst in insts:
    if inst['type'] in (2, 3) and 'clients' in inst:
        for client in inst['clients']:
            if 'usecount' in clients[client]:
                clients[client]['usecount'] = clients[client]['usecount'] + 1
            else:
                clients[client]['usecount'] = 1
%>\
14 15 16 17
% for inst in insts:
% if inst['type'] in (2, 3) and 'clients' in inst:
#{{{${' ' + inst['id'] if 'id' in inst else ''}
% for client in inst['clients']:
18 19 20
% if 'seen' in clients[client]:
# client ${client} defined previously
% else:
21
client ${client} {
22
        secret          = ${clients[client]['secret']}
23
<%
24
ipaddr = re.split(r'/(?=[0-9]{1,2}$)', clients[client]['host'])
25 26 27 28 29 30
%>\
        ipaddr          = ${ipaddr[0]}
% if len(ipaddr) > 1:
        netmask         = ${ipaddr[1]}
% endif
        nastype         = other
31
% if clients[client]['usecount'] == 1 and 'id' in inst:
32 33 34 35
        grnetopname     = 1${inst['id']}
% endif
        eduroamspco     = GR
}
36 37 38 39
<%
clients[client]['seen'] = True
%>\
% endif
40 41 42 43
% endfor
#}}}
% endif
% endfor