[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log

[libdefaults]
 default_realm = <%= node['krb5']['libdefaults']['default_realm'] %>
 dns_lookup_realm = false
 dns_lookup_kdc = false
 ticket_lifetime = 24h
 renew_lifetime = 7d
 forwardable = true

allow_weak_crypto = <%= node['krb5']['libdefaults']['allow_weak_crypto'] %>
<%
default_tgs_enctypes = node['krb5']['libdefaults']['default_tgs_enctypes']
if !default_tgs_enctypes.nil? && !default_tgs_enctypes.empty? then
-%>
default_tgs_enctypes = <%= default_tgs_enctypes %>
<% end -%>
<%
default_tkt_enctypes = node['krb5']['libdefaults']['default_tkt_enctypes']
if !default_tkt_enctypes.nil? && !default_tkt_enctypes.empty? then
-%>
default_tkt_enctypes = <%= default_tkt_enctypes %>
<% end -%>
<%
permitted_enctypes = node['krb5']['libdefaults']['permitted_enctypes']
if !permitted_enctypes.nil? && !permitted_enctypes.empty? then
-%>
permitted_enctypes = <%= permitted_enctypes %>
<% end -%>

[realms]
<%
node['krb5']['realms'].each do |name, configs|
%>
 <%= name %> = {
<%
  configs.each do |key, value|
    if key == 'kdcs' then
      value.each do |kdc| %>
  kdc = <%= kdc %>
<%
      end
    elsif key == 'admin_server' then
%>
  admin_server = <%= value %>
<%
    end
  end
%>
 }
<%
end
%>

[domain_realm]
<% node['krb5']['domain_realms'].each do |domain_realm| %>
 <%= domain_realm %>
<% end %>

