【问题标题】:LDAP Authentication for Apache using Puppet使用 Puppet 对 Apache 进行 LDAP 身份验证
【发布时间】:2018-02-09 16:47:09
【问题描述】:

我目前正在 puppet 中设置反向代理,以便我可以使用 Active Directory 进行身份验证。

我的 puppet 模块中有以下内容。

class { 'apache::mod::ldap' :}
class { 'apache::mod::authnz_ldap' :}

apache::vhost { 'reverse-proxy':
  port           => '443',
  docroot        => '/var/www/html',
  ssl            => true,
  ssl_cert       => '/etc/httpd/ssl/cert.crt',
  ssl_key        => '/etc/httpd/ssl/cert.key',
  require        => [ File['/etc/httpd/ssl/cert.crt'], File['/etc/httpd/ssl/cert.key']],
  rewrites       => [
    {  
      comment      => 'Eliminate Trace and Track',
      rewrite_cond => ['%{REQUEST_METHOD} ^(TRACE|TRACK)'],
      rewrite_rule => [' .* - [F]'],
    },
  ],
  proxy_preserve_host => true,
  proxy_pass => {
      path => '/',
      url => 'http://127.0.0.1:5601/',
  }, 
  directories => [
    { 
      path => '/',
      provider => 'location',
      auth_name => 'Kibana Authentication',
      auth_type => 'Basic',
      auth_basic_provider => 'ldap',
      auth_ldap_bind_dn => 'cn=serviceuser,ou=Users,dc=example,dc=com',
      auth_ldap_bind_password => 'supersecretpassword',
      auth_ldap_url => 'ldaps://ldap.example.com/dc=example,dc=com?CN?
sub?(objectClass=user)',
      require => 'ldap-group 
cn=application_users,ou=application_groups,ou=groups,dc=example,dc=com',
    },
  ],
}

我遇到的问题是,当我将此配置应用于我的 apache 服务器时,auth_ldap_bind_dnauth_ldap_bind_passwordauth_ldap_url 没有被复制。 Puppet 没有抛出任何错误并且 apache 运行良好,但它没有针对 LDAP 进行身份验证。

【问题讨论】:

  • 请添加您正在使用的 Puppet Master、Puppet 代理和 Puppet Apache 模块的版本。

标签: linux apache puppet httpd.conf


【解决方案1】:

旧线程,但为了其他有相同问题的人的利益:

我查看了github 中的 apache 模块代码,它似乎不支持您提到的参数(auth_ldap_bind_dnauth_ldap_bind_passwordauth_ldap_url)。

但是,目录资源允许您包含自定义片段,您可以使用这些片段将 apache 模块范围之外的任何自定义配置注入到您的配置中。

在你的情况下,这应该有效:

class { 'apache::mod::ldap' :}
class { 'apache::mod::authnz_ldap' :}

apache::vhost { 'reverse-proxy':
  port           => '443',
  docroot        => '/var/www/html',
  ssl            => true,
  ssl_cert       => '/etc/httpd/ssl/cert.crt',
  ssl_key        => '/etc/httpd/ssl/cert.key',
  require        => [ File['/etc/httpd/ssl/cert.crt'], File['/etc/httpd/ssl/cert.key']],
  rewrites       => [
    {  
      comment      => 'Eliminate Trace and Track',
      rewrite_cond => ['%{REQUEST_METHOD} ^(TRACE|TRACK)'],
      rewrite_rule => [' .* - [F]'],
    },
  ],
  proxy_preserve_host => true,
  proxy_pass => {
      path => '/',
      url => 'http://127.0.0.1:5601/',
  }, 
  directories => [
    { 
      path => '/',
      provider => 'location',
      auth_name => 'Kibana Authentication',
      auth_type => 'Basic',
      auth_basic_provider => 'ldap',
      custom_fragment => "AuthLDAPURL 'ldaps://ldap.example.com/dc=example,dc=com?CN?sub?(objectClass=user)'
        AuthLDAPBindDN 'cn=serviceuser,ou=Users,dc=example,dc=com'
        AuthLDAPBindPassword supersecretpassword",
      require => 'ldap-group cn=application_users,ou=application_groups,ou=groups,dc=example,dc=com',
    },
  ],
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-25
    • 2014-02-28
    • 2021-09-02
    • 1970-01-01
    • 2017-07-23
    • 2015-10-03
    • 2014-03-08
    • 2014-08-09
    相关资源
    最近更新 更多