Skip to content

Instantly share code, notes, and snippets.

@elmeramigleo
Last active December 16, 2016 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elmeramigleo/3e2267dd41ccc5a0a3df74993f3c9989 to your computer and use it in GitHub Desktop.
Save elmeramigleo/3e2267dd41ccc5a0a3df74993f3c9989 to your computer and use it in GitHub Desktop.
#root@salt01:/srv/salt/freeradius/files# cat clients.conf
# 15-Dec-2016
# /etc/freeradius/clients.conf
{% for client in salt ['pillar.get']('freeradius:devices') %}
client {{ client['client'] }} {
ipaddr = {{ client['client'] }}
secret = {{ client['secret'] }}
nastype = other
shortname = {{ client['name'] }}
}
{% endfor %}
#root@salt01:/srv/salt/freeradius/files# cat users
# /etc/freeradius/users
{% for user in salt['pillar.get']('freeradius:users') %}
{{ user['username'] }} SHA-Password := "{{ user['password'] }}"
User-Service-Type = Login-User,
Service-Type = {{ user['service-type'] }},
Fortinet-Access-Profile = "{{ user['forti-access-prof'] }}",
Fortinet-Group-Name = "{{ user['forti-access-grp'] }}",
{% if user.get('av-role', False) -%}
Cisco-AVPair = "shell:roles={{ user['av-role'] }}",
{% endif -%}
{% if user.get('av-lvl', False) -%}
Cisco-AVPair += "shell:priv-lvl={{ user['av-lvl'] }}"
{% endif -%}
{% endfor %}
## Test Account ##
# radtest testing password localhost 0 secretpasswd3 #
# testing Cleartext-Password := "password"
testing SHA-Password := "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"
#testing SHA-Password := "accfbe7a3c0a6d6e0f3a6dfb75a622ff0979a353"
# sample pillar
freeradius:
devices:
- client: 172.16.200.21
secret: secretpasswd1
name: router1
- client: 172.16.200.22
secret: secretpasswd2
name: router2
- client: 127.0.0.1
secret: secretpasswd3
name: 127.0.0.1
users:
- username: user1
password: "abc123..."
service-type: Administrative-User
forti-access-prof: prof-admin
forti-access-grp: APPDBIPCO-Access
av-role: network-admin
av-lvl: 15
- username: user2
password: "abc098..."
service-type: Administrative-User
forti-access-prof: prof-admin
forti-access-grp: APPDBIPCO-Access
av-role: level-1
av-lvl: 1
- username: user3
password: "765def"
service-type: Administrative-User
forti-access-prof: ADM-Access
forti-access-grp: ADM-Access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment