infrataster-plugin-ldap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +51 -0
  7. data/Rakefile +36 -0
  8. data/infrataster-plugin-ldap.gemspec +23 -0
  9. data/lib/infrataster-plugin-ldap.rb +4 -0
  10. data/lib/infrataster/contexts/ldap_context.rb +63 -0
  11. data/lib/infrataster/helpers/ldap_resource_helper.rb +12 -0
  12. data/lib/infrataster/resources/ldap_resource.rb +19 -0
  13. data/spec/.vagrant/machines/default/virtualbox/action_provision +1 -0
  14. data/spec/.vagrant/machines/default/virtualbox/action_set_name +1 -0
  15. data/spec/.vagrant/machines/default/virtualbox/id +1 -0
  16. data/spec/.vagrant/machines/default/virtualbox/index_uuid +1 -0
  17. data/spec/.vagrant/machines/default/virtualbox/synced_folders +1 -0
  18. data/spec/Vagrantfile +20 -0
  19. data/spec/cookbooks/apt/CHANGELOG.md +208 -0
  20. data/spec/cookbooks/apt/README.md +252 -0
  21. data/spec/cookbooks/apt/attributes/default.rb +46 -0
  22. data/spec/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  23. data/spec/cookbooks/apt/libraries/helpers.rb +49 -0
  24. data/spec/cookbooks/apt/libraries/matchers.rb +17 -0
  25. data/spec/cookbooks/apt/libraries/network.rb +31 -0
  26. data/spec/cookbooks/apt/metadata.json +54 -0
  27. data/spec/cookbooks/apt/metadata.rb +34 -0
  28. data/spec/cookbooks/apt/providers/preference.rb +63 -0
  29. data/spec/cookbooks/apt/providers/repository.rb +203 -0
  30. data/spec/cookbooks/apt/recipes/cacher-client.rb +81 -0
  31. data/spec/cookbooks/apt/recipes/cacher-ng.rb +43 -0
  32. data/spec/cookbooks/apt/recipes/default.rb +98 -0
  33. data/spec/cookbooks/apt/recipes/unattended-upgrades.rb +43 -0
  34. data/spec/cookbooks/apt/resources/preference.rb +32 -0
  35. data/spec/cookbooks/apt/resources/repository.rb +43 -0
  36. data/spec/cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
  37. data/spec/cookbooks/apt/templates/default/01proxy.erb +5 -0
  38. data/spec/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
  39. data/spec/cookbooks/apt/templates/default/50unattended-upgrades.erb +62 -0
  40. data/spec/cookbooks/apt/templates/default/acng.conf.erb +275 -0
  41. data/spec/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
  42. data/spec/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
  43. data/spec/cookbooks/openldap/CHANGELOG.md +68 -0
  44. data/spec/cookbooks/openldap/README.md +185 -0
  45. data/spec/cookbooks/openldap/attributes/default.rb +76 -0
  46. data/spec/cookbooks/openldap/files/default/common-account +7 -0
  47. data/spec/cookbooks/openldap/files/default/common-auth +9 -0
  48. data/spec/cookbooks/openldap/files/default/common-password +7 -0
  49. data/spec/cookbooks/openldap/files/default/common-session +9 -0
  50. data/spec/cookbooks/openldap/files/default/nsswitch.conf +21 -0
  51. data/spec/cookbooks/openldap/files/default/slapd.seed +21 -0
  52. data/spec/cookbooks/openldap/files/default/test/auth_test.rb +7 -0
  53. data/spec/cookbooks/openldap/files/default/test/server_test.rb +24 -0
  54. data/spec/cookbooks/openldap/metadata.json +124 -0
  55. data/spec/cookbooks/openldap/metadata.rb +102 -0
  56. data/spec/cookbooks/openldap/recipes/auth.rb +71 -0
  57. data/spec/cookbooks/openldap/recipes/client.rb +28 -0
  58. data/spec/cookbooks/openldap/recipes/default.rb +18 -0
  59. data/spec/cookbooks/openldap/recipes/master.rb +23 -0
  60. data/spec/cookbooks/openldap/recipes/server.rb +124 -0
  61. data/spec/cookbooks/openldap/recipes/slave.rb +32 -0
  62. data/spec/cookbooks/openldap/templates/default/default_slapd.erb +47 -0
  63. data/spec/cookbooks/openldap/templates/default/ldap-ldap.conf.erb +16 -0
  64. data/spec/cookbooks/openldap/templates/default/ldap.conf.erb +31 -0
  65. data/spec/cookbooks/openldap/templates/default/libnss-ldap.conf.erb +28 -0
  66. data/spec/cookbooks/openldap/templates/default/login_access.conf.erb +16 -0
  67. data/spec/cookbooks/openldap/templates/default/slapd.conf.erb +132 -0
  68. data/spec/ldap_spec.rb +10 -0
  69. data/spec/spec_helper.rb +17 -0
  70. metadata +253 -0
@@ -0,0 +1,124 @@
1
+ {
2
+ "name": "openldap",
3
+ "version": "1.12.10",
4
+ "description": "Configures a server to be an OpenLDAP master, replication slave or client for auth",
5
+ "long_description": "openldap Cookbook\n=================\nConfigures a server to be an OpenLDAP master, OpenLDAP replication slave, or OpenLDAP client.\n\n\nRequirements\n------------\n### Platform\nUbuntu 10.04 was primarily used in testing this cookbook. Other Ubuntu versions and Debian may work. Red Hat and derivatives are not fully supported, but we take patches.\n\n### Cookbooks\n- openssh\n- nscd\n- openssl (for slave recipe)\n\n\nAttributes\n----------\nBe aware of the attributes used by this cookbook and adjust the defaults for your environment where required, in `attributes/openldap.rb`.\n\n### Client node attributes\n\n- `openldap[:basedn]` - basedn\n- `openldap[:server]` - the LDAP server fully qualified domain name, default `'ldap'.node[:domain]`.\n- `openldap[:tls_enabled]` - specifies whether TLS will be used at all. Setting this to fals will result in your credentials being sent in clear-text.\n- `openldap[:tls_checkpeer]` - specifies whether the client should verify the server's TLS certificate. Highly recommended to set tls_checkpeer to true for production uses in order to avoid man-in-the-middle attacks. Defaults to false for testing and backwards compatibility.\n- `openldap[:pam_password]` - specifies the password change protocol to use. Defaults to md5.\n\n### Server node attributes\n\n- `openldap[:slapd_type]` - master | slave\n- `openldap[:slapd_rid]` - unique integer ID, required if type is slave.\n- `openldap[:slapd_master]` - hostname of slapd master, attempts to search for slapd_type master.\n- `openldap[:manage_ssl]` - Whether or not this cookbook manages your SSL certificates.\n If set to `true`, this cookbook will expect your SSL certificates to be in files/default/ssl and will configure slapd appropriately.\n If set to `false`, you will need to provide your SSL certificates **prior** to this recipe being run. Be sure to set `openldap[:ssl_cert]` and `openldap[:ssl_key]` appropriately.\n- `openldap[:ssl_cert]` - The full path to your SSL certificate.\n- `openldap[:ssl_key]` - The full path to your SSL key.\n- `openldap[:cacert]` - Your certificate authority's certificate (or intermediate authorities), if needed.\n\n### Apache configuration attributes\n\nAttributes useful for Apache authentication with LDAP.\n\nCOOK-128 - set automatically based on openldap[:server] and openldap[:basedn] if those attributes are set. openldap[:auth_bindpw] remains nil by default as a default value is not easily predicted.\n\n- `openldap[:auth_type]` - determine whether binddn and bindpw are required (openldap no, ad yes)\n- `openldap[:auth_url]` - AuthLDAPURL\n- `openldap[:auth_binddn]` - AuthLDAPBindDN\n- `openldap[:auth_bindpw]` - AuthLDAPBindPassword\n\n\nRecipes\n-------\n### auth\n\nSets up the system for using openldap for user authentication.\n\n### default\n\nEmpty recipe, you may want client.\n\n### client\n\nInstall the openldap client packages.\n\n### server\n\nSet up openldap to be a slapd server. Use this if your environment would only have a single slapd server.\n\n### master\n\nSets the `node['openldap']['slapd_type']` to master and then includes the `openldap::server` recipe.\n\n### slave\n\nSets the `node['openldap']['slapd_type']` to slave, then includes the `openldap::server` recipe. If the node is running chef-solo, then the `node['openldap']['slapd_replpw']` and `node['openldap']['slapd_master']` attributes must be set in the JSON attributes file passed to `chef-solo`.\n\n\nUsage\n-----\nEdit Rakefile variables for SSL certificate.\n\nOn client systems,\n\n```ruby\ninclude_recipe \"openldap::auth\"\n```\n\nThis will get the required packages and configuration for client systems. This will be required on server systems as well, so this is a good candidate for inclusion in a base role.\n\nOn server systems, if there's only one LDAP server, then use the `openldap::server` recipe. If replication is required, use the `openldap::master` and `openldap::slave` recipes instead.\n\nWhen initially installing a brand new LDAP master server on Ubuntu 8.10, the configuration directory may need to be removed and recreated before slapd will start successfully. Doing this programmatically may cause other issues, so fix the directory manually :-).\n\n $ sudo slaptest -F /etc/ldap/slapd.d\n str2entry: invalid value for attributeType objectClass #1 (syntax 1.3.6.1.4.1.1466.115.121.1.38)\n => ldif_enum_tree: failed to read entry for /etc/ldap/slapd.d/cn=config/olcDatabase={1}bdb.ldif\n slaptest: bad configuration directory!\n\nFor some reason slapd isn't getting started even though the service resource is notified to start, so start it manually.\nSolution is to simply remove the configuration:\n\n $ sudo rm -rf /etc/ldap/slapd.d/ /etc/ldap/slapd.conf\n $ sudo chef-client\n $ sudo /etc/init.d/slapd start\n\nOr in your wrapper cookbook rewind with ubuntu related fix:\n\n #Fix the wrong content of slapd.d dir on ubuntu 12.04\n chef_gem \"chef-rewind\"\n require 'chef/rewind'\n case node['platform']\n when 'ubuntu'\n rewind \"package[slapd]\" do\n response_file \"slapd.seed\"\n action :upgrade\n notifies :run, \"execute[fix-ubuntu-slapdd]\", :immediately\n end\n end\n #Removes slapd.d/cn=config and slapd.conf deployed from distribution. They will be re-created during the openldap recipe cooking.\n execute \"fix-ubuntu-slapdd\" do\n cmd = \" test -d #{node['openldap']['dir']}/slapd.d && rm -rf #{node['openldap']['dir']}/slapd.d/cn=config\"\n cmd << \" ; test -d #{node['openldap']['dir']}/slapd.conf && rm -rf #{node['openldap']['dir']}/slapd.conf\"\n cmd << \" ; touch #{node['openldap']['dir']}/.fix-ubuntu-slapdd.done\"\n command cmd\n ignore_failure true\n action :nothing\n not_if { ::File.exists?(\"#{node['openldap']['dir']}/.fix-ubuntu-slapdd.done\") }\n end\n\n\n### A note about certificates\n\nCertificates created by the Rakefile are self signed. If you have a purchased CA, that can be used.\n\nWe provide two methods of managing SSL certificates, based off of `openldap[:manage_ssl]`.\n\nIf `openldap[:manage_ssl]` is `true`, then this cookbook manage your certificates itself, and will expect all certificates, intermediate certificates, and keys to be in the same file as defined in `openldap[:ssl_cert]`.\n\nUse https://github.com/atomic-penguin/cookbook-certificate cookbook for advanced certificate deployment or use wrapper cookbook with following code to source ssl files from the wrapper cookbook folder structure:\n\n r = resources(\"cookbook_file[#{node['openldap']['ssl_cert']}]\")\n r.cookbook('NAME OF YOUR WRAPPER COOKBOK')\n\n r = resources(\"cookbook_file[#{node['openldap']['ssl_key']}]\")\n r.cookbook('NAME OF YOUR WRAPPER COOKBOK')\n\nBe sure to update the certificate locations in the templates as required. We suggest copying this cookbook to the site-cookbooks for such modifications, so you can still pull from our master for updates, and then merge your changes in.\n\nHowever, if `openldap[:manage_ssl]` is `false`, then you will need to place the SSL certificates on the client file system **prior** to this cookbook being run. This provides you the flexibility to provide the same set of SSL certificates for multiple uses as well as in one place across your environment, but you will need to manage them.\n- Set `openldap[:ssl-cert]`, `openldap[:ssl_key]`, and `openldap[:cacert]` appropriately.\n- Ensure that that user openldap can access these files. Watch out for apparmor and SELinux if you are placing your SSL certificates in a non-default location.\n\n### New Directory\nIf installing for the first time, the initial directory needs to be created. Create an ldif file, and start populating the directory.\n\n### Passwords\nSet the password, openldap[:rootpw] for the rootdn in the node's attributes. This should be a password hash generated from slappasswd. The default slappasswd command on Ubuntu 8.10 and Mac OS X 10.5 will generate a SHA1 hash:\n\n $ slappasswd -s \"secretsauce\"\n {SSHA}6BjlvtSbVCL88li8IorkqMSofkLio58/\n\nSet this by default in the attributes file, or on the node's entry in the webui.\n\n\nLicense & Authors\n-----------------\n- Author:: Joshua Timberman (<joshua@opscode.com>)\n\n```text\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
6
+ "maintainer": "Opscode, Inc.",
7
+ "maintainer_email": "cookbooks@opscode.com",
8
+ "license": "Apache 2.0",
9
+ "platforms": {
10
+ "ubuntu": ">= 0.0.0",
11
+ "debian": ">= 0.0.0",
12
+ "redhat": ">= 0.0.0",
13
+ "centos": ">= 0.0.0",
14
+ "amazon": ">= 0.0.0",
15
+ "scientific": ">= 0.0.0"
16
+ },
17
+ "dependencies": {
18
+ "openssh": ">= 0.0.0",
19
+ "nscd": ">= 0.0.0",
20
+ "openssl": ">= 0.0.0"
21
+ },
22
+ "recommendations": {
23
+ },
24
+ "suggestions": {
25
+ },
26
+ "conflicting": {
27
+ },
28
+ "providing": {
29
+ },
30
+ "replacing": {
31
+ },
32
+ "attributes": {
33
+ "openldap/basedn": {
34
+ "display_name": "OpenLDAP BaseDN",
35
+ "description": "BaseDN for the LDAP directory",
36
+ "default": "dc=domain,dc=com"
37
+ },
38
+ "openldap/server": {
39
+ "display_name": "OpenLDAP Server",
40
+ "description": "LDAP Server, used for URIs",
41
+ "default": "ldap.domain"
42
+ },
43
+ "openldap/rootpw": {
44
+ "display_name": "OpenLDAP Root Password",
45
+ "description": "Password for 'admin' root user, should be a SHA hash that OpenLDAP supports",
46
+ "default": "nil"
47
+ },
48
+ "openldap/dir": {
49
+ "display_name": "OpenLDAP Dir",
50
+ "description": "Main configuration directory for OpenLDAP",
51
+ "default": "/etc/ldap"
52
+ },
53
+ "openldap/run_dir": {
54
+ "display_name": "OpenLDAP Run Directory",
55
+ "description": "Run directory for LDAP server processes",
56
+ "default": "/var/run/slapd"
57
+ },
58
+ "openldap/module_dir": {
59
+ "display_name": "OpenLDAP Module Directory",
60
+ "description": "Location for OpenLDAP add-on modules",
61
+ "default": "/usr/lib/ldap"
62
+ },
63
+ "openldap/ssl_dir": {
64
+ "display_name": "OpenLDAP SSL Directory",
65
+ "description": "Location for LDAP SSL certificates",
66
+ "default": "openldap_dir/ssl"
67
+ },
68
+ "openldap/cafile": {
69
+ "display_name": "OpenLDAP CA File",
70
+ "description": "Location for CA certificate",
71
+ "default": "openldap_dir_ssl/ca.crt"
72
+ },
73
+ "openldap/slapd_type": {
74
+ "display_name": "OpenLDAP Slapd Type",
75
+ "description": "Whether the server is a master or slave",
76
+ "default": "nil"
77
+ },
78
+ "openldap/slapd_master": {
79
+ "display_name": "OpenLDP Slapd Master",
80
+ "description": "Search nodes for attribute slapd_type master, for slaves",
81
+ "default": "nil"
82
+ },
83
+ "openldap/slapd_replpw": {
84
+ "display_name": "OpenLDAP Slapd Replication Password",
85
+ "description": "Password for slaves to replicate from master",
86
+ "default": "nil"
87
+ },
88
+ "openldap/slapd_rid": {
89
+ "display_name": "OpenLDAP Slapd Replication ID",
90
+ "description": "Slave's ID, must be unique",
91
+ "default": "102"
92
+ },
93
+ "openldap/auth_type": {
94
+ "display_name": "OpenLDAP Auth Type",
95
+ "description": "Used in Apache configs, AuthBasicProvider",
96
+ "default": "openldap"
97
+ },
98
+ "openldap/auth_binddn": {
99
+ "display_name": "OpenLDAP Auth BindDN",
100
+ "description": "Used in auth_url and Apache configs, AuthBindDN",
101
+ "default": "ou=people,openldap_basedn"
102
+ },
103
+ "openldap/auth_bindpw": {
104
+ "display_name": "OpenLDAP Auth Bind Password",
105
+ "description": "Used in Apache configs, AuthBindPassword",
106
+ "default": "nil"
107
+ },
108
+ "openldap/auth_url": {
109
+ "display_name": "OpenLDAP Auth URL",
110
+ "description": "Used in Apache configs, AuthLDAPURL",
111
+ "default": "ldap://openldap_server/openldap_auth_binddn?uid?sub?(objectClass=*)"
112
+ }
113
+ },
114
+ "groupings": {
115
+ },
116
+ "recipes": {
117
+ "openldap": "Empty, use one of the other recipes",
118
+ "openldap::auth": "Set up openldap for user authentication",
119
+ "openldap::client": "Install openldap client packages",
120
+ "openldap::server": "Set up openldap to be a slapd server",
121
+ "openldap::slave": "uses search to set replication slave attributes",
122
+ "openldap::master": "use on nodes that should be a slapd master"
123
+ }
124
+ }
@@ -0,0 +1,102 @@
1
+ name "openldap"
2
+ maintainer "Opscode, Inc."
3
+ maintainer_email "cookbooks@opscode.com"
4
+ license "Apache 2.0"
5
+ description "Configures a server to be an OpenLDAP master, replication slave or client for auth"
6
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
+ version "1.12.10"
8
+ recipe "openldap", "Empty, use one of the other recipes"
9
+ recipe "openldap::auth", "Set up openldap for user authentication"
10
+ recipe "openldap::client", "Install openldap client packages"
11
+ recipe "openldap::server", "Set up openldap to be a slapd server"
12
+ recipe "openldap::slave", "uses search to set replication slave attributes"
13
+ recipe "openldap::master", "use on nodes that should be a slapd master"
14
+
15
+ %w{ ubuntu debian redhat centos amazon scientific}.each do |os|
16
+ supports os
17
+ end
18
+
19
+ %w{ openssh nscd openssl }.each do |cb|
20
+ depends cb
21
+ end
22
+
23
+ attribute "openldap/basedn",
24
+ :display_name => "OpenLDAP BaseDN",
25
+ :description => "BaseDN for the LDAP directory",
26
+ :default => "dc=domain,dc=com"
27
+
28
+ attribute "openldap/server",
29
+ :display_name => "OpenLDAP Server",
30
+ :description => "LDAP Server, used for URIs",
31
+ :default => "ldap.domain"
32
+
33
+ attribute "openldap/rootpw",
34
+ :display_name => "OpenLDAP Root Password",
35
+ :description => "Password for 'admin' root user, should be a SHA hash that OpenLDAP supports",
36
+ :default => "nil"
37
+
38
+ attribute "openldap/dir",
39
+ :display_name => "OpenLDAP Dir",
40
+ :description => "Main configuration directory for OpenLDAP",
41
+ :default => "/etc/ldap"
42
+
43
+ attribute "openldap/run_dir",
44
+ :display_name => "OpenLDAP Run Directory",
45
+ :description => "Run directory for LDAP server processes",
46
+ :default => "/var/run/slapd"
47
+
48
+ attribute "openldap/module_dir",
49
+ :display_name => "OpenLDAP Module Directory",
50
+ :description => "Location for OpenLDAP add-on modules",
51
+ :default => "/usr/lib/ldap"
52
+
53
+ attribute "openldap/ssl_dir",
54
+ :display_name => "OpenLDAP SSL Directory",
55
+ :description => "Location for LDAP SSL certificates",
56
+ :default => "openldap_dir/ssl"
57
+
58
+ attribute "openldap/cafile",
59
+ :display_name => "OpenLDAP CA File",
60
+ :description => "Location for CA certificate",
61
+ :default => "openldap_dir_ssl/ca.crt"
62
+
63
+ attribute "openldap/slapd_type",
64
+ :display_name => "OpenLDAP Slapd Type",
65
+ :description => "Whether the server is a master or slave",
66
+ :default => "nil"
67
+
68
+ attribute "openldap/slapd_master",
69
+ :display_name => "OpenLDP Slapd Master",
70
+ :description => "Search nodes for attribute slapd_type master, for slaves",
71
+ :default => "nil"
72
+
73
+ attribute "openldap/slapd_replpw",
74
+ :display_name => "OpenLDAP Slapd Replication Password",
75
+ :description => "Password for slaves to replicate from master",
76
+ :default => "nil"
77
+
78
+ attribute "openldap/slapd_rid",
79
+ :display_name => "OpenLDAP Slapd Replication ID",
80
+ :description => "Slave's ID, must be unique",
81
+ :default => "102"
82
+
83
+ attribute "openldap/auth_type",
84
+ :display_name => "OpenLDAP Auth Type",
85
+ :description => "Used in Apache configs, AuthBasicProvider",
86
+ :default => "openldap"
87
+
88
+ attribute "openldap/auth_binddn",
89
+ :display_name => "OpenLDAP Auth BindDN",
90
+ :description => "Used in auth_url and Apache configs, AuthBindDN",
91
+ :default => "ou=people,openldap_basedn"
92
+
93
+ attribute "openldap/auth_bindpw",
94
+ :display_name => "OpenLDAP Auth Bind Password",
95
+ :description => "Used in Apache configs, AuthBindPassword",
96
+ :default => "nil"
97
+
98
+ attribute "openldap/auth_url",
99
+ :display_name => "OpenLDAP Auth URL",
100
+ :description => "Used in Apache configs, AuthLDAPURL",
101
+ :default => "ldap://openldap_server/openldap_auth_binddn?uid?sub?(objectClass=*)"
102
+
@@ -0,0 +1,71 @@
1
+ #
2
+ # Cookbook Name:: openldap
3
+ # Recipe:: auth
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ include_recipe "openldap::client"
21
+ include_recipe "openssh"
22
+ include_recipe "nscd"
23
+
24
+ package "libnss-ldap" do
25
+ action :upgrade
26
+ end
27
+
28
+ package "libpam-ldap" do
29
+ action :upgrade
30
+ end
31
+
32
+ template "/etc/ldap.conf" do
33
+ source "ldap.conf.erb"
34
+ mode 00644
35
+ owner "root"
36
+ group "root"
37
+ end
38
+
39
+ template "#{node['openldap']['dir']}/ldap.conf" do
40
+ source "ldap-ldap.conf.erb"
41
+ mode 00644
42
+ owner "root"
43
+ group "root"
44
+ end
45
+
46
+ cookbook_file "/etc/nsswitch.conf" do
47
+ source "nsswitch.conf"
48
+ mode 00644
49
+ owner "root"
50
+ group "root"
51
+ notifies :run, "execute[nscd-clear-passwd]", :immediately
52
+ notifies :run, "execute[nscd-clear-group]", :immediately
53
+ notifies :restart, "service[nscd]", :immediately
54
+ end
55
+
56
+ %w{ account auth password session }.each do |pam|
57
+ cookbook_file "/etc/pam.d/common-#{pam}" do
58
+ source "common-#{pam}"
59
+ mode 00644
60
+ owner "root"
61
+ group "root"
62
+ notifies :restart, "service[ssh]", :delayed
63
+ end
64
+ end
65
+
66
+ template "/etc/security/login_access.conf" do
67
+ source "login_access.conf.erb"
68
+ mode 00644
69
+ owner "root"
70
+ group "root"
71
+ end
@@ -0,0 +1,28 @@
1
+ #
2
+ # Cookbook Name:: openldap
3
+ # Recipe:: client
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ package "ldap-utils" do
21
+ action :upgrade
22
+ end
23
+
24
+ directory node['openldap']['ssl_dir'] do
25
+ mode 00755
26
+ owner "root"
27
+ group "root"
28
+ end
@@ -0,0 +1,18 @@
1
+ #
2
+ # Cookbook Name:: openldap
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
@@ -0,0 +1,23 @@
1
+ #
2
+ # Cookbook Name:: openldap
3
+ # Recipe:: master
4
+ #
5
+ # Copyright 2012, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ node.default['openldap']['slapd_type'] = 'master'
21
+
22
+ include_recipe "openldap::server"
23
+
@@ -0,0 +1,124 @@
1
+ #
2
+ # Cookbook Name:: openldap
3
+ # Recipe:: server
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ include_recipe "openldap::client"
20
+
21
+ case node['platform']
22
+ when "ubuntu"
23
+ package "db4.8-util" do
24
+ action :upgrade
25
+ end
26
+
27
+ directory node['openldap']['preseed_dir'] do
28
+ action :create
29
+ recursive true
30
+ mode 00700
31
+ owner "root"
32
+ group "root"
33
+ end
34
+
35
+ cookbook_file "#{node['openldap']['preseed_dir']}/slapd.seed" do
36
+ source "slapd.seed"
37
+ mode 00600
38
+ owner "root"
39
+ group "root"
40
+ end
41
+
42
+ package "slapd" do
43
+ response_file "slapd.seed"
44
+ action :upgrade
45
+ end
46
+ else
47
+ package "db4.2-util" do
48
+ action :upgrade
49
+ end
50
+
51
+ package "slapd" do
52
+ action :upgrade
53
+ end
54
+ end
55
+
56
+ if node['openldap']['tls_enabled'] && node['openldap']['manage_ssl']
57
+ cookbook_file node['openldap']['ssl_cert'] do
58
+ source "ssl/#{node['openldap']['server']}_cert.pem"
59
+ mode 00644
60
+ owner "root"
61
+ group "root"
62
+ end
63
+ cookbook_file node['openldap']['ssl_key'] do
64
+ source "ssl/#{node['openldap']['server']}.pem"
65
+ mode 00644
66
+ owner "root"
67
+ group "root"
68
+ end
69
+ end
70
+
71
+ if (node['platform'] == "ubuntu")
72
+ template "/etc/default/slapd" do
73
+ source "default_slapd.erb"
74
+ owner "root"
75
+ group "root"
76
+ mode 00644
77
+ end
78
+
79
+ directory "#{node['openldap']['dir']}/slapd.d" do
80
+ recursive true
81
+ owner "openldap"
82
+ group "openldap"
83
+ action :create
84
+ end
85
+
86
+ execute "slapd-config-convert" do
87
+ command "slaptest -f #{node['openldap']['dir']}/slapd.conf -F #{node['openldap']['dir']}/slapd.d/"
88
+ user "openldap"
89
+ action :nothing
90
+ notifies :start, "service[slapd]", :immediately
91
+ end
92
+
93
+ template "#{node['openldap']['dir']}/slapd.conf" do
94
+ source "slapd.conf.erb"
95
+ mode 00640
96
+ owner "openldap"
97
+ group "openldap"
98
+ notifies :stop, "service[slapd]", :immediately
99
+ notifies :run, "execute[slapd-config-convert]"
100
+ end
101
+ else
102
+ case node['platform']
103
+ when "debian","ubuntu"
104
+ template "/etc/default/slapd" do
105
+ source "default_slapd.erb"
106
+ owner "root"
107
+ group "root"
108
+ mode 00644
109
+ end
110
+ end
111
+
112
+ template "#{node['openldap']['dir']}/slapd.conf" do
113
+ source "slapd.conf.erb"
114
+ mode 00640
115
+ owner "openldap"
116
+ group "openldap"
117
+ notifies :restart, "service[slapd]"
118
+ end
119
+ end
120
+
121
+ service "slapd" do
122
+ action [:enable, :start]
123
+ end
124
+