summaryrefslogtreecommitdiff
path: root/data/templates/login/pam_radius_auth.conf.j2
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-05-01 19:18:53 +0200
committerChristian Poessinger <christian@poessinger.com>2022-05-01 19:18:53 +0200
commit3f657383cdd96b984c594bb8323a714d7a692f11 (patch)
tree0cdba8dcaef38434eed25278d02c65e3e6ac4408 /data/templates/login/pam_radius_auth.conf.j2
parent7c71e956e8e1779acd82b130ea149ec761520953 (diff)
downloadvyos-1x-3f657383cdd96b984c594bb8323a714d7a692f11.tar.gz
vyos-1x-3f657383cdd96b984c594bb8323a714d7a692f11.zip
login: T4353: fix Jinja2 linting errors
Diffstat (limited to 'data/templates/login/pam_radius_auth.conf.j2')
-rw-r--r--data/templates/login/pam_radius_auth.conf.j236
1 files changed, 36 insertions, 0 deletions
diff --git a/data/templates/login/pam_radius_auth.conf.j2 b/data/templates/login/pam_radius_auth.conf.j2
new file mode 100644
index 000000000..1105b60e5
--- /dev/null
+++ b/data/templates/login/pam_radius_auth.conf.j2
@@ -0,0 +1,36 @@
+# Automatically generated by system-login.py
+# RADIUS configuration file
+
+{% if radius is vyos_defined %}
+{# RADIUS IPv6 source address must be specified in [] notation #}
+{% set source_address = namespace() %}
+{% if radius.source_address is vyos_defined %}
+{% for address in radius.source_address %}
+{% if address | is_ipv4 %}
+{% set source_address.ipv4 = address %}
+{% elif address | is_ipv6 %}
+{% set source_address.ipv6 = "[" + address + "]" %}
+{% endif %}
+{% endfor %}
+{% endif %}
+{% if radius.server is vyos_defined %}
+# server[:port] shared_secret timeout source_ip
+{# .items() returns a tuple of two elements: key and value. 1 relates to the 2nd element i.e. the value and .priority relates to the key from the internal dict #}
+{% for server, options in radius.server.items() | sort(attribute='1.priority') if not options.disabled %}
+{# RADIUS IPv6 servers must be specified in [] notation #}
+{% if server | is_ipv4 %}
+{{ server }}:{{ options.port }} {{ "%-25s" | format(options.key) }} {{ "%-10s" | format(options.timeout) }} {{ source_address.ipv4 if source_address.ipv4 is vyos_defined }}
+{% else %}
+[{{ server }}]:{{ options.port }} {{ "%-25s" | format(options.key) }} {{ "%-10s" | format(options.timeout) }} {{ source_address.ipv6 if source_address.ipv6 is vyos_defined }}
+{% endif %}
+{% endfor %}
+{% endif %}
+
+priv-lvl 15
+mapped_priv_user radius_priv_user
+
+{% if radius.vrf is vyos_defined %}
+vrf-name {{ radius.vrf }}
+{% endif %}
+{% endif %}
+