-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] Added openwisp_radius installation
- Loading branch information
Showing
16 changed files
with
479 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
|
||
- name: Freeradius system packages | ||
when: openwisp2_radius | ||
apt: | ||
name: | ||
- freeradius | ||
- freeradius-rest | ||
state: latest | ||
notify: restart freeradius | ||
|
||
# TODO: I want to use mysql too & default sqlite! | ||
- name: Freeradius system packages | ||
when: openwisp2_radius and freeradius_sql.dialect == "postgresql" | ||
apt: | ||
name: | ||
- postgresql | ||
- freeradius-postgresql | ||
state: latest | ||
|
||
- name: Create freeradius database | ||
when: openwisp2_radius and freeradius_sql.dialect == "postgresql" | ||
postgresql_db: | ||
name: "{{ freeradius_sql.dbname }}" | ||
state: present | ||
|
||
- name: Create freeradius database user | ||
when: openwisp2_radius and freeradius_sql.dialect == "postgresql" | ||
postgresql_user: | ||
db: "{{ freeradius_sql.dbname }}" | ||
name: "{{ freeradius_sql.user }}" | ||
password: "{{ freeradius_sql.password }}" | ||
priv: ALL | ||
|
||
- name: Radius configurations | ||
when: openwisp2_radius | ||
template: | ||
src: freeradius/radiusd.conf.j2 | ||
dest: "{{ freeradius_dir }}/radiusd.conf" | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
notify: restart freeradius | ||
|
||
- name: Clients configuration | ||
when: openwisp2_radius | ||
template: | ||
src: freeradius/clients.conf.j2 | ||
dest: "{{ freeradius_dir }}/site" | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
notify: restart freeradius | ||
|
||
- name: Remove unnecessary modules | ||
when: openwisp2_radius | ||
file: | ||
dest: "{{ item }}" | ||
state: absent | ||
with_items: | ||
- "{{ freeradius_mods_enabled_dir }}/eap" | ||
|
||
- name: SQL configuration | ||
when: openwisp2_radius | ||
template: | ||
src: freeradius/sql.j2 | ||
dest: "{{ freeradius_mods_available_dir }}/sql" | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
notify: restart freeradius | ||
|
||
- name: Enable SQL module | ||
when: openwisp2_radius | ||
file: | ||
src: "{{ freeradius_mods_available_dir }}/sql" | ||
dest: "{{ freeradius_mods_enabled_dir }}/sql" | ||
state: link | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
|
||
- name: SQL Counter module | ||
when: openwisp2_radius | ||
template: | ||
src: freeradius/sql_counter.j2 | ||
dest: "{{ freeradius_mods_available_dir }}/sql_counter" | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
notify: restart freeradius | ||
|
||
- name: Enable SQL Counter module | ||
when: openwisp2_radius | ||
file: | ||
src: "{{ freeradius_mods_available_dir }}/sql_counter" | ||
dest: "{{ freeradius_mods_enabled_dir }}/sql_counter" | ||
state: link | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
|
||
- name: REST configuration | ||
when: openwisp2_radius | ||
template: | ||
src: freeradius/rest.j2 | ||
dest: "{{ freeradius_mods_available_dir }}/rest" | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
notify: restart freeradius | ||
|
||
- name: Enable REST module | ||
when: openwisp2_radius | ||
file: | ||
src: "{{ freeradius_mods_available_dir }}/rest" | ||
dest: "{{ freeradius_mods_enabled_dir }}/rest" | ||
state: link | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
|
||
- name: Remove default site | ||
when: openwisp2_radius | ||
file: | ||
dest: "{{ item }}" | ||
state: absent | ||
with_items: | ||
- "{{ freeradius_sites_enabled_dir }}/default" | ||
- "{{ freeradius_sites_enabled_dir }}/inner-tunnel" | ||
|
||
- name: Site configuration | ||
when: openwisp2_radius | ||
template: | ||
src: freeradius/site.j2 | ||
dest: "{{ freeradius_sites_enabled_dir }}/site" | ||
mode: 0640 | ||
owner: freerad | ||
group: freerad | ||
notify: restart freeradius |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Freeradius Clients | ||
|
||
client radius_clients { | ||
ipaddr = {{ freeradius_clients_ip }} | ||
secret = {{ freeradius_clients_key }} | ||
nas_type = other | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
prefix = /usr | ||
exec_prefix = ${prefix} | ||
sysconfdir = /etc | ||
localstatedir = /var | ||
sbindir = ${exec_prefix}/sbin | ||
logdir = /var/log/radius | ||
raddbdir = ${sysconfdir}/raddb | ||
radacctdir = /var/log/radius/radacct | ||
name = radiusd | ||
confdir = ${raddbdir} | ||
modconfdir = ${confdir}/mods-config | ||
certdir = ${confdir}/certs | ||
cadir = ${confdir}/certs | ||
run_dir = ${localstatedir}/run/${name} | ||
db_dir = ${raddbdir} | ||
libdir = /usr/lib/freeradius | ||
pidfile = ${run_dir}/${name}.pid | ||
correct_escapes = true | ||
max_request_time = 30 | ||
cleanup_delay = 5 | ||
max_requests = 16384 | ||
hostname_lookups = no | ||
|
||
log { | ||
destination = stdout | ||
auth = yes | ||
auth_badpass = yes | ||
auth_goodpass = yes | ||
} | ||
|
||
checkrad = ${sbindir}/checkrad | ||
security { | ||
user = root | ||
group = root | ||
allow_core_dumps = no | ||
max_attributes = 200 | ||
reject_delay = 1 | ||
status_server = yes | ||
allow_vulnerable_openssl = no | ||
} | ||
|
||
proxy_requests = yes | ||
$INCLUDE proxy.conf | ||
$INCLUDE clients.conf | ||
thread pool { | ||
start_servers = 5 | ||
max_servers = 32 | ||
min_spare_servers = 3 | ||
max_spare_servers = 10 | ||
max_requests_per_server = 0 | ||
auto_limit_acct = no | ||
} | ||
|
||
modules { | ||
$INCLUDE mods-enabled/ | ||
} | ||
|
||
instantiate {} | ||
|
||
policy { | ||
$INCLUDE policy.d/ | ||
} | ||
$INCLUDE sites-enabled/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
rest { | ||
tls = {} | ||
connect_uri = "{{ freeradius_rest.url }}" | ||
|
||
authorize { | ||
uri = "${..connect_uri}/authorize/" | ||
method = 'post' | ||
body = 'json' | ||
data = '{"username": "%{User-Name}", "password": "%{User-Password}"}' | ||
tls = ${..tls} | ||
} | ||
|
||
# this section can be left empty | ||
authenticate {} | ||
|
||
post-auth { | ||
uri = "${..connect_uri}/postauth/" | ||
method = 'post' | ||
body = 'json' | ||
data = '{"username": "%{User-Name}", "password": "%{User-Password}", "reply": "%{reply:Packet-Type}", "called_station_id": "%{Called-Station-ID}", "calling_station_id": "%{Calling-Station-ID}"}' | ||
tls = ${..tls} | ||
} | ||
|
||
accounting { | ||
uri = "${..connect_uri}/accounting/" | ||
method = 'post' | ||
body = 'json' | ||
data = '{"status_type": "%{Acct-Status-Type}", "session_id": "%{Acct-Session-Id}", "unique_id": "%{Acct-Unique-Session-Id}", "username": "%{User-Name}", "realm": "%{Realm}", "nas_ip_address": "%{NAS-IP-Address}", "nas_port_id": "%{NAS-Port}", "nas_port_type": "%{NAS-Port-Type}", "session_time": "%{Acct-Session-Time}", "authentication": "%{Acct-Authentic}", "input_octets": "%{Acct-Input-Octets}", "output_octets": "%{Acct-Output-Octets}", "called_station_id": "%{Called-Station-Id}", "calling_station_id": "%{Calling-Station-Id}", "terminate_cause": "%{Acct-Terminate-Cause}", "service_type": "%{Service-Type}", "framed_protocol": "%{Framed-Protocol}", "framed_ip_address": "%{Framed-IP-Address}"}' | ||
tls = ${..tls} | ||
} | ||
} |
Oops, something went wrong.