ruby-ldap 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/ChangeLog +18 -0
  2. data/FAQ +5 -9
  3. data/NOTES +29 -0
  4. data/README +22 -18
  5. data/TODO +10 -0
  6. data/clientauth.c +605 -0
  7. data/conn.c +24 -1
  8. data/entry.c +9 -9
  9. data/extconf.rb +70 -29
  10. data/ldap.c +67 -0
  11. data/lib/ldap/control.rb +3 -3
  12. data/lib/ldap/ldif.rb +264 -269
  13. data/lib/ldap/schema.rb +39 -33
  14. data/mod.c +7 -3
  15. data/rbldap.h +8 -6
  16. data/test/cookbooks/apt/metadata.rb +13 -0
  17. data/test/cookbooks/apt/providers/repository.rb +73 -0
  18. data/test/cookbooks/apt/recipes/cacher-client.rb +44 -0
  19. data/test/cookbooks/apt/recipes/cacher.rb +45 -0
  20. data/test/cookbooks/apt/recipes/default.rb +50 -0
  21. data/test/cookbooks/apt/resources/repository.rb +30 -0
  22. data/test/cookbooks/nginx/attributes/default.rb +35 -0
  23. data/test/cookbooks/nginx/definitions/nginx_site.rb +35 -0
  24. data/test/cookbooks/nginx/metadata.rb +86 -0
  25. data/test/cookbooks/nginx/recipes/default.rb +56 -0
  26. data/test/cookbooks/nginx/recipes/source.rb +143 -0
  27. data/test/cookbooks/openldap/attributes/default.rb +61 -0
  28. data/test/cookbooks/openldap/metadata.rb +99 -0
  29. data/test/cookbooks/openldap/recipes/auth.rb +70 -0
  30. data/test/cookbooks/openldap/recipes/client.rb +28 -0
  31. data/test/cookbooks/openldap/recipes/default.rb +18 -0
  32. data/test/cookbooks/openldap/recipes/server.rb +110 -0
  33. data/test/cookbooks/postgresql/attributes/default.rb +68 -0
  34. data/test/cookbooks/postgresql/metadata.rb +15 -0
  35. data/test/cookbooks/postgresql/recipes/client.rb +27 -0
  36. data/test/cookbooks/postgresql/recipes/default.rb +20 -0
  37. data/test/cookbooks/postgresql/recipes/server.rb +36 -0
  38. data/test/cookbooks/postgresql/recipes/server_debian.rb +51 -0
  39. data/test/cookbooks/postgresql/recipes/server_redhat.rb +84 -0
  40. data/test/cookbooks/sqlite/metadata.rb +11 -0
  41. data/test/cookbooks/sqlite/recipes/default.rb +26 -0
  42. data/test/cookbooks/vagrant_main/recipes/default.rb +12 -0
  43. data/test/moz_cert.rb +105 -0
  44. data/test/setup.rb +2 -2
  45. data/win/wldap32.def +257 -0
  46. metadata +78 -55
@@ -0,0 +1,35 @@
1
+ default[:nginx][:version] = "0.8.54"
2
+
3
+ case platform
4
+ when "debian","ubuntu"
5
+ set[:nginx][:dir] = "/etc/nginx"
6
+ set[:nginx][:log_dir] = "/var/log/nginx"
7
+ set[:nginx][:user] = "www-data"
8
+ set[:nginx][:binary] = "/usr/sbin/nginx"
9
+ else
10
+ set[:nginx][:dir] = "/etc/nginx"
11
+ set[:nginx][:log_dir] = "/var/log/nginx"
12
+ set[:nginx][:user] = "www-data"
13
+ set[:nginx][:binary] = "/usr/sbin/nginx"
14
+ end
15
+
16
+ default[:nginx][:gzip] = "on"
17
+ default[:nginx][:gzip_http_version] = "1.0"
18
+ default[:nginx][:gzip_comp_level] = "2"
19
+ default[:nginx][:gzip_proxied] = "any"
20
+ default[:nginx][:gzip_types] = [
21
+ "text/plain",
22
+ "text/html",
23
+ "text/css",
24
+ "application/x-javascript",
25
+ "text/xml",
26
+ "application/xml",
27
+ "application/xml+rss",
28
+ "text/javascript"
29
+ ]
30
+
31
+ default[:nginx][:keepalive] = "on"
32
+ default[:nginx][:keepalive_timeout] = 65
33
+ default[:nginx][:worker_processes] = cpu[:total]
34
+ default[:nginx][:worker_connections] = 2048
35
+ default[:nginx][:server_names_hash_bucket_size] = 64
@@ -0,0 +1,35 @@
1
+ #
2
+ # Cookbook Name:: nginx
3
+ # Definition:: nginx_site
4
+ # Author:: AJ Christensen <aj@junglist.gen.nz>
5
+ #
6
+ # Copyright 2008-2009, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ define :nginx_site, :enable => true do
22
+ if params[:enable]
23
+ execute "nxensite #{params[:name]}" do
24
+ command "/usr/sbin/nxensite #{params[:name]}"
25
+ notifies :restart, resources(:service => "nginx")
26
+ not_if do ::File.symlink?("#{node[:nginx][:dir]}/sites-enabled/#{params[:name]}") end
27
+ end
28
+ else
29
+ execute "nxdissite #{params[:name]}" do
30
+ command "/usr/sbin/nxdissite #{params[:name]}"
31
+ notifies :restart, resources(:service => "nginx")
32
+ only_if do ::File.symlink?("#{node[:nginx][:dir]}/sites-enabled/#{params[:name]}") end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,86 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs and configures nginx"
5
+ version "0.99.0"
6
+
7
+ recipe "nginx", "Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available"
8
+ recipe "nginx::source", "Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"
9
+
10
+ %w{ ubuntu debian centos redhat fedora }.each do |os|
11
+ supports os
12
+ end
13
+
14
+ %w{ build-essential runit }.each do |cb|
15
+ depends cb
16
+ end
17
+
18
+ attribute "nginx/dir",
19
+ :display_name => "Nginx Directory",
20
+ :description => "Location of nginx configuration files",
21
+ :default => "/etc/nginx"
22
+
23
+ attribute "nginx/log_dir",
24
+ :display_name => "Nginx Log Directory",
25
+ :description => "Location for nginx logs",
26
+ :default => "/var/log/nginx"
27
+
28
+ attribute "nginx/user",
29
+ :display_name => "Nginx User",
30
+ :description => "User nginx will run as",
31
+ :default => "www-data"
32
+
33
+ attribute "nginx/binary",
34
+ :display_name => "Nginx Binary",
35
+ :description => "Location of the nginx server binary",
36
+ :default => "/usr/sbin/nginx"
37
+
38
+ attribute "nginx/gzip",
39
+ :display_name => "Nginx Gzip",
40
+ :description => "Whether gzip is enabled",
41
+ :default => "on"
42
+
43
+ attribute "nginx/gzip_http_version",
44
+ :display_name => "Nginx Gzip HTTP Version",
45
+ :description => "Version of HTTP Gzip",
46
+ :default => "1.0"
47
+
48
+ attribute "nginx/gzip_comp_level",
49
+ :display_name => "Nginx Gzip Compression Level",
50
+ :description => "Amount of compression to use",
51
+ :default => "2"
52
+
53
+ attribute "nginx/gzip_proxied",
54
+ :display_name => "Nginx Gzip Proxied",
55
+ :description => "Whether gzip is proxied",
56
+ :default => "any"
57
+
58
+ attribute "nginx/gzip_types",
59
+ :display_name => "Nginx Gzip Types",
60
+ :description => "Supported MIME-types for gzip",
61
+ :type => "array",
62
+ :default => [ "text/plain", "text/html", "text/css", "application/x-javascript", "text/xml", "application/xml", "application/xml+rss", "text/javascript" ]
63
+
64
+ attribute "nginx/keepalive",
65
+ :display_name => "Nginx Keepalive",
66
+ :description => "Whether to enable keepalive",
67
+ :default => "on"
68
+
69
+ attribute "nginx/keepalive_timeout",
70
+ :display_name => "Nginx Keepalive Timeout",
71
+ :default => "65"
72
+
73
+ attribute "nginx/worker_processes",
74
+ :display_name => "Nginx Worker Processes",
75
+ :description => "Number of worker processes",
76
+ :default => "1"
77
+
78
+ attribute "nginx/worker_connections",
79
+ :display_name => "Nginx Worker Connections",
80
+ :description => "Number of connections per worker",
81
+ :default => "1024"
82
+
83
+ attribute "nginx/server_names_hash_bucket_size",
84
+ :display_name => "Nginx Server Names Hash Bucket Size",
85
+ :default => "64"
86
+
@@ -0,0 +1,56 @@
1
+ #
2
+ # Cookbook Name:: nginx
3
+ # Recipe:: default
4
+ # Author:: AJ Christensen <aj@junglist.gen.nz>
5
+ #
6
+ # Copyright 2008-2009, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ package "nginx"
22
+
23
+ directory node[:nginx][:log_dir] do
24
+ mode 0755
25
+ owner node[:nginx][:user]
26
+ action :create
27
+ end
28
+
29
+ %w{nxensite nxdissite}.each do |nxscript|
30
+ template "/usr/sbin/#{nxscript}" do
31
+ source "#{nxscript}.erb"
32
+ mode 0755
33
+ owner "root"
34
+ group "root"
35
+ end
36
+ end
37
+
38
+ template "nginx.conf" do
39
+ path "#{node[:nginx][:dir]}/nginx.conf"
40
+ source "nginx.conf.erb"
41
+ owner "root"
42
+ group "root"
43
+ mode 0644
44
+ end
45
+
46
+ template "#{node[:nginx][:dir]}/sites-available/default" do
47
+ source "default-site.erb"
48
+ owner "root"
49
+ group "root"
50
+ mode 0644
51
+ end
52
+
53
+ service "nginx" do
54
+ supports :status => true, :restart => true, :reload => true
55
+ action [ :enable, :start ]
56
+ end
@@ -0,0 +1,143 @@
1
+ #
2
+ # Cookbook Name:: nginx
3
+ # Recipe:: source
4
+ #
5
+ # Author:: Adam Jacob (<adam@opscode.com>)
6
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
7
+ #
8
+ # Copyright 2009-2011, Opscode, Inc.
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ #
22
+
23
+ include_recipe "build-essential"
24
+
25
+ unless platform?("centos","redhat","fedora")
26
+ include_recipe "runit"
27
+ end
28
+
29
+ packages = value_for_platform(
30
+ ["centos","redhat","fedora"] => {'default' => ['pcre-devel', 'openssl-devel']},
31
+ "default" => ['libpcre3', 'libpcre3-dev', 'libssl-dev']
32
+ )
33
+
34
+ packages.each do |devpkg|
35
+ package devpkg
36
+ end
37
+
38
+ nginx_version = node[:nginx][:version]
39
+
40
+ node.set[:nginx][:install_path] = "/opt/nginx-#{nginx_version}"
41
+ node.set[:nginx][:src_binary] = "#{node[:nginx][:install_path]}/sbin/nginx"
42
+ node.set[:nginx][:daemon_disable] = true
43
+ node.set[:nginx][:configure_flags] = [
44
+ "--prefix=#{node[:nginx][:install_path]}",
45
+ "--conf-path=#{node[:nginx][:dir]}/nginx.conf",
46
+ "--with-http_ssl_module",
47
+ "--with-http_gzip_static_module"
48
+ ]
49
+
50
+ configure_flags = node[:nginx][:configure_flags].join(" ")
51
+
52
+ remote_file "#{Chef::Config[:file_cache_path]}/nginx-#{nginx_version}.tar.gz" do
53
+ source "http://sysoev.ru/nginx/nginx-#{nginx_version}.tar.gz"
54
+ action :create_if_missing
55
+ end
56
+
57
+ bash "compile_nginx_source" do
58
+ cwd Chef::Config[:file_cache_path]
59
+ code <<-EOH
60
+ tar zxf nginx-#{nginx_version}.tar.gz
61
+ cd nginx-#{nginx_version} && ./configure #{configure_flags}
62
+ make && make install
63
+ EOH
64
+ creates node[:nginx][:src_binary]
65
+ end
66
+
67
+ directory node[:nginx][:log_dir] do
68
+ mode 0755
69
+ owner node[:nginx][:user]
70
+ action :create
71
+ end
72
+
73
+ directory node[:nginx][:dir] do
74
+ owner "root"
75
+ group "root"
76
+ mode "0755"
77
+ end
78
+
79
+ unless platform?("centos","redhat","fedora")
80
+ runit_service "nginx"
81
+
82
+ service "nginx" do
83
+ subscribes :restart, resources(:bash => "compile_nginx_source")
84
+ end
85
+ else
86
+ #install init db script
87
+ template "/etc/init.d/nginx" do
88
+ source "nginx.init.erb"
89
+ owner "root"
90
+ group "root"
91
+ mode "0755"
92
+ end
93
+
94
+ #install sysconfig file (not really needed but standard)
95
+ template "/etc/sysconfig/nginx" do
96
+ source "nginx.sysconfig.erb"
97
+ owner "root"
98
+ group "root"
99
+ mode "0644"
100
+ end
101
+
102
+ #register service
103
+ service "nginx" do
104
+ supports :status => true, :restart => true, :reload => true
105
+ action :enable
106
+ subscribes :restart, resources(:bash => "compile_nginx_source")
107
+ end
108
+ end
109
+
110
+
111
+ %w{ sites-available sites-enabled conf.d }.each do |dir|
112
+ directory "#{node[:nginx][:dir]}/#{dir}" do
113
+ owner "root"
114
+ group "root"
115
+ mode "0755"
116
+ end
117
+ end
118
+
119
+ %w{nxensite nxdissite}.each do |nxscript|
120
+ template "/usr/sbin/#{nxscript}" do
121
+ source "#{nxscript}.erb"
122
+ mode "0755"
123
+ owner "root"
124
+ group "root"
125
+ end
126
+ end
127
+
128
+ template "nginx.conf" do
129
+ path "#{node[:nginx][:dir]}/nginx.conf"
130
+ source "nginx.conf.erb"
131
+ owner "root"
132
+ group "root"
133
+ mode "0644"
134
+ notifies :restart, resources(:service => "nginx"), :immediately
135
+ end
136
+
137
+ cookbook_file "#{node[:nginx][:dir]}/mime.types" do
138
+ source "mime.types"
139
+ owner "root"
140
+ group "root"
141
+ mode "0644"
142
+ notifies :restart, resources(:service => "nginx"), :immediately
143
+ end
@@ -0,0 +1,61 @@
1
+ # Cookbook Name:: openldap
2
+ # Attributes:: openldap
3
+ #
4
+ # Copyright 2008-2009, Opscode, Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ if domain && domain.length > 0
20
+ default[:openldap][:basedn] = "dc=#{domain.split('.').join(",dc=")}"
21
+ default[:openldap][:server] = "ldap.#{domain}"
22
+ end
23
+
24
+ openldap[:rootpw] = nil
25
+
26
+ # File and directory locations for openldap.
27
+ case platform
28
+ when "redhat","centos"
29
+ set[:openldap][:dir] = "/etc/openldap"
30
+ set[:openldap][:run_dir] = "/var/run/openldap"
31
+ set[:openldap][:module_dir] = "/usr/lib64/openldap"
32
+ when "debian","ubuntu"
33
+ set[:openldap][:dir] = "/etc/ldap"
34
+ set[:openldap][:run_dir] = "/var/run/slapd"
35
+ set[:openldap][:module_dir] = "/usr/lib/ldap"
36
+ else
37
+ set[:openldap][:dir] = "/etc/ldap"
38
+ set[:openldap][:run_dir] = "/var/run/slapd"
39
+ set[:openldap][:module_dir] = "/usr/lib/ldap"
40
+ end
41
+
42
+ openldap[:ssl_dir] = "#{openldap[:dir]}/ssl"
43
+ openldap[:cafile] = "#{openldap[:ssl_dir]}/ca.crt"
44
+
45
+ # Server settings.
46
+ openldap[:slapd_type] = nil
47
+
48
+ if openldap[:slapd_type] == "slave"
49
+ master = search(:nodes, 'openldap_slapd_type:master')
50
+ default[:openldap][:slapd_master] = master
51
+ default[:openldap][:slapd_replpw] = nil
52
+ default[:openldap][:slapd_rid] = 102
53
+ end
54
+
55
+ # Auth settings for Apache.
56
+ if openldap[:basedn] && openldap[:server]
57
+ default[:openldap][:auth_type] = "openldap"
58
+ default[:openldap][:auth_binddn] = "ou=people,#{openldap[:basedn]}"
59
+ default[:openldap][:auth_bindpw] = nil
60
+ default[:openldap][:auth_url] = "ldap://#{openldap[:server]}/#{openldap[:auth_binddn]}?uid?sub?(objecctClass=*)"
61
+ end
@@ -0,0 +1,99 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Configures a server to be an OpenLDAP master, replication slave or client for auth"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
6
+ version "0.9.4"
7
+ recipe "openldap", "Empty, use one of the other recipes"
8
+ recipe "openldap::auth", "Set up openldap for user authentication"
9
+ recipe "openldap::client", "Install openldap client packages"
10
+ recipe "openldap::server", "Set up openldap to be a slapd server"
11
+
12
+ %w{ ubuntu debian }.each do |os|
13
+ supports os
14
+ end
15
+
16
+ %w{ openssh nscd }.each do |cb|
17
+ depends cb
18
+ end
19
+
20
+ attribute "openldap/basedn",
21
+ :display_name => "OpenLDAP BaseDN",
22
+ :description => "BaseDN for the LDAP directory",
23
+ :default => "dc=domain,dc=com"
24
+
25
+ attribute "openldap/server",
26
+ :display_name => "OpenLDAP Server",
27
+ :description => "LDAP Server, used for URIs",
28
+ :default => "ldap.domain"
29
+
30
+ attribute "openldap/rootpw",
31
+ :display_name => "OpenLDAP Root Password",
32
+ :description => "Password for 'admin' root user, should be a SHA hash that OpenLDAP supports",
33
+ :default => "nil"
34
+
35
+ attribute "openldap/dir",
36
+ :display_name => "OpenLDAP Dir",
37
+ :description => "Main configuration directory for OpenLDAP",
38
+ :default => "/etc/ldap"
39
+
40
+ attribute "openldap/run_dir",
41
+ :display_name => "OpenLDAP Run Directory",
42
+ :description => "Run directory for LDAP server processes",
43
+ :default => "/var/run/slapd"
44
+
45
+ attribute "openldap/module_dir",
46
+ :display_name => "OpenLDAP Module Directory",
47
+ :description => "Location for OpenLDAP add-on modules",
48
+ :default => "/usr/lib/ldap"
49
+
50
+ attribute "openldap/ssl_dir",
51
+ :display_name => "OpenLDAP SSL Directory",
52
+ :description => "Location for LDAP SSL certificates",
53
+ :default => "openldap_dir/ssl"
54
+
55
+ attribute "openldap/cafile",
56
+ :display_name => "OpenLDAP CA File",
57
+ :description => "Location for CA certificate",
58
+ :default => "openldap_dir_ssl/ca.crt"
59
+
60
+ attribute "openldap/slapd_type",
61
+ :display_name => "OpenLDAP Slapd Type",
62
+ :description => "Whether the server is a master or slave",
63
+ :default => "nil"
64
+
65
+ attribute "openldap/slapd_master",
66
+ :display_name => "OpenLDP Slapd Master",
67
+ :description => "Search nodes for attribute slapd_type master, for slaves",
68
+ :default => "nil"
69
+
70
+ attribute "openldap/slapd_replpw",
71
+ :display_name => "OpenLDAP Slapd Replication Password",
72
+ :description => "Password for slaves to replicate from master",
73
+ :default => "nil"
74
+
75
+ attribute "openldap/slapd_rid",
76
+ :display_name => "OpenLDAP Slapd Replication ID",
77
+ :description => "Slave's ID, must be unique",
78
+ :default => "102"
79
+
80
+ attribute "openldap/auth_type",
81
+ :display_name => "OpenLDAP Auth Type",
82
+ :description => "Used in Apache configs, AuthBasicProvider",
83
+ :default => "openldap"
84
+
85
+ attribute "openldap/auth_binddn",
86
+ :display_name => "OpenLDAP Auth BindDN",
87
+ :description => "Used in auth_url and Apache configs, AuthBindDN",
88
+ :default => "ou=people,openldap_basedn"
89
+
90
+ attribute "openldap/auth_bindpw",
91
+ :display_name => "OpenLDAP Auth Bind Password",
92
+ :description => "Used in Apache configs, AuthBindPassword",
93
+ :default => "nil"
94
+
95
+ attribute "openldap/auth_url",
96
+ :display_name => "OpenLDAP Auth URL",
97
+ :description => "Used in Apache configs, AuthLDAPURL",
98
+ :default => "ldap://openldap_server/openldap_auth_binddn?uid?sub?(objectClass=*)"
99
+