Added support for key statements

This commit is contained in:
RedRampage 2014-12-18 16:10:12 +03:00
parent 0d378f8441
commit fac5b82f55
2 changed files with 18 additions and 0 deletions

View File

@ -78,6 +78,10 @@ dhcpd_options: False
# - address: '' IP address reserved for that host, optional # - address: '' IP address reserved for that host, optional
# - ethernet: '' Ethernet MAC address of this host, optional # - ethernet: '' Ethernet MAC address of this host, optional
dhcpd_keys: []
#- key: "secure-key"
# algorithm: "hmac-md5"
# secret: "JFw7jM2/KVU2hIB4xkDSQmHB6JJOLUu4xkzwLNNpR88="
# List of classes # List of classes
dhcpd_classes: [] dhcpd_classes: []

View File

@ -178,6 +178,15 @@ failover peer "{{ failover.failover }}" {
{% endif %} {% endif %}
} }
{% endmacro %} {% endmacro %}
{% macro print_key(key) %}
{% if key.comment is defined and key.comment %}
# {{ key.comment }}
{% endif %}
key "{{ key.key }}" {
algorithm {{ key.algorithm|default('hmac-md5') }};
secret {{ key.secret }};
}
{% endmacro %}
{% if dhcpd_authoritative is defined and dhcpd_authoritative %} {% if dhcpd_authoritative is defined and dhcpd_authoritative %}
authoritative; authoritative;
@ -195,6 +204,11 @@ not authoritative;
# Configuration options # Configuration options
{{ dhcpd_options }} {{ dhcpd_options }}
{% endif %}
{% if dhcpd_keys is defined and dhcpd_keys %}
{% for key in dhcpd_keys %}
{{ print_key(key) }}
{% endfor %}
{% endif %} {% endif %}
{% if dhcpd_classes is defined and dhcpd_classes %} {% if dhcpd_classes is defined and dhcpd_classes %}
{% for class in dhcpd_classes %} {% for class in dhcpd_classes %}