<commit_before>class << self; include OpenvpnHelpers; end

# setup each client_config
openvpn_process :client_configs do
  config_name = self.conf_name
  config = self.conf

  # user_name required for given vpn server/config
  user_name = config[:user_name]

  unless config[:autopki] && config[:autopki][:enabled]
    cookbook_file "/etc/openvpn/#{config_name}-#{user_name}-ca.crt" do
      source "#{config_name}-ca.crt"
      owner "root"
      group "openvpn"
      mode 00640
      cookbook config[:file_cookbook] if config[:file_cookbook]
    end

    if (config[:auth][:type] == "cert") or (config[:auth][:type] == "cert_passwd")
      cookbook_file "/etc/openvpn/#{config_name}-#{user_name}.crt" do
        source "#{config_name}-#{user_name}.crt"
        owner "root"
        group "openvpn"
        mode 00640
        cookbook config[:file_cookbook] if config[:file_cookbook]
      end

      cookbook_file "/etc/openvpn/#{config_name}-#{user_name}.key" do
        source "#{config_name}-#{user_name}.key"
        owner "root"
        group "openvpn"
        mode 00600  # not group or others accesible
        cookbook config[:file_cookbook] if config[:file_cookbook]
      end
    end
  end

  cookbook_file "/etc/openvpn/#{config_name}-#{user_name}.conf" do
    source "#{config_name}-#{user_name}.conf"
    owner "root"
    group "openvpn"
    mode 00640
    notifies :restart, "service[openvpn]"
    cookbook config[:file_cookbook] if config[:file_cookbook]
  end
end<commit_msg>fixed client.conf source in template<commit_after>class << self; include OpenvpnHelpers; end

# setup each client_config
openvpn_process :client_configs do
  config_name = self.conf_name
  config = self.conf

  # user_name required for given vpn server/config
  user_name = config[:user_name]

  unless config[:autopki] && config[:autopki][:enabled]
    cookbook_file "/etc/openvpn/#{config_name}-#{user_name}-ca.crt" do
      source "#{config_name}-ca.crt"
      owner "root"
      group "openvpn"
      mode 00640
      cookbook config[:file_cookbook] if config[:file_cookbook]
    end

    if (config[:auth][:type] == "cert") or (config[:auth][:type] == "cert_passwd")
      cookbook_file "/etc/openvpn/#{config_name}-#{user_name}.crt" do
        source "#{config_name}-#{user_name}.crt"
        owner "root"
        group "openvpn"
        mode 00640
        cookbook config[:file_cookbook] if config[:file_cookbook]
      end

      cookbook_file "/etc/openvpn/#{config_name}-#{user_name}.key" do
        source "#{config_name}-#{user_name}.key"
        owner "root"
        group "openvpn"
        mode 00600  # not group or others accesible
        cookbook config[:file_cookbook] if config[:file_cookbook]
      end
    end
  end

  cookbook_file "/etc/openvpn/#{config_name}-#{user_name}.conf" do
    source "client.conf.erb"
    owner "root"
    group "openvpn"
    mode 00640
    notifies :restart, "service[openvpn]"
    cookbook config[:file_cookbook] if config[:file_cookbook]
  end
end
{'fraction_non_alphanumeric': 0.1259185036740147, 'fraction_numerical': 0.013360053440213761, 'mean_word_length': 3.30316091954023, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6019245', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1024, 'n_words': 217}