cloud-mu 3.6.10 → 3.6.11

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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -3
  3. data/Berksfile.lock +11 -14
  4. data/bin/mu-aws-setup +16 -4
  5. data/bin/mu-configure +2 -1
  6. data/cloud-mu.gemspec +2 -2
  7. data/cookbooks/mu-firewall/Berksfile +1 -1
  8. data/cookbooks/mu-firewall/attributes/default.rb +2 -2
  9. data/cookbooks/mu-firewall/metadata.rb +3 -3
  10. data/cookbooks/mu-firewall/recipes/default.rb +11 -2
  11. data/cookbooks/mu-master/Berksfile +1 -1
  12. data/cookbooks/mu-master/attributes/default.rb +14 -1
  13. data/cookbooks/mu-master/files/default/389ds-perl/ASDialogs.pm +173 -0
  14. data/cookbooks/mu-master/files/default/389ds-perl/AdminMigration.pm +569 -0
  15. data/cookbooks/mu-master/files/default/389ds-perl/AdminServer.pm +952 -0
  16. data/cookbooks/mu-master/files/default/389ds-perl/AdminUtil.pm +983 -0
  17. data/cookbooks/mu-master/files/default/389ds-perl/ConfigDSDialogs.pm +449 -0
  18. data/cookbooks/mu-master/files/default/389ds-perl/DSCreate.pm +1551 -0
  19. data/cookbooks/mu-master/files/default/389ds-perl/DSDialogs.pm +233 -0
  20. data/cookbooks/mu-master/files/default/389ds-perl/DSMigration.pm +1175 -0
  21. data/cookbooks/mu-master/files/default/389ds-perl/DSUpdate.pm +534 -0
  22. data/cookbooks/mu-master/files/default/389ds-perl/DSUpdateDialogs.pm +152 -0
  23. data/cookbooks/mu-master/files/default/389ds-perl/DSUtil.pm +1710 -0
  24. data/cookbooks/mu-master/files/default/389ds-perl/Dialog.pm +249 -0
  25. data/cookbooks/mu-master/files/default/389ds-perl/DialogManager.pm +212 -0
  26. data/cookbooks/mu-master/files/default/389ds-perl/FileConn.pm +461 -0
  27. data/cookbooks/mu-master/files/default/389ds-perl/Inf.pm +268 -0
  28. data/cookbooks/mu-master/files/default/389ds-perl/Migration.pm +327 -0
  29. data/cookbooks/mu-master/files/default/389ds-perl/RegDSDialogs.pm +94 -0
  30. data/cookbooks/mu-master/files/default/389ds-perl/Resource.pm +137 -0
  31. data/cookbooks/mu-master/files/default/389ds-perl/Setup.pm +240 -0
  32. data/cookbooks/mu-master/files/default/389ds-perl/SetupDialogs.pm +243 -0
  33. data/cookbooks/mu-master/files/default/389ds-perl/SetupLog.pm +82 -0
  34. data/cookbooks/mu-master/files/default/setCertName.ldif +4 -0
  35. data/cookbooks/mu-master/libraries/mu.rb +2 -2
  36. data/cookbooks/mu-master/metadata.rb +1 -1
  37. data/cookbooks/mu-master/recipes/389ds.rb +71 -32
  38. data/cookbooks/mu-master/recipes/basepackages.rb +5 -0
  39. data/cookbooks/mu-master/recipes/default.rb +16 -5
  40. data/cookbooks/mu-master/recipes/init.rb +36 -3
  41. data/cookbooks/mu-master/recipes/ssl-certs.rb +6 -0
  42. data/cookbooks/mu-master/recipes/sssd.rb +85 -62
  43. data/cookbooks/mu-master/recipes/update_nagios_only.rb +7 -1
  44. data/cookbooks/mu-master/templates/default/389-directory-setup.inf.erb +11 -26
  45. data/cookbooks/mu-master/templates/default/sssd.conf.erb +18 -8
  46. data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
  47. data/cookbooks/mu-tools/metadata.rb +0 -1
  48. data/cookbooks/mu-tools/recipes/set_local_fw.rb +7 -1
  49. data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +5 -1
  50. data/cookbooks/nagios/CHANGELOG.md +679 -0
  51. data/cookbooks/nagios/LICENSE +201 -0
  52. data/cookbooks/nagios/README.md +340 -0
  53. data/cookbooks/nagios/attributes/config.rb +163 -0
  54. data/cookbooks/nagios/attributes/default.rb +204 -0
  55. data/cookbooks/nagios/libraries/base.rb +311 -0
  56. data/cookbooks/nagios/libraries/command.rb +68 -0
  57. data/cookbooks/nagios/libraries/contact.rb +229 -0
  58. data/cookbooks/nagios/libraries/contactgroup.rb +111 -0
  59. data/cookbooks/{firewall/recipes/disable_firewall.rb → nagios/libraries/custom_option.rb} +20 -7
  60. data/cookbooks/nagios/libraries/data_bag_helper.rb +23 -0
  61. data/cookbooks/nagios/libraries/default.rb +90 -0
  62. data/cookbooks/nagios/libraries/helpers.rb +229 -0
  63. data/cookbooks/nagios/libraries/host.rb +410 -0
  64. data/cookbooks/nagios/libraries/hostdependency.rb +178 -0
  65. data/cookbooks/nagios/libraries/hostescalation.rb +170 -0
  66. data/cookbooks/nagios/libraries/hostgroup.rb +117 -0
  67. data/cookbooks/nagios/libraries/nagios.rb +277 -0
  68. data/cookbooks/nagios/libraries/resource.rb +59 -0
  69. data/cookbooks/nagios/libraries/service.rb +449 -0
  70. data/cookbooks/nagios/libraries/servicedependency.rb +213 -0
  71. data/cookbooks/nagios/libraries/serviceescalation.rb +193 -0
  72. data/cookbooks/nagios/libraries/servicegroup.rb +142 -0
  73. data/cookbooks/nagios/libraries/timeperiod.rb +159 -0
  74. data/cookbooks/nagios/libraries/users_helper.rb +54 -0
  75. data/cookbooks/nagios/metadata.json +44 -0
  76. data/cookbooks/nagios/metadata.rb +22 -0
  77. data/cookbooks/nagios/recipes/_load_databag_config.rb +153 -0
  78. data/cookbooks/nagios/recipes/_load_default_config.rb +241 -0
  79. data/cookbooks/nagios/recipes/apache.rb +114 -0
  80. data/cookbooks/nagios/recipes/default.rb +41 -0
  81. data/cookbooks/nagios/recipes/nginx.rb +114 -0
  82. data/cookbooks/nagios/recipes/pagerduty.rb +95 -0
  83. data/cookbooks/nagios/recipes/server.rb +182 -0
  84. data/cookbooks/nagios/recipes/server_package.rb +85 -0
  85. data/cookbooks/nagios/recipes/server_source.rb +137 -0
  86. data/cookbooks/nagios/resources/command.rb +34 -0
  87. data/cookbooks/nagios/resources/conf.rb +52 -0
  88. data/cookbooks/nagios/resources/contact.rb +34 -0
  89. data/cookbooks/nagios/resources/contactgroup.rb +35 -0
  90. data/cookbooks/nagios/resources/host.rb +35 -0
  91. data/cookbooks/nagios/resources/hostdependency.rb +35 -0
  92. data/cookbooks/nagios/resources/hostescalation.rb +36 -0
  93. data/cookbooks/nagios/resources/hostgroup.rb +35 -0
  94. data/cookbooks/nagios/resources/resource.rb +34 -0
  95. data/cookbooks/nagios/resources/service.rb +35 -0
  96. data/cookbooks/nagios/resources/servicedependency.rb +35 -0
  97. data/cookbooks/nagios/resources/serviceescalation.rb +35 -0
  98. data/cookbooks/nagios/resources/servicegroup.rb +35 -0
  99. data/cookbooks/nagios/resources/timeperiod.rb +35 -0
  100. data/cookbooks/nagios/templates/apache2.conf.erb +102 -0
  101. data/cookbooks/nagios/templates/cgi.cfg.erb +266 -0
  102. data/cookbooks/nagios/templates/commands.cfg.erb +13 -0
  103. data/cookbooks/nagios/templates/contacts.cfg.erb +37 -0
  104. data/cookbooks/nagios/templates/hostgroups.cfg.erb +25 -0
  105. data/cookbooks/nagios/templates/hosts.cfg.erb +15 -0
  106. data/cookbooks/nagios/templates/htpasswd.users.erb +6 -0
  107. data/cookbooks/nagios/templates/nagios.cfg.erb +22 -0
  108. data/cookbooks/nagios/templates/nginx.conf.erb +80 -0
  109. data/cookbooks/nagios/templates/pagerduty.cgi.erb +185 -0
  110. data/cookbooks/nagios/templates/resource.cfg.erb +27 -0
  111. data/cookbooks/nagios/templates/servicedependencies.cfg.erb +15 -0
  112. data/cookbooks/nagios/templates/servicegroups.cfg.erb +14 -0
  113. data/cookbooks/nagios/templates/services.cfg.erb +14 -0
  114. data/cookbooks/nagios/templates/spawn-fcgi.erb +10 -0
  115. data/cookbooks/nagios/templates/templates.cfg.erb +31 -0
  116. data/cookbooks/nagios/templates/timeperiods.cfg.erb +13 -0
  117. data/extras/platform_berksfile_base +3 -3
  118. data/extras/python_rpm/build.sh +4 -4
  119. data/extras/python_rpm/muthon.spec +2 -4
  120. data/extras/vault_tools/export_vaults.sh +11 -1
  121. data/install/installer +1 -1
  122. data/modules/mu/kittens.rb +27523 -0
  123. data/modules/mu/master/ldap.rb +48 -31
  124. data/modules/mu/master.rb +69 -0
  125. data/modules/mu/mu.yaml.rb +351 -0
  126. data/modules/mu/providers/aws/firewall_rule.rb +3 -1
  127. data/modules/mu/providers/aws.rb +11 -5
  128. data/modules/mu.rb +5 -4
  129. metadata +99 -48
  130. data/cookbooks/firewall/CHANGELOG.md +0 -488
  131. data/cookbooks/firewall/LICENSE +0 -202
  132. data/cookbooks/firewall/README.md +0 -366
  133. data/cookbooks/firewall/TODO.md +0 -6
  134. data/cookbooks/firewall/attributes/default.rb +0 -5
  135. data/cookbooks/firewall/attributes/firewalld.rb +0 -8
  136. data/cookbooks/firewall/attributes/iptables.rb +0 -17
  137. data/cookbooks/firewall/attributes/ufw.rb +0 -12
  138. data/cookbooks/firewall/attributes/windows.rb +0 -8
  139. data/cookbooks/firewall/libraries/helpers.rb +0 -105
  140. data/cookbooks/firewall/libraries/helpers_firewalld.rb +0 -116
  141. data/cookbooks/firewall/libraries/helpers_firewalld_dbus.rb +0 -72
  142. data/cookbooks/firewall/libraries/helpers_iptables.rb +0 -112
  143. data/cookbooks/firewall/libraries/helpers_nftables.rb +0 -170
  144. data/cookbooks/firewall/libraries/helpers_ufw.rb +0 -142
  145. data/cookbooks/firewall/libraries/helpers_windows.rb +0 -129
  146. data/cookbooks/firewall/libraries/provider_firewall_firewalld.rb +0 -179
  147. data/cookbooks/firewall/libraries/provider_firewall_iptables.rb +0 -171
  148. data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu.rb +0 -200
  149. data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu1404.rb +0 -200
  150. data/cookbooks/firewall/libraries/provider_firewall_rule.rb +0 -34
  151. data/cookbooks/firewall/libraries/provider_firewall_ufw.rb +0 -138
  152. data/cookbooks/firewall/libraries/provider_firewall_windows.rb +0 -126
  153. data/cookbooks/firewall/libraries/resource_firewall.rb +0 -26
  154. data/cookbooks/firewall/libraries/resource_firewall_rule.rb +0 -52
  155. data/cookbooks/firewall/metadata.json +0 -40
  156. data/cookbooks/firewall/metadata.rb +0 -15
  157. data/cookbooks/firewall/recipes/default.rb +0 -76
  158. data/cookbooks/firewall/recipes/firewalld.rb +0 -87
  159. data/cookbooks/firewall/resources/firewalld.rb +0 -28
  160. data/cookbooks/firewall/resources/firewalld_config.rb +0 -39
  161. data/cookbooks/firewall/resources/firewalld_helpers.rb +0 -106
  162. data/cookbooks/firewall/resources/firewalld_icmptype.rb +0 -88
  163. data/cookbooks/firewall/resources/firewalld_ipset.rb +0 -104
  164. data/cookbooks/firewall/resources/firewalld_policy.rb +0 -115
  165. data/cookbooks/firewall/resources/firewalld_service.rb +0 -98
  166. data/cookbooks/firewall/resources/firewalld_zone.rb +0 -118
  167. data/cookbooks/firewall/resources/nftables.rb +0 -71
  168. data/cookbooks/firewall/resources/nftables_rule.rb +0 -113
  169. data/cookbooks/firewall/templates/default/ufw/default.erb +0 -13
  170. /data/cookbooks/{firewall → nagios}/chefignore +0 -0
  171. /data/cookbooks/{firewall → nagios}/renovate.json +0 -0
@@ -0,0 +1,327 @@
1
+ # BEGIN COPYRIGHT BLOCK
2
+ # Copyright (C) 2007 Red Hat, Inc.
3
+ # All rights reserved.
4
+ #
5
+ # License: GPL (version 3 or any later version).
6
+ # See LICENSE for details.
7
+ # END COPYRIGHT BLOCK
8
+ #
9
+
10
+ ###########################
11
+ #
12
+ # This perl module provides a way to set up a new installation after
13
+ # the binaries have already been extracted. This is typically after
14
+ # using native packaging support to install the package e.g. RPM,
15
+ # pkgadd, depot, etc. This script will show the license, readme,
16
+ # dsktune, then run the usual setup pre and post installers.
17
+ #
18
+ ##########################
19
+
20
+ package Migration;
21
+ use Setup;
22
+
23
+ use Exporter ();
24
+ @ISA = qw(Exporter Setup);
25
+ @EXPORT = qw();
26
+ @EXPORT_OK = qw();
27
+
28
+ # hostname
29
+ use Sys::Hostname;
30
+
31
+ # load perldap
32
+ use Mozilla::LDAP::Conn;
33
+ use Mozilla::LDAP::Utils qw(normalizeDN);
34
+ use Mozilla::LDAP::API qw(ldap_explode_dn);
35
+ use Mozilla::LDAP::LDIF;
36
+
37
+ use Getopt::Long;
38
+
39
+ use SetupLog;
40
+ use DSUtil;
41
+
42
+ # process command line options
43
+ Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd
44
+
45
+ sub VersionMessage {
46
+ print "389 Directory Server Migration Program Version 1.3.11.12\n";
47
+ }
48
+
49
+ sub HelpMessage {
50
+ print <<EOF;
51
+
52
+ INTRODUCTION
53
+
54
+ This script will copy instances (data and configuration) from the old
55
+ server root directory to their new FHS locations. This script does a
56
+ copy only - the data in the old instances will be left untouched. The
57
+ old instances must be shutdown first to ensure that the databases are
58
+ copied safely. During migration your migrated instances will be started.
59
+
60
+ USAGE
61
+
62
+ $0 [--options] -- [args]
63
+
64
+ options:
65
+ --help This message
66
+ --version Print the version and exit
67
+ --debug Turn on debugging
68
+ --oldsroot The old server root directory to migrate from
69
+ --actualsroot This is the old location of the old server root.
70
+ See below.
71
+ --silent Use silent setup - no user input
72
+ --file=name Use the file 'name' in .inf format to supply the
73
+ default answers
74
+ --keepcache Do not delete the temporary .inf file generated by
75
+ this program
76
+ --logfile Log migration messages to this file - otherwise, a temp
77
+ file will be used
78
+ --instance By default, all directory server instances will be
79
+ migrated. You can use this argument to specify one
80
+ or more (e.g. -i slapd-foo -i slapd-bar) if you do
81
+ not want to migrate all of them.
82
+ --cross See below.
83
+
84
+ For all options, you can also use the short name e.g. -h, -d, etc.
85
+ For the -d argument, specifying it more than once will increase the
86
+ debug level e.g. -ddddd
87
+
88
+ args:
89
+ You can supply default .inf data in this format:
90
+ section.param=value
91
+ e.g.
92
+ General.FullMachineName=foo.example.com
93
+ or
94
+ "slapd.Suffix=dc=example,dc=com"
95
+ Values passed in this manner will override values in an .inf file
96
+ given with the -f argument.
97
+
98
+ actualsroot:
99
+ This is used when you must migrate from one machine to another. The
100
+ usual case is that you have mounted the old server root on a different
101
+ root directory, either via a network mount, or by copying a tarball
102
+ made using a relative directory on the source machine to the
103
+ destination machine and untarring it.
104
+
105
+ For example: machineA is a 32bit machine, and you want to migrate your
106
+ servers to a new 64bit machine. Lets assume your old server root on
107
+ machineA was /opt/myds, and your new machine also wants to use a
108
+ server root of /opt/myds. There are a couple of different ways to
109
+ proceed. Either make a tarball of opt/myds from machineA using a
110
+ relative path (i.e. NOT /opt/myds) or use NFS to mount
111
+ machineA:/opt/myds on a different mount point
112
+ (e.g. machineB:/migration/opt/myds).
113
+
114
+ If you do this, you should give the old "real" server root (/opt/myds)
115
+ as the --actualsroot argument, and use /migration/opt/myds for the
116
+ --oldsroot argument. That is, the oldsroot is the physical location of
117
+ the files on disk. The actualsroot is the old value of the server root
118
+ on the source machine.
119
+
120
+ cross:
121
+ Also known as crossplatform, or 'c', or 'x'.
122
+ This is when the source machine is a different architecture than the
123
+ destination machine. In this case, only certain data will be available
124
+ for migration. Changelog information will not be migrated, and replicas
125
+ will need to be reinitialized (if migrating masters or hubs). This type
126
+ of migration requires that all of your old databases have been dumped
127
+ to LDIF format, and the LDIF file must be in the default database directory
128
+ (usually /opt/389-ds/slapd-instance/db), and the LDIF file must have
129
+ the same name as the database instance directory, with a ".ldif". For
130
+ example, if you have
131
+ /opt/389-ds/slapd-instance/db/userRoot/ and
132
+ /opt/389-ds/slapd-instance/db/NetscapeRoot/
133
+ you must first use db2ldif to export these databases to LDIF e.g.
134
+ cd /opt/389-ds/slapd-instance
135
+ ./db2ldif -n userRoot -a /opt/389-ds/slapd-instance/db/userRoot.ldif and
136
+ ./db2ldif -n NetscapeRoot -a /opt/389-ds/slapd-instance/db/NetscapeRoot.ldif
137
+
138
+ Then you must somehow make your old server root directory available on
139
+ the destination machine, either by creating a tar archive on the source
140
+ and copying it to the destination, or by network mounting the source
141
+ directory on the destination machine.
142
+ EOF
143
+ }
144
+
145
+ sub init {
146
+ my $self = shift;
147
+ $self->{res} = shift;
148
+ my ($silent, $inffile, $keep, $preonly, $logfile, $oldsroot, $actualsroot, $crossplatform);
149
+ my @instances;
150
+
151
+ GetOptions('help|h|?' => sub { VersionMessage(); HelpMessage(); exit 0 },
152
+ 'version|v' => sub { VersionMessage(); exit 0 },
153
+ 'debug|d+' => \$DSUtil::debuglevel,
154
+ 'silent|s' => \$silent,
155
+ 'file|f=s' => \$inffile,
156
+ 'keepcache|k' => \$keep,
157
+ 'preonly|p' => \$preonly,
158
+ 'logfile|l=s' => \$logfile,
159
+ 'oldsroot|o=s' => \$oldsroot,
160
+ 'actualsroot|a=s' => \$actualsroot,
161
+ 'crossplatform|cross|c|x' => \$crossplatform,
162
+ 'instance|i=s' => \@instances
163
+ );
164
+
165
+ my $pkgname = "dirsrv";
166
+ # this is the new pkgname which may be something like
167
+ # 389-ds-base - we have to strip off the -suffix
168
+ if ($pkgname =~ /-(core|base)$/) {
169
+ $pkgname =~ s/-(core|base)$//;
170
+ }
171
+ my $oldpkgname = "389-ds";
172
+
173
+ $self->{pkgname} = $pkgname;
174
+ $oldsroot =~ s/\/+$//; # trim trailing '/'s, if any
175
+ $self->{oldsroot} = $oldsroot || "/opt/$oldpkgname";
176
+ $actualsroot =~ s/\/+$//; # trim trailing '/'s, if any
177
+ $self->{actualsroot} = $actualsroot || $self->{oldsroot};
178
+ $self->{silent} = $silent;
179
+ $self->{keep} = $keep;
180
+ $self->{preonly} = $preonly;
181
+ $self->{logfile} = $logfile;
182
+ $self->{crossplatform} = $crossplatform;
183
+ $self->{log} = new SetupLog($self->{logfile}, "migrate");
184
+ DSUtil::setDebugLog($self->{log});
185
+ $self->{start_servers} = 1; # start servers as soon as they are migrated
186
+ # if user supplied inf file, use that to initialize
187
+ if (defined($inffile)) {
188
+ $self->{inf} = new Inf($inffile);
189
+ } else {
190
+ $self->{inf} = new Inf;
191
+ }
192
+
193
+ # see if user passed in default inf values - also, command line
194
+ # arguments override those passed in via an inf file - this
195
+ # allows the reuse of .inf files with some parameters overridden
196
+ if (!$self->{inf}->updateFromArgs(@ARGV)) {
197
+ HelpMessage();
198
+ exit 1;
199
+ }
200
+
201
+ # this is the base config directory - the directory containing
202
+ # the slapd-instance instance specific config directories
203
+ $self->{configdir} = $ENV{DS_CONFIG_DIR} || "/etc/dirsrv";
204
+
205
+ # get list of instances to migrate
206
+ if (! @instances) {
207
+ # an instance must be a directory called $oldsroot/slapd-something and the file
208
+ # $oldsroot/slapd-something/config/dse.ldif must exist
209
+ @instances = grep { -d && -f "$_/config/dse.ldif" && ($_ =~ s,$self->{oldsroot}/,,) }
210
+ glob("$self->{oldsroot}/slapd-*");
211
+ }
212
+
213
+ if (!@instances) {
214
+ $self->msg($FATAL, "error_no_instances", $self->{oldsroot});
215
+ VersionMessage();
216
+ HelpMessage();
217
+ exit 1;
218
+ }
219
+
220
+ $self->{instances} = \@instances;
221
+ }
222
+
223
+ # log only goes the the logfile
224
+ sub log {
225
+ my $self = shift;
226
+ my $level = shift;
227
+ $self->{log}->logMessage($level, "Migration", @_);
228
+ }
229
+
230
+ sub doExit {
231
+ my $self = shift;
232
+ my $code = shift;
233
+ if (!defined($code)) {
234
+ $code = 1;
235
+ }
236
+
237
+ if ($code) {
238
+ $self->msg($FATAL, 'migration_exiting', $self->{log}->{filename});
239
+ } else {
240
+ $self->msg($SUCCESS, 'migration_exiting', $self->{log}->{filename});
241
+ }
242
+ exit $code;
243
+ }
244
+
245
+ sub migrateSecurityFiles {
246
+ my $self = shift;
247
+ my $inst = shift;
248
+ my $destdir = shift;
249
+ my $oldroot = $self->{oldsroot};
250
+
251
+ if (! -d "$oldroot/alias") {
252
+ $self->msg('old_secdir_error', "$oldroot/alias", $!);
253
+ return 0;
254
+ } elsif (! -d $destdir) {
255
+ $self->msg('new_secdir_error', $destdir, $!);
256
+ return 0;
257
+ } else {
258
+ if (-f "$oldroot/alias/$inst-cert8.db") {
259
+ $self->log($INFO, "Copying $oldroot/alias/$inst-cert8.db to $destdir/cert8.db\n");
260
+ if (system ("cp -p $oldroot/alias/$inst-cert8.db $destdir/cert8.db")) {
261
+ $self->msg($FATAL, 'error_copying_certdb', "$oldroot/alias/$inst-cert8.db",
262
+ "$destdir/cert8.db", $!);
263
+ return 0;
264
+ }
265
+ } else {
266
+ $self->log($DEBUG, "No file to migrate: $oldroot/alias/$inst-cert8.db\n");
267
+ }
268
+
269
+ if (-f "$oldroot/alias/$inst-key3.db") {
270
+ $self->log($INFO, "Copying $oldroot/alias/$inst-key3.db to $destdir/key3.db\n");
271
+ if (system ("cp -p $oldroot/alias/$inst-key3.db $destdir/key3.db")) {
272
+ $self->msg($FATAL, 'error_copying_keydb', "$oldroot/alias/$inst-key3.db",
273
+ "$destdir/key3.db", $!);
274
+ return 0;
275
+ }
276
+ } else {
277
+ $self->log($DEBUG, "No file to migrate: $oldroot/alias/$inst-key3.db\n");
278
+ }
279
+
280
+ if (-f "$oldroot/alias/secmod.db") {
281
+ $self->log($INFO, "Copying $oldroot/alias/secmod.db to $destdir/secmod.db\n");
282
+ if (system ("cp -p $oldroot/alias/secmod.db $destdir/secmod.db")) {
283
+ $self->msg($FATAL, 'error_copying_secmoddb', "$oldroot/alias/secmod.db",
284
+ "$destdir/secmod.db", $!);
285
+ return 0;
286
+ }
287
+ } else {
288
+ $self->log($DEBUG, "No file to migrate: $oldroot/alias/secmod.db\n");
289
+ }
290
+
291
+ if (-f "$oldroot/alias/$inst-pin.txt") {
292
+ $self->log($INFO, "Copying $oldroot/alias/$inst-pin.txt to $destdir/pin.txt\n");
293
+ if (system ("cp -p $oldroot/alias/$inst-pin.txt $destdir/pin.txt")) {
294
+ $self->msg($FATAL, 'error_copying_pinfile', "$oldroot/alias/$inst-pin.txt",
295
+ "$destdir/pin.txt", $!);
296
+ return 0;
297
+ }
298
+ } else {
299
+ $self->log($INFO, "No $oldroot/alias/$inst-pin.txt to migrate\n");
300
+ }
301
+
302
+ if (-f "$oldroot/shared/config/certmap.conf") {
303
+ $self->log($INFO, "Copying $oldroot/shared/config/certmap.conf to $destdir/certmap.conf\n");
304
+ if (system ("cp -p $oldroot/shared/config/certmap.conf $destdir/certmap.conf")) {
305
+ $self->msg($FATAL, 'error_copying_certmap', "$oldroot/shared/config/certmap.conf",
306
+ "$destdir/certmap.conf", $!);
307
+ return 0;
308
+ }
309
+ } else {
310
+ $self->log($INFO, "No $oldroot/shared/config/certmap.conf to migrate\n");
311
+ }
312
+ }
313
+
314
+ return 1;
315
+ }
316
+
317
+ #############################################################################
318
+ # Mandatory TRUE return value.
319
+ #
320
+ 1;
321
+
322
+ # emacs settings
323
+ # Local Variables:
324
+ # mode:perl
325
+ # indent-tabs-mode: nil
326
+ # tab-width: 4
327
+ # End:
@@ -0,0 +1,94 @@
1
+ # BEGIN COPYRIGHT BLOCK
2
+ # This Program is free software; you can redistribute it and/or modify it under
3
+ # the terms of the GNU General Public License as published by the Free Software
4
+ # Foundation; version 2 of the License.
5
+ #
6
+ # This Program is distributed in the hope that it will be useful, but WITHOUT
7
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8
+ # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ #
10
+ # You should have received a copy of the GNU General Public License along with
11
+ # this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
12
+ # Place, Suite 330, Boston, MA 02111-1307 USA.
13
+ #
14
+ # In addition, as a special exception, Red Hat, Inc. gives You the additional
15
+ # right to link the code of this Program with code not covered under the GNU
16
+ # General Public License ("Non-GPL Code") and to distribute linked combinations
17
+ # including the two, subject to the limitations in this paragraph. Non-GPL Code
18
+ # permitted under this exception must only link to the code of this Program
19
+ # through those well defined interfaces identified in the file named EXCEPTION
20
+ # found in the source code files (the "Approved Interfaces"). The files of
21
+ # Non-GPL Code may instantiate templates or use macros or inline functions from
22
+ # the Approved Interfaces without causing the resulting work to be covered by
23
+ # the GNU General Public License. Only Red Hat, Inc. may make changes or
24
+ # additions to the list of Approved Interfaces. You must obey the GNU General
25
+ # Public License in all respects for all of the Program code and other code used
26
+ # in conjunction with the Program except the Non-GPL Code covered by this
27
+ # exception. If you modify this file, you may extend this exception to your
28
+ # version of the file, but you are not obligated to do so. If you do not wish to
29
+ # provide this exception without modification, you must delete this exception
30
+ # statement from your version and license this file solely under the GPL without
31
+ # exception.
32
+ #
33
+ #
34
+ # Copyright (C) 2007 Red Hat, Inc.
35
+ # All rights reserved.
36
+ # END COPYRIGHT BLOCK
37
+ #
38
+
39
+ package RegDSDialogs;
40
+
41
+ use strict;
42
+
43
+ use DialogManager;
44
+ use Setup;
45
+ use Dialog;
46
+ use DSUtil;
47
+
48
+ my $configdsinfo = new Dialog (
49
+ $TYPICAL,
50
+ 'use_existing_configds_txt',
51
+ sub {
52
+ my $self = shift;
53
+ my $servid = $self->{manager}->{inf}->{slapd}->{ServerIdentifier};
54
+ return $servid;
55
+ },
56
+ sub {
57
+ my $self = shift;
58
+ my $ans = shift;
59
+ my $index = shift;
60
+ my $res = $DialogManager::SAME;
61
+ my %instances = %{$self->{manager}->{inf}->{slapd}->{Instances}};
62
+ $self->{manager}->setType($TYPICAL);
63
+ if ($index == 0) {
64
+ # validate serverIdentifier?
65
+ foreach my $confdir ( keys %instances )
66
+ {
67
+ foreach my $inst ( @{$instances{$confdir}} )
68
+ {
69
+ if ( "$inst" eq "slapd-" . $ans )
70
+ {
71
+ $self->{manager}->{inf}->{slapd}->{ServerIdentifier} = $ans;
72
+ $self->{manager}->{inf}->{slapd}->{config_dir} = $confdir;
73
+ $res = $DialogManager::NEXT;
74
+ goto out;
75
+ }
76
+ }
77
+ }
78
+ out:
79
+ if ( $DialogManager::SAME == $res )
80
+ {
81
+ $self->{manager}->alert("error_configds_txt", $ans);
82
+ }
83
+ return $res;
84
+ }
85
+ return $res;
86
+ },
87
+ ['dialog_dsserverid_prompt']
88
+ );
89
+
90
+ sub getDialogs {
91
+ return ($configdsinfo);
92
+ }
93
+
94
+ 1;
@@ -0,0 +1,137 @@
1
+ # BEGIN COPYRIGHT BLOCK
2
+ # Copyright (C) 2007 Red Hat, Inc.
3
+ # All rights reserved.
4
+ #
5
+ # License: GPL (version 3 or any later version).
6
+ # See LICENSE for details.
7
+ # END COPYRIGHT BLOCK
8
+ #
9
+
10
+ # manages resource bundle files - gets values
11
+ # given keys
12
+
13
+ package Resource;
14
+
15
+ use strict;
16
+
17
+ #require Exporter;
18
+ #@ISA = qw(Exporter);
19
+ #@EXPORT = qw();
20
+
21
+ sub new {
22
+ my $type = shift;
23
+ my $self = {};
24
+
25
+ while (@_) {
26
+ push @{$self->{filenames}}, shift;
27
+ }
28
+
29
+ $self = bless $self, $type;
30
+
31
+ if (@{$self->{filenames}}) {
32
+ $self->read();
33
+ }
34
+
35
+ return $self;
36
+ }
37
+
38
+ # the resource files are read in order given. Definitions from
39
+ # later files override the same definitions in earlier files.
40
+ sub read {
41
+ my $self = shift;
42
+
43
+ while (@_) {
44
+ push @{$self->{filenames}}, shift;
45
+ }
46
+
47
+ for my $filename (@{$self->{filenames}}) {
48
+ my $incontinuation = 0;
49
+ my $curkey;
50
+ open RES, $filename or die "Error: could not open resource file $filename: $!";
51
+ my $line;
52
+ while ($line = <RES>) {
53
+ my $iscontinuation;
54
+ chop $line; # trim trailing newline
55
+ if ($line =~ /^\s*$/) { # skip blank/empty lines
56
+ $incontinuation = 0;
57
+ next;
58
+ }
59
+ if ($line =~ /^\s*\#/) { # skip comment lines
60
+ $incontinuation = 0;
61
+ next;
62
+ }
63
+ # read name = value pairs like this
64
+ # bol whitespace* name whitespace* '=' whitespace* value eol
65
+ # the value will include any trailing whitespace
66
+ if ($line =~ /\\$/) {
67
+ chop $line;
68
+ $iscontinuation = 1;
69
+ }
70
+ if ($incontinuation) {
71
+ $self->{res}->{$curkey} .= "\n" . $line;
72
+ } elsif ($line =~ /^\s*(.*?)\s*=\s*(.*?)$/) {
73
+ # replace \n with real newline
74
+ if ($curkey) {
75
+ $self->{res}->{$curkey} =~ s/\\n/\n/g;
76
+ }
77
+ $curkey = $1;
78
+ $self->{res}->{$curkey} = $2;
79
+ }
80
+ if ($iscontinuation) { # if line ends with a backslash, continue the data on the next line
81
+ $incontinuation = 1;
82
+ } else {
83
+ $incontinuation = 0;
84
+ }
85
+ }
86
+ # replace \n with real newline
87
+ if (defined($curkey)) {
88
+ $self->{res}->{$curkey} =~ s/\\n/\n/g;
89
+ }
90
+ close RES;
91
+ }
92
+ }
93
+
94
+ # given a resource key and optional args, return the value
95
+ # $text = $res->getText('key');
96
+ # or
97
+ # $text = $res->getText('key', @args);
98
+ # or
99
+ # $text = $res->getText($arrayref)
100
+ # where $arrayref is ['key', @args]
101
+ sub getText {
102
+ my $self = shift;
103
+ my $key = shift;
104
+ my @args = @_;
105
+
106
+ if (ref($key) eq 'ARRAY') {
107
+ my $tmpkey = shift @{$key};
108
+ @args = @{$key};
109
+ $key = $tmpkey;
110
+ }
111
+
112
+ if (!exists($self->{res}->{$key})) {
113
+ print "Error: unknown resource key $key\n";
114
+ return undef;
115
+ }
116
+
117
+ if (!defined($self->{res}->{$key})) {
118
+ print "Error: resource key $key has no value\n";
119
+ return undef;
120
+ }
121
+
122
+ # see if the args themselves are resource keys
123
+ for (my $ii = 0; $ii < @args; ++$ii) {
124
+ if (exists($self->{res}->{$args[$ii]})) {
125
+ $args[$ii] = $self->{res}->{$args[$ii]};
126
+ }
127
+ }
128
+
129
+ my $text = sprintf $self->{res}->{$key}, @args;
130
+
131
+ return $text;
132
+ }
133
+
134
+ #############################################################################
135
+ # Mandatory TRUE return value.
136
+ #
137
+ 1;