summaryrefslogtreecommitdiff
path: root/manifests/phpldapadmin.pp
blob: 0efd9d94ee3ab59e48c7f26f7c0036f2489822b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# @summary Sets up a phpldapadmin instance
# @option nginx_server
#   Name of the nginx server
# @option Manage server
#   Should this class manage the nginx server resource
class profiles::phpldapadmin (
  String $nginx_server,
  Boolean $manage_server = true,
  Stdlib::Absolutepath $www_root = '/usr/share/webapps/phpldapadmin',
) {

  include ::php_fpm

  nginx::resource::server { $nginx_server:
    ipv6_enable         => true,
    ipv6_listen_options => '',
    www_root            => $www_root,
    index_files         => ['index.php'],
  }


  class { 'phpldapadmin':
    servername       => 'Adrift.Space',
    auth_type        => 'cookie',
    blowfish_secret  => Sensitive(extlib::cache_data('profiles::phpldapadmin', 'blowfish', extlib::random_password(100))),
    base_dn          => ['dc=adrift,dc=space'],
    bind_dn_template => 'uid=%s,ou=People,dc=adrift,dc=space',
    open_tree        => true,
  }

  # file { "${www_root}/config/config.php":
  #   target => $phpldapadmin::config_file,
  # }

  class { 'phpldapadmin::auto_number::search':
    uid         => 10000,
    gid         => 10000,
    search_base => 'ou=People,dc=adrift,dc=space',
  }

  php_fpm::nginx { 'phpldapadmin':
    server => $nginx_server,
    conf   => {
      location_allow => [
        '127.0.0.1',
        '::1',
        "${facts['network6']}/${extlib::netmask_to_cidr($facts['netmask6'])}",
        "${facts['network']}/${extlib::netmask_to_cidr($facts['netmask'])}",
      ],
      location_deny  => [
        'all',
      ],
      www_root       => '/usr/share/webapps/phpldapadmin',
    },
  }

  # nginx::resource::location { 'phpldapadmin':
  #   ssl            => true,
  #   ssl_only       => true,
  # }

}