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.
- checksums.yaml +4 -4
- data/Berksfile +2 -3
- data/Berksfile.lock +11 -14
- data/bin/mu-aws-setup +16 -4
- data/bin/mu-configure +2 -1
- data/cloud-mu.gemspec +2 -2
- data/cookbooks/mu-firewall/Berksfile +1 -1
- data/cookbooks/mu-firewall/attributes/default.rb +2 -2
- data/cookbooks/mu-firewall/metadata.rb +3 -3
- data/cookbooks/mu-firewall/recipes/default.rb +11 -2
- data/cookbooks/mu-master/Berksfile +1 -1
- data/cookbooks/mu-master/attributes/default.rb +14 -1
- data/cookbooks/mu-master/files/default/389ds-perl/ASDialogs.pm +173 -0
- data/cookbooks/mu-master/files/default/389ds-perl/AdminMigration.pm +569 -0
- data/cookbooks/mu-master/files/default/389ds-perl/AdminServer.pm +952 -0
- data/cookbooks/mu-master/files/default/389ds-perl/AdminUtil.pm +983 -0
- data/cookbooks/mu-master/files/default/389ds-perl/ConfigDSDialogs.pm +449 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DSCreate.pm +1551 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DSDialogs.pm +233 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DSMigration.pm +1175 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DSUpdate.pm +534 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DSUpdateDialogs.pm +152 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DSUtil.pm +1710 -0
- data/cookbooks/mu-master/files/default/389ds-perl/Dialog.pm +249 -0
- data/cookbooks/mu-master/files/default/389ds-perl/DialogManager.pm +212 -0
- data/cookbooks/mu-master/files/default/389ds-perl/FileConn.pm +461 -0
- data/cookbooks/mu-master/files/default/389ds-perl/Inf.pm +268 -0
- data/cookbooks/mu-master/files/default/389ds-perl/Migration.pm +327 -0
- data/cookbooks/mu-master/files/default/389ds-perl/RegDSDialogs.pm +94 -0
- data/cookbooks/mu-master/files/default/389ds-perl/Resource.pm +137 -0
- data/cookbooks/mu-master/files/default/389ds-perl/Setup.pm +240 -0
- data/cookbooks/mu-master/files/default/389ds-perl/SetupDialogs.pm +243 -0
- data/cookbooks/mu-master/files/default/389ds-perl/SetupLog.pm +82 -0
- data/cookbooks/mu-master/files/default/setCertName.ldif +4 -0
- data/cookbooks/mu-master/libraries/mu.rb +2 -2
- data/cookbooks/mu-master/metadata.rb +1 -1
- data/cookbooks/mu-master/recipes/389ds.rb +71 -32
- data/cookbooks/mu-master/recipes/basepackages.rb +5 -0
- data/cookbooks/mu-master/recipes/default.rb +16 -5
- data/cookbooks/mu-master/recipes/init.rb +36 -3
- data/cookbooks/mu-master/recipes/ssl-certs.rb +6 -0
- data/cookbooks/mu-master/recipes/sssd.rb +85 -62
- data/cookbooks/mu-master/recipes/update_nagios_only.rb +7 -1
- data/cookbooks/mu-master/templates/default/389-directory-setup.inf.erb +11 -26
- data/cookbooks/mu-master/templates/default/sssd.conf.erb +18 -8
- data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
- data/cookbooks/mu-tools/metadata.rb +0 -1
- data/cookbooks/mu-tools/recipes/set_local_fw.rb +7 -1
- data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +5 -1
- data/cookbooks/nagios/CHANGELOG.md +679 -0
- data/cookbooks/nagios/LICENSE +201 -0
- data/cookbooks/nagios/README.md +340 -0
- data/cookbooks/nagios/attributes/config.rb +163 -0
- data/cookbooks/nagios/attributes/default.rb +204 -0
- data/cookbooks/nagios/libraries/base.rb +311 -0
- data/cookbooks/nagios/libraries/command.rb +68 -0
- data/cookbooks/nagios/libraries/contact.rb +229 -0
- data/cookbooks/nagios/libraries/contactgroup.rb +111 -0
- data/cookbooks/{firewall/recipes/disable_firewall.rb → nagios/libraries/custom_option.rb} +20 -7
- data/cookbooks/nagios/libraries/data_bag_helper.rb +23 -0
- data/cookbooks/nagios/libraries/default.rb +90 -0
- data/cookbooks/nagios/libraries/helpers.rb +229 -0
- data/cookbooks/nagios/libraries/host.rb +410 -0
- data/cookbooks/nagios/libraries/hostdependency.rb +178 -0
- data/cookbooks/nagios/libraries/hostescalation.rb +170 -0
- data/cookbooks/nagios/libraries/hostgroup.rb +117 -0
- data/cookbooks/nagios/libraries/nagios.rb +277 -0
- data/cookbooks/nagios/libraries/resource.rb +59 -0
- data/cookbooks/nagios/libraries/service.rb +449 -0
- data/cookbooks/nagios/libraries/servicedependency.rb +213 -0
- data/cookbooks/nagios/libraries/serviceescalation.rb +193 -0
- data/cookbooks/nagios/libraries/servicegroup.rb +142 -0
- data/cookbooks/nagios/libraries/timeperiod.rb +159 -0
- data/cookbooks/nagios/libraries/users_helper.rb +54 -0
- data/cookbooks/nagios/metadata.json +44 -0
- data/cookbooks/nagios/metadata.rb +22 -0
- data/cookbooks/nagios/recipes/_load_databag_config.rb +153 -0
- data/cookbooks/nagios/recipes/_load_default_config.rb +241 -0
- data/cookbooks/nagios/recipes/apache.rb +114 -0
- data/cookbooks/nagios/recipes/default.rb +41 -0
- data/cookbooks/nagios/recipes/nginx.rb +114 -0
- data/cookbooks/nagios/recipes/pagerduty.rb +95 -0
- data/cookbooks/nagios/recipes/server.rb +182 -0
- data/cookbooks/nagios/recipes/server_package.rb +85 -0
- data/cookbooks/nagios/recipes/server_source.rb +137 -0
- data/cookbooks/nagios/resources/command.rb +34 -0
- data/cookbooks/nagios/resources/conf.rb +52 -0
- data/cookbooks/nagios/resources/contact.rb +34 -0
- data/cookbooks/nagios/resources/contactgroup.rb +35 -0
- data/cookbooks/nagios/resources/host.rb +35 -0
- data/cookbooks/nagios/resources/hostdependency.rb +35 -0
- data/cookbooks/nagios/resources/hostescalation.rb +36 -0
- data/cookbooks/nagios/resources/hostgroup.rb +35 -0
- data/cookbooks/nagios/resources/resource.rb +34 -0
- data/cookbooks/nagios/resources/service.rb +35 -0
- data/cookbooks/nagios/resources/servicedependency.rb +35 -0
- data/cookbooks/nagios/resources/serviceescalation.rb +35 -0
- data/cookbooks/nagios/resources/servicegroup.rb +35 -0
- data/cookbooks/nagios/resources/timeperiod.rb +35 -0
- data/cookbooks/nagios/templates/apache2.conf.erb +102 -0
- data/cookbooks/nagios/templates/cgi.cfg.erb +266 -0
- data/cookbooks/nagios/templates/commands.cfg.erb +13 -0
- data/cookbooks/nagios/templates/contacts.cfg.erb +37 -0
- data/cookbooks/nagios/templates/hostgroups.cfg.erb +25 -0
- data/cookbooks/nagios/templates/hosts.cfg.erb +15 -0
- data/cookbooks/nagios/templates/htpasswd.users.erb +6 -0
- data/cookbooks/nagios/templates/nagios.cfg.erb +22 -0
- data/cookbooks/nagios/templates/nginx.conf.erb +80 -0
- data/cookbooks/nagios/templates/pagerduty.cgi.erb +185 -0
- data/cookbooks/nagios/templates/resource.cfg.erb +27 -0
- data/cookbooks/nagios/templates/servicedependencies.cfg.erb +15 -0
- data/cookbooks/nagios/templates/servicegroups.cfg.erb +14 -0
- data/cookbooks/nagios/templates/services.cfg.erb +14 -0
- data/cookbooks/nagios/templates/spawn-fcgi.erb +10 -0
- data/cookbooks/nagios/templates/templates.cfg.erb +31 -0
- data/cookbooks/nagios/templates/timeperiods.cfg.erb +13 -0
- data/extras/platform_berksfile_base +3 -3
- data/extras/python_rpm/build.sh +4 -4
- data/extras/python_rpm/muthon.spec +2 -4
- data/extras/vault_tools/export_vaults.sh +11 -1
- data/install/installer +1 -1
- data/modules/mu/kittens.rb +27523 -0
- data/modules/mu/master/ldap.rb +48 -31
- data/modules/mu/master.rb +69 -0
- data/modules/mu/mu.yaml.rb +351 -0
- data/modules/mu/providers/aws/firewall_rule.rb +3 -1
- data/modules/mu/providers/aws.rb +11 -5
- data/modules/mu.rb +5 -4
- metadata +99 -48
- data/cookbooks/firewall/CHANGELOG.md +0 -488
- data/cookbooks/firewall/LICENSE +0 -202
- data/cookbooks/firewall/README.md +0 -366
- data/cookbooks/firewall/TODO.md +0 -6
- data/cookbooks/firewall/attributes/default.rb +0 -5
- data/cookbooks/firewall/attributes/firewalld.rb +0 -8
- data/cookbooks/firewall/attributes/iptables.rb +0 -17
- data/cookbooks/firewall/attributes/ufw.rb +0 -12
- data/cookbooks/firewall/attributes/windows.rb +0 -8
- data/cookbooks/firewall/libraries/helpers.rb +0 -105
- data/cookbooks/firewall/libraries/helpers_firewalld.rb +0 -116
- data/cookbooks/firewall/libraries/helpers_firewalld_dbus.rb +0 -72
- data/cookbooks/firewall/libraries/helpers_iptables.rb +0 -112
- data/cookbooks/firewall/libraries/helpers_nftables.rb +0 -170
- data/cookbooks/firewall/libraries/helpers_ufw.rb +0 -142
- data/cookbooks/firewall/libraries/helpers_windows.rb +0 -129
- data/cookbooks/firewall/libraries/provider_firewall_firewalld.rb +0 -179
- data/cookbooks/firewall/libraries/provider_firewall_iptables.rb +0 -171
- data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu.rb +0 -200
- data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu1404.rb +0 -200
- data/cookbooks/firewall/libraries/provider_firewall_rule.rb +0 -34
- data/cookbooks/firewall/libraries/provider_firewall_ufw.rb +0 -138
- data/cookbooks/firewall/libraries/provider_firewall_windows.rb +0 -126
- data/cookbooks/firewall/libraries/resource_firewall.rb +0 -26
- data/cookbooks/firewall/libraries/resource_firewall_rule.rb +0 -52
- data/cookbooks/firewall/metadata.json +0 -40
- data/cookbooks/firewall/metadata.rb +0 -15
- data/cookbooks/firewall/recipes/default.rb +0 -76
- data/cookbooks/firewall/recipes/firewalld.rb +0 -87
- data/cookbooks/firewall/resources/firewalld.rb +0 -28
- data/cookbooks/firewall/resources/firewalld_config.rb +0 -39
- data/cookbooks/firewall/resources/firewalld_helpers.rb +0 -106
- data/cookbooks/firewall/resources/firewalld_icmptype.rb +0 -88
- data/cookbooks/firewall/resources/firewalld_ipset.rb +0 -104
- data/cookbooks/firewall/resources/firewalld_policy.rb +0 -115
- data/cookbooks/firewall/resources/firewalld_service.rb +0 -98
- data/cookbooks/firewall/resources/firewalld_zone.rb +0 -118
- data/cookbooks/firewall/resources/nftables.rb +0 -71
- data/cookbooks/firewall/resources/nftables_rule.rb +0 -113
- data/cookbooks/firewall/templates/default/ufw/default.erb +0 -13
- /data/cookbooks/{firewall → nagios}/chefignore +0 -0
- /data/cookbooks/{firewall → nagios}/renovate.json +0 -0
@@ -0,0 +1,569 @@
|
|
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
|
+
# Copyright (C) 2007 Red Hat, Inc.
|
15
|
+
# All rights reserved.
|
16
|
+
# END COPYRIGHT BLOCK
|
17
|
+
#
|
18
|
+
|
19
|
+
package AdminMigration;
|
20
|
+
require Exporter;
|
21
|
+
@ISA = qw(Exporter);
|
22
|
+
@EXPORT = qw(migrateAdminServer);
|
23
|
+
@EXPORT_OK = qw(migrateAdminServer);
|
24
|
+
|
25
|
+
# load perldap
|
26
|
+
use Mozilla::LDAP::Conn;
|
27
|
+
use Mozilla::LDAP::Utils qw(normalizeDN);
|
28
|
+
use Mozilla::LDAP::API qw(:constant ldap_url_parse ldap_explode_dn);
|
29
|
+
|
30
|
+
use Migration;
|
31
|
+
use AdminServer;
|
32
|
+
use AdminUtil;
|
33
|
+
use DSUtil;
|
34
|
+
use DSUpdate;
|
35
|
+
use SetupLog;
|
36
|
+
|
37
|
+
use File::Path;
|
38
|
+
use File::Spec;
|
39
|
+
# tempfiles
|
40
|
+
use File::Temp qw(tempfile tempdir);
|
41
|
+
|
42
|
+
use strict;
|
43
|
+
|
44
|
+
# This gathers all of the old information from the old
|
45
|
+
# scattered config files and updates the corresponding
|
46
|
+
# parameters in the $mig->{inf}
|
47
|
+
sub getOldFileInfo {
|
48
|
+
my $mig = shift;
|
49
|
+
|
50
|
+
# assume the config DS has already been migrated
|
51
|
+
# we need to get our data out of there, and fix it
|
52
|
+
# as needed
|
53
|
+
my $oldAdmConf = getAdmConf($mig->{oldsroot} . "/admin-serv/config");
|
54
|
+
$mig->{inf}->{admin}->{sie} = $oldAdmConf->{sie};
|
55
|
+
$mig->{inf}->{admin}->{isie} = $oldAdmConf->{isie};
|
56
|
+
if (defined($oldAdmConf->{ldapStart})) {
|
57
|
+
$mig->{inf}->{admin}->{ldapStart} = $oldAdmConf->{ldapStart};
|
58
|
+
}
|
59
|
+
|
60
|
+
if (!defined($mig->{inf}->{General}->{FullMachineName}) or
|
61
|
+
!defined($mig->{inf}->{admin}->{ServerIpAddress}) or
|
62
|
+
!defined($mig->{inf}->{admin}->{Port})) {
|
63
|
+
my $oldPset = getPset($oldAdmConf);
|
64
|
+
if (!defined($mig->{inf}->{General}->{FullMachineName})) {
|
65
|
+
$mig->{inf}->{General}->{FullMachineName} = $oldPset->{serverhostname};
|
66
|
+
}
|
67
|
+
if (!defined($mig->{inf}->{admin}->{ServerIpAddress})) {
|
68
|
+
$mig->{inf}->{admin}->{ServerIpAddress} = $oldPset->{'configuration.nsserveraddress'};
|
69
|
+
}
|
70
|
+
if (!defined($mig->{inf}->{admin}->{Port})) {
|
71
|
+
$mig->{inf}->{admin}->{Port} = $oldPset->{'configuration.nsserverport'};
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
# need sie, isie, config ds url, admin id
|
76
|
+
if (!defined($mig->{inf}->{General}->{ConfigDirectoryLdapURL})) {
|
77
|
+
if (!open(DBSWITCH, $mig->{oldsroot} . "/shared/config/dbswitch.conf")) {
|
78
|
+
$mig->msg('error_opening_dbswitch', $mig->{oldsroot} . "/shared/config/dbswitch.conf", $!);
|
79
|
+
return 0;
|
80
|
+
}
|
81
|
+
while (<DBSWITCH>) {
|
82
|
+
if (/^directory default (.*)$/) {
|
83
|
+
$mig->{inf}->{General}->{ConfigDirectoryLdapURL} = $1;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
close(DBSWITCH);
|
87
|
+
}
|
88
|
+
if (!defined($mig->{inf}->{General}->{ConfigDirectoryAdminID})) {
|
89
|
+
if (!open(ADMPW, $mig->{oldsroot} . "/admin-serv/config/admpw")) {
|
90
|
+
$mig->msg('error_opening_ldapconf', $mig->{oldsroot} . "/admin-serv/config/admpw", $!);
|
91
|
+
return 0;
|
92
|
+
}
|
93
|
+
while (<ADMPW>) {
|
94
|
+
next if (/^#/);
|
95
|
+
if (/^(.*):.*$/) {
|
96
|
+
$mig->{inf}->{General}->{ConfigDirectoryAdminID} = $1;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
close(ADMPW);
|
100
|
+
}
|
101
|
+
if (!defined($mig->{inf}->{General}->{SuiteSpotGroup}) or
|
102
|
+
!defined($mig->{inf}->{General}->{SuiteSpotUserID})) {
|
103
|
+
if (!open(SSUSERS, $mig->{oldsroot} . "/shared/config/ssusers.conf")) {
|
104
|
+
$mig->msg('error_opening_ssusersconf', $mig->{oldsroot} . "/shared/config/ssusers.conf", $!);
|
105
|
+
return 0;
|
106
|
+
}
|
107
|
+
while (<SSUSERS>) {
|
108
|
+
if (/^SuiteSpotGroup\s+(.*)$/) {
|
109
|
+
if (!defined($mig->{inf}->{General}->{SuiteSpotGroup})) {
|
110
|
+
$mig->{inf}->{General}->{SuiteSpotGroup} = $1;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
if (/^SuiteSpotUser\s+(.*)$/) {
|
114
|
+
if (!defined($mig->{inf}->{General}->{SuiteSpotUserID})) {
|
115
|
+
$mig->{inf}->{General}->{SuiteSpotUserID} = $1;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
close(SSUSERS);
|
120
|
+
}
|
121
|
+
if (!defined($mig->{inf}->{General}->{AdminDomain})) {
|
122
|
+
my @rdns = ldap_explode_dn($mig->{inf}->{admin}->{isie}, 1);
|
123
|
+
$mig->{inf}->{General}->{AdminDomain} = $rdns[-2];
|
124
|
+
}
|
125
|
+
|
126
|
+
# the old admin server used to run as root - we cannot do that anymore
|
127
|
+
# with Apache based admin server, so by default just use the SuiteSpotUserID
|
128
|
+
# i.e. the same user id that the directory server uses
|
129
|
+
# and if that is not defined, we'll just have to use the default
|
130
|
+
if (!defined($mig->{inf}->{admin}->{SysUser})) {
|
131
|
+
$mig->{inf}->{admin}->{SysUser} = $mig->{inf}->{General}->{SuiteSpotUserID} ||
|
132
|
+
"nobody";
|
133
|
+
}
|
134
|
+
|
135
|
+
if (!defined($mig->{inf}->{General}->{SuiteSpotGroup})) {
|
136
|
+
$mig->{inf}->{General}->{SuiteSpotGroup} = "nobody";
|
137
|
+
}
|
138
|
+
|
139
|
+
return 1;
|
140
|
+
}
|
141
|
+
|
142
|
+
|
143
|
+
# This is how we extract the sie and isie as the as entries are
|
144
|
+
# being added
|
145
|
+
sub migratecb {
|
146
|
+
my ($context, $entry, $errs) = @_;
|
147
|
+
|
148
|
+
my @arycontext = ($context);
|
149
|
+
# always replace the tasks and commands with the new ones
|
150
|
+
my $dn = $entry->getDN();
|
151
|
+
if (($entry->getDN() =~ /^cn=Tasks/i) or
|
152
|
+
($entry->getDN() =~ /^cn=Commands/i)) {
|
153
|
+
push @arycontext, 1; # means to delete any existing entries first
|
154
|
+
}
|
155
|
+
|
156
|
+
my $rc = check_and_add_entry(\@arycontext, $entry, $errs);
|
157
|
+
|
158
|
+
return $rc;
|
159
|
+
}
|
160
|
+
|
161
|
+
# The config DS should have already been migrated, including the old
|
162
|
+
# admin server data. We need to update that information. Some of the
|
163
|
+
# fields no longer apply (userPassword, configuration.encryption.nsCertFile,
|
164
|
+
# configuration.encryption.nsKeyFile, serverRoot)
|
165
|
+
# some of the fields must be removed (any ssl2 fields)
|
166
|
+
# some of the fields must be changed (nsSuiteSpotUser)
|
167
|
+
sub migratePset {
|
168
|
+
my $mig = shift;
|
169
|
+
my $configdir = shift;
|
170
|
+
my $inf = $mig->{inf};
|
171
|
+
my @errs;
|
172
|
+
|
173
|
+
my $conn = $mig->{inf}->{configdsconn};
|
174
|
+
|
175
|
+
# add the Admin Server configuration entries
|
176
|
+
my @ldiffiles = ("/usr/share/dirsrv/data/asmigrate.ldif.tmpl",
|
177
|
+
"/usr/share/dirsrv/data/21astasks.ldif.tmpl",
|
178
|
+
"/usr/share/dirsrv/data/22ascommands.ldif.tmpl"
|
179
|
+
);
|
180
|
+
my @infs = getInfs("admin", "setup");
|
181
|
+
|
182
|
+
my $mapper = new Inf("/usr/share/dirsrv/inf/asmigrate.map");
|
183
|
+
|
184
|
+
$mapper = process_maptbl($mapper, \@errs, $inf, @infs);
|
185
|
+
if (!$mapper) {
|
186
|
+
$mig->msg(@errs);
|
187
|
+
$mig->msg($FATAL, 'error_creating_asmigration_maptbl');
|
188
|
+
return 0;
|
189
|
+
}
|
190
|
+
|
191
|
+
# update isie and sie
|
192
|
+
getMappedEntries($mapper, \@ldiffiles, \@errs, \&migratecb, $conn);
|
193
|
+
if (@errs) {
|
194
|
+
$mig->msg(@errs);
|
195
|
+
return 0;
|
196
|
+
}
|
197
|
+
|
198
|
+
my $localconf = "$configdir/local.conf";
|
199
|
+
my $isnew;
|
200
|
+
if (! -f $localconf) {
|
201
|
+
$isnew = 1;
|
202
|
+
}
|
203
|
+
if (!open(LOCALCONF, ">$localconf")) {
|
204
|
+
$mig->msg($FATAL, 'error_updating_localconf', $localconf, $!);
|
205
|
+
return 0;
|
206
|
+
}
|
207
|
+
# now get the entries and write them to local.conf
|
208
|
+
my $entry = $conn->search($inf->{admin}->{sie}, "sub", "(objectclass=*)");
|
209
|
+
if (!$entry || $conn->getErrorCode()) {
|
210
|
+
$mig->msg($FATAL, 'error_no_localconf_entries',
|
211
|
+
$inf->{admin}->{sie}, $localconf, $conn->getErrorString());
|
212
|
+
close(LOCALCONF);
|
213
|
+
return 0;
|
214
|
+
}
|
215
|
+
|
216
|
+
while ($entry) {
|
217
|
+
updateLocalConf($entry, $inf->{admin}->{sie}, \*LOCALCONF);
|
218
|
+
$entry = $conn->nextEntry();
|
219
|
+
}
|
220
|
+
close(LOCALCONF);
|
221
|
+
|
222
|
+
if ($isnew) {
|
223
|
+
my $admConf = getAdmConf($configdir);
|
224
|
+
my $uid = getpwnam $admConf->{sysuser};
|
225
|
+
chmod 0600, "$localconf";
|
226
|
+
chown $uid, -1, "$localconf";
|
227
|
+
}
|
228
|
+
|
229
|
+
return 1;
|
230
|
+
}
|
231
|
+
|
232
|
+
sub updateconinfocb {
|
233
|
+
my ($context, $entry, $errs) = @_;
|
234
|
+
|
235
|
+
my @arycontext = ($context);
|
236
|
+
# add or update all of the entries except for the UserDirectory
|
237
|
+
my $dn = $entry->getDN();
|
238
|
+
if (($entry->getDN() =~ /^cn=UserDirectory/i)) {
|
239
|
+
return 1; # return true, continue
|
240
|
+
}
|
241
|
+
|
242
|
+
my $rc = check_and_add_entry(\@arycontext, $entry, $errs);
|
243
|
+
|
244
|
+
return $rc;
|
245
|
+
}
|
246
|
+
|
247
|
+
# this updates any information in the configDS that pertains
|
248
|
+
# to the console being upgraded
|
249
|
+
sub updateConsoleInfo {
|
250
|
+
my $mig = shift;
|
251
|
+
my $configdir = shift;
|
252
|
+
my $inf = $mig->{inf};
|
253
|
+
my @errs;
|
254
|
+
|
255
|
+
my $conn = $mig->{inf}->{configdsconn};
|
256
|
+
|
257
|
+
if (@errs) {
|
258
|
+
$mig->msg($FATAL, @errs);
|
259
|
+
return 0;
|
260
|
+
}
|
261
|
+
|
262
|
+
# update the console info
|
263
|
+
my @ldiffiles = ("/usr/share/dirsrv/data/02globalpreferences.ldif.tmpl"
|
264
|
+
);
|
265
|
+
my @infs = getInfs("admin", "slapd", "setup");
|
266
|
+
my $mapper = new Inf("/usr/share/dirsrv/inf/updateconsoleinfo.map");
|
267
|
+
|
268
|
+
$mapper = process_maptbl($mapper, \@errs, $inf, @infs);
|
269
|
+
if (!$mapper) {
|
270
|
+
$mig->msg(@errs);
|
271
|
+
$mig->msg($FATAL, 'error_creating_updateconsole_maptbl');
|
272
|
+
return 0;
|
273
|
+
}
|
274
|
+
|
275
|
+
# update isie and sie
|
276
|
+
getMappedEntries($mapper, \@ldiffiles, \@errs, \&updateconinfocb, $conn);
|
277
|
+
if (@errs) {
|
278
|
+
$mig->msg(@errs);
|
279
|
+
return 0;
|
280
|
+
}
|
281
|
+
|
282
|
+
# now, copy over any customization entries
|
283
|
+
my $basedn = "ou=Admin, ou=Global Preferences, ou=" .
|
284
|
+
$inf->{General}->{AdminDomain} . ", o=NetscapeRoot";
|
285
|
+
my $versents = $conn->search($basedn, "sub", "(objectclass=*)", 0, qw(* aci));
|
286
|
+
if (!$versents) {
|
287
|
+
$mig->msg($FATAL, 'error_migrating_console_entries', $basedn, $conn->getErrorString());
|
288
|
+
return 0;
|
289
|
+
}
|
290
|
+
|
291
|
+
my @oldents = ();
|
292
|
+
for ($versents; $versents; $versents = $conn->nextEntry()) {
|
293
|
+
push @oldents, $versents;
|
294
|
+
}
|
295
|
+
|
296
|
+
for (@oldents) {
|
297
|
+
my $olddn = $_->getDN();
|
298
|
+
my $ver = getInfsVal('admin', 'ConsoleVersion', @infs);
|
299
|
+
if (($olddn =~ /ou=(\d.\d)/) && ($1 ne $ver)) {
|
300
|
+
my $newdn = $olddn;
|
301
|
+
$newdn =~ s/ou=$1/ou=$ver/;
|
302
|
+
my $newent = $_;
|
303
|
+
$newent->setDN($newdn);
|
304
|
+
$conn->add($newent);
|
305
|
+
if ($conn->getErrorCode() == LDAP_SUCCESS) {
|
306
|
+
debug(3, "Added new console customization entry $newdn\n");
|
307
|
+
} elsif ($conn->getErrorCode() == LDAP_ALREADY_EXISTS) {
|
308
|
+
debug(3, "Console customization entry $newdn already exists, skipping\n");
|
309
|
+
} else {
|
310
|
+
$mig->msg($FATAL, 'error_adding_console_entries', $newdn, $conn->getErrorString());
|
311
|
+
return 0;
|
312
|
+
}
|
313
|
+
} else {
|
314
|
+
debug(3, "Skipping entry $olddn - do not need to migrate it\n");
|
315
|
+
}
|
316
|
+
}
|
317
|
+
|
318
|
+
return 1;
|
319
|
+
}
|
320
|
+
|
321
|
+
sub migrateSecurityFiles {
|
322
|
+
my $mig = shift;
|
323
|
+
my $configdir = shift;
|
324
|
+
|
325
|
+
my $admConf = getAdmConf($configdir);
|
326
|
+
my $sie = $admConf->{sie};
|
327
|
+
my @rdns = ldap_explode_dn($sie, 1);
|
328
|
+
my $inst = $rdns[0];
|
329
|
+
my $rc = $mig->migrateSecurityFiles($inst, $configdir);
|
330
|
+
my $haspinfile;
|
331
|
+
if (-f $mig->{oldsroot} . "/admin-serv/config/password.conf") {
|
332
|
+
if (system ("cp -p $mig->{oldsroot}/admin-serv/config/password.conf $configdir/pin.txt")) {
|
333
|
+
$mig->msg('error_copying_passwordconf', "$mig->{oldsroot}/admin-serv/config/password.conf", $!);
|
334
|
+
return 0;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
return 1;
|
339
|
+
}
|
340
|
+
|
341
|
+
sub updateConfFileSecInfo {
|
342
|
+
my $mig = shift;
|
343
|
+
my $configdir = shift;
|
344
|
+
|
345
|
+
my $haspinfile;
|
346
|
+
for (glob("$configdir/*")) {
|
347
|
+
if (/pin\.txt$/) {
|
348
|
+
$haspinfile = 1;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
352
|
+
# if the user has specified a pin file, we need to let nss.conf know
|
353
|
+
if ($haspinfile) {
|
354
|
+
if (!open(NSSCONF, "$configdir/nss.conf")) {
|
355
|
+
$mig->msg('error_opening_nssconf', "$configdir/nss.conf", $!);
|
356
|
+
return 0;
|
357
|
+
}
|
358
|
+
my @nssconf = <NSSCONF>;
|
359
|
+
close(NSSCONF);
|
360
|
+
# nss.conf is usually read-only
|
361
|
+
chmod 0600, "$configdir/nss.conf";
|
362
|
+
if (!open(NSSCONF, ">$configdir/nss.conf")) {
|
363
|
+
$mig->msg('error_writing_nssconf', "$configdir/nss.conf", $!);
|
364
|
+
chmod 0400, "$configdir/nss.conf";
|
365
|
+
return 0;
|
366
|
+
}
|
367
|
+
my $found;
|
368
|
+
for (@nssconf) {
|
369
|
+
if (/^NSSPassPhraseDialog/) {
|
370
|
+
$found = 1;
|
371
|
+
$_ = "NSSPassPhraseDialog file:$configdir/pin.txt\n";
|
372
|
+
}
|
373
|
+
print NSSCONF $_;
|
374
|
+
}
|
375
|
+
if (!$found) {
|
376
|
+
print NSSCONF "NSSPassPhraseDialog file:$configdir/pin.txt\n";
|
377
|
+
}
|
378
|
+
close(NSSCONF);
|
379
|
+
chmod 0400, "$configdir/nss.conf";
|
380
|
+
}
|
381
|
+
|
382
|
+
# update console.conf with security info
|
383
|
+
my $pset = getPset($configdir);
|
384
|
+
if (defined($pset->{'configuration.nsserversecurity'}) and
|
385
|
+
($pset->{'configuration.nsserversecurity'} =~ /on/i)) {
|
386
|
+
my $certname = $pset->{'configuration.encryption.rsa.nssslpersonalityssl'};
|
387
|
+
my $clientauth = $pset->{'configuration.encryption.nssslclientauth'};
|
388
|
+
if (!open(CONSOLECONF, "$configdir/console.conf")) {
|
389
|
+
$mig->msg('error_opening_consoleconf', "$configdir/console.conf", $!);
|
390
|
+
return 0;
|
391
|
+
}
|
392
|
+
my @consoleconf = <CONSOLECONF>;
|
393
|
+
close(CONSOLECONF);
|
394
|
+
if (!open(CONSOLECONF, "> $configdir/console.conf")) {
|
395
|
+
$mig->msg('error_writing_consoleconf', "$configdir/console.conf", $!);
|
396
|
+
return 0;
|
397
|
+
}
|
398
|
+
for (@consoleconf) {
|
399
|
+
if (/^NSSEngine/) {
|
400
|
+
$_ = "NSSEngine on\n";
|
401
|
+
} elsif (/^NSSNickname/) {
|
402
|
+
$_ = "NSSNickname $certname\n";
|
403
|
+
} elsif (/^NSSVerifyClient/) {
|
404
|
+
if ($clientauth =~ /on/) {
|
405
|
+
$_ = "NSSVerifyClient require\n";
|
406
|
+
} else {
|
407
|
+
$_ = "NSSVerifyClient none\n";
|
408
|
+
}
|
409
|
+
}
|
410
|
+
print CONSOLECONF $_;
|
411
|
+
}
|
412
|
+
close(CONSOLECONF);
|
413
|
+
}
|
414
|
+
|
415
|
+
return 1;
|
416
|
+
}
|
417
|
+
|
418
|
+
sub migrateAdmpw {
|
419
|
+
my $mig = shift;
|
420
|
+
my $configdir = shift;
|
421
|
+
if (-f "$mig->{oldsroot}/admin-serv/config/admpw") {
|
422
|
+
if (system ("cp -p $mig->{oldsroot}/admin-serv/config/admpw $configdir/admpw")) {
|
423
|
+
$mig->msg('error_copying_admpw', "$mig->{oldsroot}/admin-serv/config/admpw", $!);
|
424
|
+
return 0;
|
425
|
+
}
|
426
|
+
}
|
427
|
+
|
428
|
+
return 1;
|
429
|
+
}
|
430
|
+
|
431
|
+
sub migrateAdminServer {
|
432
|
+
my $mig = shift;
|
433
|
+
my @errs;
|
434
|
+
|
435
|
+
if (!stopAdminServer()) {
|
436
|
+
return 0;
|
437
|
+
}
|
438
|
+
|
439
|
+
my $configdir = $mig->{inf}->{admin}->{config_dir} ||
|
440
|
+
$ENV{ADMSERV_CONF_DIR} ||
|
441
|
+
$mig->{configdir} . "/admin-serv";
|
442
|
+
|
443
|
+
my $securitydir = $mig->{inf}->{admin}->{security_dir} ||
|
444
|
+
$configdir;
|
445
|
+
|
446
|
+
my $logdir = $mig->{inf}->{admin}->{log_dir} ||
|
447
|
+
$ENV{ADMSERV_LOG_DIR} ||
|
448
|
+
"/var/log/dirsrv/admin-serv";
|
449
|
+
|
450
|
+
my $rundir = $mig->{inf}->{admin}->{run_dir} ||
|
451
|
+
$ENV{ADMSERV_PID_DIR} ||
|
452
|
+
"/var/run/dirsrv";
|
453
|
+
|
454
|
+
if (!getOldFileInfo($mig, $configdir)) {
|
455
|
+
return 0;
|
456
|
+
}
|
457
|
+
|
458
|
+
if (!createASFilesAndDirs($mig, $configdir, $securitydir, $logdir, $rundir)) {
|
459
|
+
return 0;
|
460
|
+
}
|
461
|
+
|
462
|
+
# change branding information
|
463
|
+
$mig->{inf}->{admin}->{sie} =~ s/\bNetscape\b/389/g;
|
464
|
+
$mig->{inf}->{admin}->{isie} =~ s/\bNetscape\b/389/g;
|
465
|
+
|
466
|
+
# update ldapStart
|
467
|
+
# if ldapStart is not an absolute path, we need to add
|
468
|
+
# the directory server instance dir (ServerRoot) to it
|
469
|
+
if ($mig->{inf}->{admin}->{ldapStart} &&
|
470
|
+
!File::Spec->file_name_is_absolute($mig->{inf}->{admin}->{ldapStart})) {
|
471
|
+
debug(1, "Need to make ldapStart an absolute path - ", $mig->{ServerRoot}, "/",
|
472
|
+
$mig->{inf}->{admin}->{ldapStart}, "\n");
|
473
|
+
$mig->{inf}->{admin}->{ldapStart} = $mig->{ServerRoot} . "/" . $mig->{inf}->{admin}->{ldapStart};
|
474
|
+
}
|
475
|
+
|
476
|
+
if (!updateAdmConf({ldapurl => $mig->{inf}->{General}->{ConfigDirectoryLdapURL},
|
477
|
+
userdn => $mig->{inf}->{General}->{ConfigDirectoryAdminID},
|
478
|
+
SuiteSpotUserID => $mig->{inf}->{General}->{SuiteSpotUserID},
|
479
|
+
SuiteSpotGroup => $mig->{inf}->{General}->{SuiteSpotGroup},
|
480
|
+
sysuser => $mig->{inf}->{admin}->{SysUser},
|
481
|
+
sysgroup => $mig->{inf}->{General}->{SuiteSpotGroup},
|
482
|
+
AdminDomain => $mig->{inf}->{General}->{AdminDomain},
|
483
|
+
sie => $mig->{inf}->{admin}->{sie},
|
484
|
+
isie => $mig->{inf}->{admin}->{isie},
|
485
|
+
ldapStart => $mig->{inf}->{admin}->{ldapStart}},
|
486
|
+
$configdir)) {
|
487
|
+
return 0;
|
488
|
+
}
|
489
|
+
|
490
|
+
if (!migrateSecurityFiles($mig, $configdir)) {
|
491
|
+
return 0;
|
492
|
+
}
|
493
|
+
|
494
|
+
my $conn = getConfigDSConn($mig->{inf}->{General}->{ConfigDirectoryLdapURL},
|
495
|
+
$mig->{inf}->{General}->{ConfigDirectoryAdminID},
|
496
|
+
$mig->{inf}->{General}->{ConfigDirectoryAdminPwd},
|
497
|
+
$configdir, \@errs);
|
498
|
+
|
499
|
+
if (@errs) {
|
500
|
+
$mig->msg($FATAL, @errs);
|
501
|
+
return 0;
|
502
|
+
}
|
503
|
+
|
504
|
+
$mig->{inf}->{configdsconn} = $conn;
|
505
|
+
$mig->{inf}->{slapd}->{updatedir} = "/usr/share/dirsrv/updates-admin";
|
506
|
+
|
507
|
+
my @errs;
|
508
|
+
if (@errs = updateDS($mig)) {
|
509
|
+
$conn->close();
|
510
|
+
$mig->msg(@errs);
|
511
|
+
return 0;
|
512
|
+
}
|
513
|
+
|
514
|
+
my $admConf = getAdmConf($configdir);
|
515
|
+
$mig->{inf}->{admin}->{sie} = $admConf->{sie};
|
516
|
+
$mig->{inf}->{admin}->{isie} = $admConf->{isie};
|
517
|
+
|
518
|
+
if (!migratePset($mig, $configdir)) {
|
519
|
+
$conn->close();
|
520
|
+
return 0;
|
521
|
+
}
|
522
|
+
|
523
|
+
if (!updateConsoleInfo($mig, $configdir)) {
|
524
|
+
$conn->close();
|
525
|
+
return 0;
|
526
|
+
}
|
527
|
+
|
528
|
+
$conn->close();
|
529
|
+
|
530
|
+
if (!migrateAdmpw($mig, $configdir)) {
|
531
|
+
return 0;
|
532
|
+
}
|
533
|
+
|
534
|
+
if (!updateConfFileSecInfo($mig, $configdir)) {
|
535
|
+
return 0;
|
536
|
+
}
|
537
|
+
|
538
|
+
$mig->msg('updating_httpconf');
|
539
|
+
if (!updateHttpConfFiles($mig->{inf}->{admin}->{ServerIpAddress},
|
540
|
+
$mig->{inf}->{admin}->{Port},
|
541
|
+
$configdir)) {
|
542
|
+
$mig->msg($FATAL, 'error_updating_httpconf');
|
543
|
+
return 0;
|
544
|
+
}
|
545
|
+
|
546
|
+
if (!setFileOwnerPerms($mig, $configdir)) {
|
547
|
+
return 0;
|
548
|
+
}
|
549
|
+
|
550
|
+
# Update selinux policy
|
551
|
+
updateSelinuxPolicy($mig, $configdir, $securitydir, $logdir, $rundir);
|
552
|
+
|
553
|
+
if (!startAdminServer($mig, $configdir, $logdir, $rundir)) {
|
554
|
+
return 0;
|
555
|
+
}
|
556
|
+
|
557
|
+
return 1;
|
558
|
+
}
|
559
|
+
|
560
|
+
|
561
|
+
# obligatory module true return
|
562
|
+
1;
|
563
|
+
|
564
|
+
# emacs settings
|
565
|
+
# Local Variables:
|
566
|
+
# mode:perl
|
567
|
+
# indent-tabs-mode: nil
|
568
|
+
# tab-width: 4
|
569
|
+
# End:
|