commit | author | age
|
532ae5
|
1 |
<?php |
L |
2 |
|
|
3 |
/* |
|
4 |
Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh |
|
5 |
All rights reserved. |
|
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 |
*/ |
|
30 |
|
|
31 |
/* |
|
32 |
ISPConfig 3 installer. |
b04e82
|
33 |
|
TB |
34 |
------------------------------------------------------------------------------------- |
|
35 |
- Interactive install |
|
36 |
------------------------------------------------------------------------------------- |
|
37 |
run: |
|
38 |
|
|
39 |
php install.php |
|
40 |
|
|
41 |
------------------------------------------------------------------------------------- |
|
42 |
- Noninteractive (autoinstall) mode |
|
43 |
------------------------------------------------------------------------------------- |
|
44 |
|
|
45 |
The autoinstall mode can read the installer questions from a .ini style file or from |
|
46 |
a php config file. Examples for both file types are in the docs folder. |
|
47 |
See autoinstall.ini.sample and autoinstall.conf_sample.php. |
|
48 |
|
|
49 |
run: |
|
50 |
|
|
51 |
php install.php --autoinstall=autoinstall.ini |
|
52 |
|
|
53 |
or |
|
54 |
|
|
55 |
php install.php --autoinstall=autoinstall.conf.php |
|
56 |
|
532ae5
|
57 |
*/ |
L |
58 |
|
|
59 |
error_reporting(E_ALL|E_STRICT); |
|
60 |
|
7334d4
|
61 |
define('INSTALLER_RUN', true); |
T |
62 |
|
532ae5
|
63 |
//** The banner on the command line |
b1a6a5
|
64 |
echo "\n\n".str_repeat('-', 80)."\n"; |
532ae5
|
65 |
echo " _____ ___________ _____ __ _ ____ |
L |
66 |
|_ _/ ___| ___ \ / __ \ / _(_) /__ \ |
|
67 |
| | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ / |
|
68 |
| | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ | |
|
69 |
_| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \ |
|
70 |
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/ |
|
71 |
__/ | |
|
72 |
|___/ "; |
b1a6a5
|
73 |
echo "\n".str_repeat('-', 80)."\n"; |
532ae5
|
74 |
echo "\n\n>> Initial configuration \n\n"; |
L |
75 |
|
|
76 |
//** Include the library with the basic installer functions |
b1a6a5
|
77 |
require_once 'lib/install.lib.php'; |
532ae5
|
78 |
|
L |
79 |
//** Include the base class of the installer class |
b1a6a5
|
80 |
require_once 'lib/installer_base.lib.php'; |
532ae5
|
81 |
|
L |
82 |
//** Ensure that current working directory is install directory |
|
83 |
$cur_dir = getcwd(); |
|
84 |
if(realpath(dirname(__FILE__)) != $cur_dir) { |
|
85 |
chdir( realpath(dirname(__FILE__)) ); |
|
86 |
} |
|
87 |
|
|
88 |
//** Install logfile |
|
89 |
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); |
|
90 |
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); |
|
91 |
|
ccbf14
|
92 |
//** Include the templating lib |
TB |
93 |
require_once 'lib/classes/tpl.inc.php'; |
|
94 |
|
532ae5
|
95 |
//** Check for existing installation |
L |
96 |
/*if(is_dir("/usr/local/ispconfig")) { |
|
97 |
die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.'); |
|
98 |
}*/ |
|
99 |
|
|
100 |
//** Get distribution identifier |
|
101 |
$dist = get_distname(); |
|
102 |
|
|
103 |
if($dist['id'] == '') die('Linux distribution or version not recognized.'); |
|
104 |
|
bcd725
|
105 |
//** Include the autoinstaller configuration (for non-interactive setups) |
FT |
106 |
error_reporting(E_ALL ^ E_NOTICE); |
b04e82
|
107 |
|
TB |
108 |
//** Get commandline options |
|
109 |
$cmd_opt = getopt('', array('autoinstall::')); |
|
110 |
|
|
111 |
//** Load autoinstall file |
|
112 |
if(isset($cmd_opt['autoinstall']) && is_file($cmd_opt['autoinstall'])) { |
|
113 |
$path_parts = pathinfo($cmd_opt['autoinstall']); |
|
114 |
if($path_parts['extension'] == 'php') { |
|
115 |
include_once $cmd_opt['autoinstall']; |
|
116 |
} elseif($path_parts['extension'] == 'ini') { |
|
117 |
$tmp = ini_to_array(file_get_contents('autoinstall.ini')); |
c8509b
|
118 |
if(!is_array($tmp['install'])) $tmp['install'] = array(); |
MC |
119 |
if(!is_array($tmp['ssl_cert'])) $tmp['ssl_cert'] = array(); |
|
120 |
if(!is_array($tmp['expert'])) $tmp['expert'] = array(); |
|
121 |
if(!is_array($tmp['update'])) $tmp['update'] = array(); |
b04e82
|
122 |
$autoinstall = $tmp['install'] + $tmp['ssl_cert'] + $tmp['expert'] + $tmp['update']; |
TB |
123 |
unset($tmp); |
|
124 |
} |
|
125 |
unset($path_parts); |
|
126 |
define('AUTOINSTALL', true); |
|
127 |
} else { |
|
128 |
$autoinstall = array(); |
|
129 |
define('AUTOINSTALL', false); |
|
130 |
} |
|
131 |
|
bcd725
|
132 |
|
532ae5
|
133 |
//** Include the distribution-specific installer class library and configuration |
b1a6a5
|
134 |
if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php'; |
MC |
135 |
include_once 'dist/lib/'.$dist['id'].'.lib.php'; |
|
136 |
include_once 'dist/conf/'.$dist['id'].'.conf.php'; |
532ae5
|
137 |
|
L |
138 |
//**************************************************************************************************** |
b1a6a5
|
139 |
//** Installer Interface |
532ae5
|
140 |
//**************************************************************************************************** |
L |
141 |
$inst = new installer(); |
cc45ab
|
142 |
if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n"); |
ead7ad
|
143 |
$retval=shell_exec("which which"); |
FS |
144 |
if (empty($retval)) die ("ISPConfig requieres which \n"); |
60b700
|
145 |
|
532ae5
|
146 |
swriteln($inst->lng(' Following will be a few questions for primary configuration so be careful.')); |
L |
147 |
swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.')); |
|
148 |
swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n")); |
|
149 |
|
|
150 |
//** Check log file is writable (probably not root or sudo) |
|
151 |
if(!is_writable(dirname(ISPC_LOG_FILE))){ |
b1a6a5
|
152 |
die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n"); |
532ae5
|
153 |
} |
L |
154 |
|
|
155 |
if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { |
|
156 |
die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); |
|
157 |
} |
|
158 |
|
|
159 |
if(is_dir('/usr/local/ispconfig')) { |
|
160 |
die('ISPConfig 3 installation found. Please use update.php instead if install.php to update the installation.'); |
|
161 |
} |
|
162 |
|
|
163 |
//** Detect the installed applications |
|
164 |
$inst->find_installed_apps(); |
|
165 |
|
8cf78b
|
166 |
//** Select the language and set default timezone |
b04e82
|
167 |
$conf['language'] = $inst->simple_query('Select language', array('en', 'de'), 'en','language'); |
3898c9
|
168 |
$conf['timezone'] = get_system_timezone(); |
532ae5
|
169 |
|
992797
|
170 |
//* Set default theme |
f598b0
|
171 |
$conf['theme'] = 'default'; |
992797
|
172 |
$conf['language_file_import_enabled'] = true; |
f598b0
|
173 |
|
532ae5
|
174 |
//** Select installation mode |
b04e82
|
175 |
$install_mode = $inst->simple_query('Installation mode', array('standard', 'expert'), 'standard','install_mode'); |
532ae5
|
176 |
|
L |
177 |
|
|
178 |
//** Get the hostname |
|
179 |
$tmp_out = array(); |
|
180 |
exec('hostname -f', $tmp_out); |
5a56e6
|
181 |
$conf['hostname'] = @$tmp_out[0]; |
7eade0
|
182 |
unset($tmp_out); |
bb690d
|
183 |
//** Prevent empty hostname |
FS |
184 |
$check = false; |
|
185 |
do { |
|
186 |
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $conf['hostname'], 'hostname'); |
|
187 |
$conf['hostname']=trim($conf['hostname']); |
|
188 |
$check = @($conf['hostname'] !== '')?true:false; |
|
189 |
if(!$check) swriteln('Hostname may not be empty.'); |
|
190 |
} while (!$check); |
ee405d
|
191 |
|
532ae5
|
192 |
// Check if the mysql functions are loaded in PHP |
f1926a
|
193 |
if(!function_exists('mysqli_connect')) die('No PHP MySQLi functions available. Please ensure that the PHP MySQL module is loaded.'); |
532ae5
|
194 |
|
L |
195 |
//** Get MySQL root credentials |
|
196 |
$finished = false; |
|
197 |
do { |
b04e82
|
198 |
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host'],'mysql_hostname'); |
82e9b9
|
199 |
$tmp_mysql_server_port = $inst->free_query('MySQL server port', $conf['mysql']['port'],'mysql_port'); |
b04e82
|
200 |
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user'],'mysql_root_user'); |
TB |
201 |
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password'); |
|
202 |
$tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database'],'mysql_database'); |
|
203 |
$tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset'],'mysql_charset'); |
bcd725
|
204 |
|
8cf78b
|
205 |
if($install_mode == 'expert') { |
T |
206 |
swriteln("The next two questions are about the internal ISPConfig database user and password.\nIt is recommended to accept the defaults which are 'ispconfig' as username and a random password.\nIf you use a different password, use only numbers and chars for the password.\n"); |
bcd725
|
207 |
|
b04e82
|
208 |
$conf['mysql']['ispconfig_user'] = $inst->free_query('ISPConfig mysql database username', $conf['mysql']['ispconfig_user'],'mysql_ispconfig_user'); |
TB |
209 |
$conf['mysql']['ispconfig_password'] = $inst->free_query('ISPConfig mysql database password', $conf['mysql']['ispconfig_password'],'mysql_ispconfig_password'); |
8cf78b
|
210 |
} |
b1a6a5
|
211 |
|
532ae5
|
212 |
//* Initialize the MySQL server connection |
7baf73
|
213 |
if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, '', (int)$tmp_mysql_server_port)) { |
532ae5
|
214 |
$conf['mysql']['host'] = $tmp_mysql_server_host; |
82e9b9
|
215 |
$conf['mysql']['port'] = $tmp_mysql_server_port; |
532ae5
|
216 |
$conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; |
L |
217 |
$conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password; |
|
218 |
$conf['mysql']['database'] = $tmp_mysql_server_database; |
|
219 |
$conf['mysql']['charset'] = $tmp_mysql_server_charset; |
|
220 |
$finished = true; |
|
221 |
} else { |
8a8cc2
|
222 |
swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysqli_connect_error()); |
532ae5
|
223 |
} |
L |
224 |
} while ($finished == false); |
|
225 |
unset($finished); |
|
226 |
|
|
227 |
// Resolve the IP address of the MySQL hostname. |
b1a6a5
|
228 |
$tmp = explode(':', $conf['mysql']['host']); |
532ae5
|
229 |
if(!$conf['mysql']['ip'] = gethostbyname($tmp[0])) die('Unable to resolve hostname'.$tmp[0]); |
L |
230 |
unset($tmp); |
|
231 |
|
|
232 |
|
|
233 |
//** Initializing database connection |
b1a6a5
|
234 |
include_once 'lib/mysql.lib.php'; |
532ae5
|
235 |
$inst->db = new db(); |
L |
236 |
|
|
237 |
//** Begin with standard or expert installation |
a75c81
|
238 |
|
FS |
239 |
$conf['services']['mail'] = false; |
|
240 |
$conf['services']['web'] = false; |
|
241 |
$conf['services']['dns'] = false; |
|
242 |
$conf['services']['file'] = false; |
|
243 |
$conf['services']['db'] = true; |
|
244 |
$conf['services']['vserver'] = false; |
|
245 |
$conf['services']['firewall'] = false; |
|
246 |
$conf['services']['proxy'] = false; |
|
247 |
$conf['services']['xmpp'] = false; |
|
248 |
|
532ae5
|
249 |
if($install_mode == 'standard') { |
b1a6a5
|
250 |
|
d22277
|
251 |
$inst->dbmaster = $inst->db; |
MB |
252 |
|
532ae5
|
253 |
//* Create the MySQL database |
L |
254 |
$inst->configure_database(); |
b1a6a5
|
255 |
|
a75c81
|
256 |
//* Insert the Server record into the database |
FS |
257 |
$inst->add_database_server_record(); |
|
258 |
|
|
259 |
//* Configure Postgrey |
bedf79
|
260 |
$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey', false); |
a75c81
|
261 |
if($force) swriteln('Configuring Postgrey'); |
FS |
262 |
|
|
263 |
//* Configure Postfix |
bedf79
|
264 |
$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix', false); |
a75c81
|
265 |
if($force) { |
FS |
266 |
swriteln('Configuring Postfix'); |
|
267 |
$inst->configure_postfix(); |
|
268 |
$conf['services']['mail'] = true; |
|
269 |
} |
|
270 |
|
|
271 |
if($conf['services']['mail']) { |
|
272 |
|
|
273 |
//* Configure Mailman |
bedf79
|
274 |
$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', false); |
a75c81
|
275 |
if($force) { |
FS |
276 |
swriteln('Configuring Mailman'); |
|
277 |
$inst->configure_mailman(); |
|
278 |
} |
|
279 |
|
|
280 |
//* Check for Dovecot and Courier |
|
281 |
if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { |
bedf79
|
282 |
$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', false); |
FS |
283 |
$conf['courier']['installed'] = $inst->force_configure_app('Courier', false); |
a75c81
|
284 |
} |
FS |
285 |
//* Configure Mailserver - Dovecot or Courier |
|
286 |
if($conf['dovecot']['installed'] && $conf['courier']['installed']) { |
|
287 |
$mail_server_to_use = $inst->simple_query('Dovecot and Courier detected. Select server to use with ISPConfig:', array('dovecot', 'courier'), 'dovecot','mail_server'); |
|
288 |
if($mail_server_to_use == 'dovecot'){ |
|
289 |
$conf['courier']['installed'] = false; |
|
290 |
} else { |
|
291 |
$conf['dovecot']['installed'] = false; |
|
292 |
} |
|
293 |
} |
|
294 |
//* Configure Dovecot |
|
295 |
if($conf['dovecot']['installed']) { |
|
296 |
swriteln('Configuring Dovecot'); |
|
297 |
$inst->configure_dovecot(); |
|
298 |
} |
|
299 |
//* Configure Courier |
|
300 |
if($conf['courier']['installed']) { |
|
301 |
swriteln('Configuring Courier'); |
|
302 |
$inst->configure_courier(); |
|
303 |
swriteln('Configuring SASL'); |
|
304 |
$inst->configure_saslauthd(); |
|
305 |
swriteln('Configuring PAM'); |
|
306 |
$inst->configure_pam(); |
|
307 |
} |
|
308 |
|
|
309 |
//* Configure Spamasassin |
bedf79
|
310 |
$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', false); |
a75c81
|
311 |
if($force) { |
FS |
312 |
swriteln('Configuring Spamassassin'); |
|
313 |
$inst->configure_spamassassin(); |
|
314 |
} |
|
315 |
|
|
316 |
//* Configure Amavis |
bedf79
|
317 |
$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd', false); |
a75c81
|
318 |
if($force) { |
FS |
319 |
swriteln('Configuring Amavisd'); |
|
320 |
$inst->configure_amavis(); |
|
321 |
} |
|
322 |
|
|
323 |
//* Configure Getmail |
bedf79
|
324 |
$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', false); |
a75c81
|
325 |
if($force) { |
FS |
326 |
swriteln('Configuring Getmail'); |
|
327 |
$inst->configure_getmail(); |
|
328 |
} |
|
329 |
|
|
330 |
} else swriteln('[ERROR] Postfix not installed - skipping Mail'); |
|
331 |
|
|
332 |
//* Check for DNS |
460a60
|
333 |
// if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
FS |
334 |
if(!$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
|
335 |
// $conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', false); |
bedf79
|
336 |
$conf['bind']['installed'] = $inst->force_configure_app('BIND', false); |
FS |
337 |
$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS', false); |
a75c81
|
338 |
} |
FS |
339 |
//* Configure PowerDNS |
460a60
|
340 |
/* |
a75c81
|
341 |
if($conf['powerdns']['installed']) { |
FS |
342 |
swriteln('Configuring PowerDNS'); |
|
343 |
$inst->configure_powerdns(); |
|
344 |
$conf['services']['dns'] = true; |
|
345 |
} |
460a60
|
346 |
*/ |
57e982
|
347 |
|
a75c81
|
348 |
//* Configure Bind |
FS |
349 |
if($conf['bind']['installed']) { |
|
350 |
swriteln('Configuring BIND'); |
|
351 |
$inst->configure_bind(); |
|
352 |
$conf['services']['dns'] = true; |
57e982
|
353 |
if(!is_installed('haveged')) { |
ead7ad
|
354 |
swriteln("[INFO] haveged not detected - DNSSEC can fail"); |
FS |
355 |
} |
a75c81
|
356 |
} |
FS |
357 |
//* Configure MyDNS |
|
358 |
if($conf['mydns']['installed']) { |
|
359 |
swriteln('Configuring MyDNS'); |
|
360 |
$inst->configure_mydns(); |
|
361 |
$conf['services']['dns'] = true; |
|
362 |
} |
|
363 |
|
|
364 |
//* Configure Jailkit |
bedf79
|
365 |
$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit', false); |
a75c81
|
366 |
if($force) { |
FS |
367 |
swriteln('Configuring Jailkit'); |
|
368 |
$inst->configure_jailkit(); |
|
369 |
} |
|
370 |
|
|
371 |
//* Configure Pureftpd |
bedf79
|
372 |
$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd', false); |
a75c81
|
373 |
if($force) { |
FS |
374 |
swriteln('Configuring Pureftpd'); |
|
375 |
$inst->configure_pureftpd(); |
|
376 |
} |
|
377 |
|
|
378 |
//* Check for Web-Server |
|
379 |
if(!$conf['apache']['installed'] && !$conf['nginx']['installed']) { |
bedf79
|
380 |
$conf['apache']['installed'] = $inst->force_configure_app('Apache', false); |
FS |
381 |
$conf['nginx']['installed'] = $inst->force_configure_app('nginx', false); |
a75c81
|
382 |
} |
FS |
383 |
|
4ffb51
|
384 |
//* Configure Webserver - Apache or nginx |
a75c81
|
385 |
if($conf['apache']['installed'] && $conf['nginx']['installed']) { |
b04e82
|
386 |
$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server'); |
4ffb51
|
387 |
if($http_server_to_use == 'apache'){ |
F |
388 |
$conf['nginx']['installed'] = false; |
|
389 |
} else { |
|
390 |
$conf['apache']['installed'] = false; |
|
391 |
} |
|
392 |
} |
b1a6a5
|
393 |
|
532ae5
|
394 |
//* Configure Apache |
a75c81
|
395 |
if($conf['apache']['installed']){ |
4ffb51
|
396 |
swriteln('Configuring Apache'); |
F |
397 |
$inst->configure_apache(); |
a75c81
|
398 |
$conf['services']['web'] = true; |
FS |
399 |
$conf['services']['file'] = true; |
|
400 |
//* Configure Vlogger |
bedf79
|
401 |
$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger', false); |
a75c81
|
402 |
if($force) { |
FS |
403 |
swriteln('Configuring vlogger'); |
|
404 |
$inst->configure_vlogger(); |
|
405 |
} |
|
406 |
//* Configure squid |
|
407 |
/* |
|
408 |
$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid'); |
|
409 |
if($force) { |
|
410 |
swriteln('Configuring Squid'); |
|
411 |
$inst->configure_squid(); |
|
412 |
$conf['services']['proxy'] = true; |
|
413 |
} |
|
414 |
*/ |
4ffb51
|
415 |
} |
b1a6a5
|
416 |
|
4ffb51
|
417 |
//* Configure nginx |
a75c81
|
418 |
if($conf['nginx']['installed']){ |
4ffb51
|
419 |
swriteln('Configuring nginx'); |
F |
420 |
$inst->configure_nginx(); |
a75c81
|
421 |
$conf['services']['web'] = true; |
4ffb51
|
422 |
} |
b1a6a5
|
423 |
|
a75c81
|
424 |
//* Configure XMPP |
bedf79
|
425 |
$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server', false); |
a75c81
|
426 |
if($force) { |
FS |
427 |
swriteln('Configuring Metronome XMPP Server'); |
|
428 |
$inst->configure_xmpp(); |
|
429 |
$conf['services']['xmpp'] = true; |
|
430 |
} |
b1a6a5
|
431 |
|
a75c81
|
432 |
//* Check for Firewall |
FS |
433 |
if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) { |
bedf79
|
434 |
$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall', false); |
FS |
435 |
$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall', false); |
a75c81
|
436 |
} |
FS |
437 |
//* Configure Firewall - Ubuntu or Bastille |
|
438 |
if($conf['ufw']['installed'] && $conf['firewall']['installed']) { |
|
439 |
$firewall_to_use = $inst->simple_query('Ubuntu and Bastille Firewall detected. Select firewall to use with ISPConfig:', array('bastille', 'ubuntu'), 'bastille','firewall_server'); |
|
440 |
if($firewall_to_use == 'bastille'){ |
|
441 |
$conf['ufw']['installed'] = false; |
|
442 |
} else { |
|
443 |
$conf['firewall']['installed'] = false; |
|
444 |
} |
|
445 |
} |
|
446 |
//* Configure Ubuntu Firewall |
|
447 |
if($conf['ufw']['installed']){ |
bd68aa
|
448 |
swriteln('Configuring Ubuntu Firewall'); |
MC |
449 |
$inst->configure_ufw_firewall(); |
|
450 |
$conf['services']['firewall'] = true; |
a75c81
|
451 |
} |
FS |
452 |
//* Configure Bastille Firewall |
|
453 |
if($conf['firewall']['installed']){ |
bd68aa
|
454 |
swriteln('Configuring Bastille Firewall'); |
MC |
455 |
$inst->configure_bastille_firewall(); |
a75c81
|
456 |
$conf['services']['firewall'] = true; |
56ad03
|
457 |
$conf['bastille']['installed'] = true; |
bd68aa
|
458 |
} |
c12af9
|
459 |
|
b1a6a5
|
460 |
//* Configure Fail2ban |
bedf79
|
461 |
$force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', false); |
a75c81
|
462 |
if($force) { |
b1a6a5
|
463 |
swriteln('Configuring Fail2ban'); |
MC |
464 |
$inst->configure_fail2ban(); |
|
465 |
} |
|
466 |
|
a75c81
|
467 |
//* Configure OpenVZ |
bedf79
|
468 |
$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', false); |
a75c81
|
469 |
if($force) { |
FS |
470 |
$conf['services']['vserver'] = true; |
|
471 |
swriteln('Configuring OpenVZ'); |
80e3c9
|
472 |
} |
b1a6a5
|
473 |
|
a75c81
|
474 |
//** Configure apps vhost |
FS |
475 |
swriteln('Configuring Apps vhost'); |
|
476 |
$inst->configure_apps_vhost(); |
9f94a1
|
477 |
|
532ae5
|
478 |
//* Configure ISPConfig |
L |
479 |
swriteln('Installing ISPConfig'); |
b1a6a5
|
480 |
|
532ae5
|
481 |
//** Customize the port ISPConfig runs on |
b04e82
|
482 |
$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); |
55cb02
|
483 |
$conf['interface_password'] = $inst->free_query('Admin password', 'admin'); |
272da6
|
484 |
if($conf['interface_password'] != 'admin') { |
FS |
485 |
$check = false; |
|
486 |
do { |
|
487 |
unset($temp_password); |
480eba
|
488 |
$temp_password = $inst->free_query('Re-enter admin password', ''); |
272da6
|
489 |
$check = @($temp_password == $conf['interface_password'])?true:false; |
480eba
|
490 |
if(!$check) swriteln('Passwords do not match.'); |
272da6
|
491 |
} while (!$check); |
FS |
492 |
} |
|
493 |
unset($check); |
|
494 |
unset($temp_password); |
dec0df
|
495 |
if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port; |
T |
496 |
if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port; |
|
497 |
unset($ispconfig_vhost_port); |
532ae5
|
498 |
|
b04e82
|
499 |
if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') { |
b1a6a5
|
500 |
$inst->make_ispconfig_ssl_cert(); |
939b92
|
501 |
} |
M |
502 |
|
532ae5
|
503 |
$inst->install_ispconfig(); |
b1a6a5
|
504 |
|
532ae5
|
505 |
//* Configure DBServer |
L |
506 |
swriteln('Configuring DBServer'); |
|
507 |
$inst->configure_dbserver(); |
|
508 |
|
|
509 |
//* Configure ISPConfig |
a75c81
|
510 |
if($conf['cron']['installed']) { |
FS |
511 |
swriteln('Installing ISPConfig crontab'); |
|
512 |
$inst->install_crontab(); |
|
513 |
} else swriteln('[ERROR] Cron not found'); |
b1a6a5
|
514 |
|
d22277
|
515 |
swriteln('Detect IP addresses'); |
MB |
516 |
$inst->detect_ips(); |
|
517 |
|
532ae5
|
518 |
swriteln('Restarting services ...'); |
574a16
|
519 |
if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); |
3327ed
|
520 |
if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
FT |
521 |
if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); |
|
522 |
if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); |
|
523 |
if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); |
|
524 |
if($conf['courier']['installed'] == true){ |
|
525 |
if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); |
|
526 |
if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); |
|
527 |
if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); |
|
528 |
if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); |
|
529 |
if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); |
|
530 |
} |
|
531 |
if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); |
|
532 |
if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); |
33bcd0
|
533 |
if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); |
4ffb51
|
534 |
//* Reload is enough for nginx |
F |
535 |
if($conf['nginx']['installed'] == true){ |
33bcd0
|
536 |
if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
FT |
537 |
if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
4ffb51
|
538 |
} |
3327ed
|
539 |
if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart')); |
33bcd0
|
540 |
if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null'); |
FT |
541 |
if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null'); |
|
542 |
if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null'); |
b1a6a5
|
543 |
//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); |
33bcd0
|
544 |
if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); |
7cf3e9
|
545 |
if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null'); |
9f94a1
|
546 |
if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null'); |
b1a6a5
|
547 |
|
a75c81
|
548 |
} else { //* expert mode |
b1a6a5
|
549 |
|
532ae5
|
550 |
//** Get Server ID |
L |
551 |
// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1'); |
|
552 |
// Server ID is an autoInc value of the mysql database now |
b04e82
|
553 |
if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup', array('y', 'n'), 'n','join_multiserver_setup')) == 'y') { |
532ae5
|
554 |
$conf['mysql']['master_slave_setup'] = 'y'; |
b1a6a5
|
555 |
|
532ae5
|
556 |
//** Get MySQL root credentials |
L |
557 |
$finished = false; |
|
558 |
do { |
b04e82
|
559 |
$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); |
82e9b9
|
560 |
$tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); |
b04e82
|
561 |
$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); |
TB |
562 |
$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); |
|
563 |
$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); |
b1a6a5
|
564 |
|
532ae5
|
565 |
//* Initialize the MySQL server connection |
8a8cc2
|
566 |
if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) { |
532ae5
|
567 |
$conf['mysql']['master_host'] = $tmp_mysql_server_host; |
82e9b9
|
568 |
$conf['mysql']['master_port'] = $tmp_mysql_server_port; |
532ae5
|
569 |
$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; |
L |
570 |
$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; |
|
571 |
$conf['mysql']['master_database'] = $tmp_mysql_server_database; |
|
572 |
$finished = true; |
|
573 |
} else { |
8a8cc2
|
574 |
swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error()); |
532ae5
|
575 |
} |
L |
576 |
} while ($finished == false); |
|
577 |
unset($finished); |
b1a6a5
|
578 |
|
532ae5
|
579 |
// initialize the connection to the master database |
L |
580 |
$inst->dbmaster = new db(); |
|
581 |
if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); |
305dda
|
582 |
$inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]); |
MC |
583 |
$inst->dbmaster->setDBName($conf['mysql']["master_database"]); |
b1a6a5
|
584 |
|
532ae5
|
585 |
} else { |
L |
586 |
// the master DB is the same then the slave DB |
|
587 |
$inst->dbmaster = $inst->db; |
|
588 |
} |
b1a6a5
|
589 |
|
532ae5
|
590 |
//* Create the mysql database |
L |
591 |
$inst->configure_database(); |
b1a6a5
|
592 |
|
a75c81
|
593 |
//* Check for Web-Server |
FS |
594 |
if($conf['apache']['installed'] != true && $conf['nginx']['installed'] != true) { |
|
595 |
$conf['apache']['installed'] = $inst->force_configure_app('Apache'); |
|
596 |
$conf['nginx']['installed'] = $inst->force_configure_app('nginx'); |
|
597 |
} |
4ffb51
|
598 |
//* Configure Webserver - Apache or nginx |
F |
599 |
if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) { |
b04e82
|
600 |
$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server'); |
4ffb51
|
601 |
if($http_server_to_use == 'apache'){ |
F |
602 |
$conf['nginx']['installed'] = false; |
a75c81
|
603 |
$conf['services']['file'] = true; |
4ffb51
|
604 |
} else { |
F |
605 |
$conf['apache']['installed'] = false; |
|
606 |
} |
|
607 |
} |
b1a6a5
|
608 |
|
532ae5
|
609 |
//* Insert the Server record into the database |
L |
610 |
swriteln('Adding ISPConfig server record to database.'); |
|
611 |
swriteln(''); |
|
612 |
$inst->add_database_server_record(); |
|
613 |
|
b04e82
|
614 |
if(strtolower($inst->simple_query('Configure Mail', array('y', 'n') , 'y','configure_mail') ) == 'y') { |
b1a6a5
|
615 |
|
532ae5
|
616 |
$conf['services']['mail'] = true; |
b1a6a5
|
617 |
|
a75c81
|
618 |
//* Configure Postgrey |
FS |
619 |
$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey'); |
|
620 |
if($force) swriteln('Configuring Postgrey'); |
|
621 |
|
532ae5
|
622 |
//* Configure Postfix |
a75c81
|
623 |
$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix'); |
FS |
624 |
if($force) { |
|
625 |
swriteln('Configuring Postfix'); |
|
626 |
$inst->configure_postfix(); |
|
627 |
} |
b1a6a5
|
628 |
|
532ae5
|
629 |
//* Configure Mailman |
a75c81
|
630 |
$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman'); |
FS |
631 |
if($force) { |
|
632 |
swriteln('Configuring Mailman'); |
|
633 |
$inst->configure_mailman(); |
|
634 |
} |
532ae5
|
635 |
|
a75c81
|
636 |
//* Check for Dovecot and Courier |
FS |
637 |
if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { |
12ab95
|
638 |
$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot'); |
FS |
639 |
$conf['courier']['installed'] = $inst->force_configure_app('Courier'); |
a75c81
|
640 |
} |
FS |
641 |
//* Configure Mailserver - Dovecot or Courier |
|
642 |
if($conf['dovecot']['installed'] && $conf['courier']['installed']) { |
|
643 |
$mail_server_to_use = $inst->simple_query('Dovecot and Courier detected. Select server to use with ISPConfig:', array('dovecot', 'courier'), 'dovecot','mail_server'); |
|
644 |
if($mail_server_to_use == 'dovecot'){ |
|
645 |
$conf['courier']['installed'] = false; |
|
646 |
} else { |
|
647 |
$conf['dovecot']['installed'] = false; |
|
648 |
} |
|
649 |
} |
|
650 |
//* Configure Dovecot |
|
651 |
if($conf['dovecot']['installed']) { |
532ae5
|
652 |
swriteln('Configuring Dovecot'); |
L |
653 |
$inst->configure_dovecot(); |
a75c81
|
654 |
} |
FS |
655 |
//* Configure Courier |
|
656 |
if($conf['courier']['installed']) { |
532ae5
|
657 |
swriteln('Configuring Courier'); |
L |
658 |
$inst->configure_courier(); |
a75c81
|
659 |
swriteln('Configuring SASL'); |
FS |
660 |
$inst->configure_saslauthd(); |
|
661 |
swriteln('Configuring PAM'); |
|
662 |
$inst->configure_pam(); |
532ae5
|
663 |
} |
L |
664 |
|
|
665 |
//* Configure Spamasassin |
a75c81
|
666 |
$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin'); |
FS |
667 |
if($force) { |
|
668 |
swriteln('Configuring Spamassassin'); |
|
669 |
$inst->configure_spamassassin(); |
|
670 |
} |
|
671 |
|
532ae5
|
672 |
//* Configure Amavis |
a75c81
|
673 |
$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd'); |
FS |
674 |
if($force) { |
|
675 |
swriteln('Configuring Amavisd'); |
|
676 |
$inst->configure_amavis(); |
|
677 |
} |
532ae5
|
678 |
|
L |
679 |
//* Configure Getmail |
a75c81
|
680 |
$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail'); |
FS |
681 |
if($force) { |
|
682 |
swriteln('Configuring Getmail'); |
|
683 |
$inst->configure_getmail(); |
|
684 |
} |
b1a6a5
|
685 |
|
3327ed
|
686 |
if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
FT |
687 |
if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); |
|
688 |
if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); |
|
689 |
if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); |
|
690 |
if($conf['courier']['installed'] == true){ |
|
691 |
if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); |
|
692 |
if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); |
|
693 |
if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); |
|
694 |
if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); |
|
695 |
if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); |
|
696 |
} |
|
697 |
if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); |
|
698 |
if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); |
532ae5
|
699 |
} |
b1a6a5
|
700 |
|
a75c81
|
701 |
//* Configure Jailkit |
FS |
702 |
$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit'); |
|
703 |
if($force) { |
532ae5
|
704 |
swriteln('Configuring Jailkit'); |
L |
705 |
$inst->configure_jailkit(); |
|
706 |
} |
b1a6a5
|
707 |
|
a75c81
|
708 |
//* Configure Pureftpd |
FS |
709 |
$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd'); |
|
710 |
if($force) { |
532ae5
|
711 |
swriteln('Configuring Pureftpd'); |
L |
712 |
$inst->configure_pureftpd(); |
|
713 |
} |
d22277
|
714 |
|
532ae5
|
715 |
//** Configure DNS |
b04e82
|
716 |
if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') { |
532ae5
|
717 |
$conf['services']['dns'] = true; |
a75c81
|
718 |
|
FS |
719 |
//* Check for DNS |
|
720 |
if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
|
721 |
$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS'); |
|
722 |
$conf['bind']['installed'] = $inst->force_configure_app('BIND'); |
|
723 |
$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS'); |
|
724 |
} |
|
725 |
//* Configure PowerDNS |
|
726 |
if($conf['powerdns']['installed']) { |
532ae5
|
727 |
swriteln('Configuring PowerDNS'); |
L |
728 |
$inst->configure_powerdns(); |
a75c81
|
729 |
$conf['services']['dns'] = true; |
FS |
730 |
} |
|
731 |
//* Configure Bind |
|
732 |
if($conf['bind']['installed']) { |
532ae5
|
733 |
swriteln('Configuring BIND'); |
L |
734 |
$inst->configure_bind(); |
a75c81
|
735 |
$conf['services']['dns'] = true; |
57e982
|
736 |
if(!is_installed('haveged')) { |
ead7ad
|
737 |
swriteln("[INFO] haveged not detected - DNSSEC can fail"); |
FS |
738 |
} |
a75c81
|
739 |
} |
FS |
740 |
//* Configure MyDNS |
|
741 |
if($conf['mydns']['installed']) { |
532ae5
|
742 |
swriteln('Configuring MyDNS'); |
L |
743 |
$inst->configure_mydns(); |
a75c81
|
744 |
$conf['services']['dns'] = true; |
532ae5
|
745 |
} |
b1a6a5
|
746 |
|
532ae5
|
747 |
} |
b1a6a5
|
748 |
|
a75c81
|
749 |
if(strtolower($inst->simple_query('Configure Web Server', array('y', 'n'), 'y','configure_webserver')) == 'y') { |
FS |
750 |
$conf['services']['web'] = true; |
b1a6a5
|
751 |
|
a75c81
|
752 |
//* Configure Apache |
FS |
753 |
if($conf['apache']['installed']){ |
4ffb51
|
754 |
swriteln('Configuring Apache'); |
F |
755 |
$inst->configure_apache(); |
a75c81
|
756 |
$conf['services']['file'] = true; |
FS |
757 |
//* Configure Vlogger |
|
758 |
$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger'); |
|
759 |
if($force) { |
|
760 |
swriteln('Configuring vlogger'); |
|
761 |
$inst->configure_vlogger(); |
|
762 |
} |
|
763 |
//* Configure squid |
|
764 |
/* |
|
765 |
$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid'); |
|
766 |
if($force) { |
|
767 |
swriteln('Configuring Squid'); |
|
768 |
$inst->configure_squid(); |
|
769 |
$conf['services']['proxy'] = true; |
|
770 |
if($conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); |
|
771 |
} |
|
772 |
*/ |
4ffb51
|
773 |
} |
a75c81
|
774 |
//* Configure nginx |
FS |
775 |
if($conf['nginx']['installed']){ |
4ffb51
|
776 |
swriteln('Configuring nginx'); |
F |
777 |
$inst->configure_nginx(); |
|
778 |
} |
532ae5
|
779 |
} |
b1a6a5
|
780 |
|
319dd9
|
781 |
//* Configure OpenVZ |
FS |
782 |
$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ'); |
|
783 |
if($force) { |
|
784 |
$conf['services']['vserver'] = true; |
|
785 |
swriteln('Configuring OpenVZ'); |
|
786 |
} |
a75c81
|
787 |
|
b04e82
|
788 |
if(strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y','configure_firewall')) == 'y') { |
a75c81
|
789 |
//* Check for Firewall |
FS |
790 |
if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) { |
|
791 |
$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall'); |
|
792 |
$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall'); |
|
793 |
} |
|
794 |
//* Configure Firewall - Ubuntu or Bastille |
|
795 |
if($conf['ufw']['installed'] && $conf['firewall']['installed']) { |
|
796 |
$firewall_to_use = $inst->simple_query('Ubuntu and Bastille Firewall detected. Select firewall to use with ISPConfig:', array('bastille', 'ubuntu'), 'bastille','firewall_server'); |
|
797 |
if($firewall_to_use == 'bastille'){ |
|
798 |
$conf['ufw']['installed'] = false; |
|
799 |
} else { |
|
800 |
$conf['firewall']['installed'] = false; |
|
801 |
} |
|
802 |
} |
|
803 |
//* Configure Ubuntu Firewall |
|
804 |
if($conf['ufw']['installed']){ |
|
805 |
swriteln('Configuring Ubuntu Firewall'); |
|
806 |
$inst->configure_ufw_firewall(); |
|
807 |
$conf['services']['firewall'] = true; |
|
808 |
} |
|
809 |
//* Configure Bastille Firewall |
|
810 |
if($conf['firewall']['installed']){ |
|
811 |
swriteln('Configuring Bastille Firewall'); |
|
812 |
$inst->configure_bastille_firewall(); |
|
813 |
$conf['services']['firewall'] = true; |
|
814 |
} |
80e3c9
|
815 |
} |
b1a6a5
|
816 |
|
a75c81
|
817 |
//* Configure XMPP |
FS |
818 |
$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server'); |
|
819 |
if($force) { |
|
820 |
swriteln('Configuring Metronome XMPP Server'); |
|
821 |
$inst->configure_xmpp(); |
|
822 |
$conf['services']['xmpp'] = true; |
|
823 |
} |
9f94a1
|
824 |
|
532ae5
|
825 |
//** Configure ISPConfig :-) |
7b47c0
|
826 |
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y'; |
b04e82
|
827 |
if(strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') { |
532ae5
|
828 |
swriteln('Installing ISPConfig'); |
b1a6a5
|
829 |
|
532ae5
|
830 |
//** We want to check if the server is a module or cgi based php enabled server |
L |
831 |
//** TODO: Don't always ask for this somehow ? |
|
832 |
/* |
|
833 |
$fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no'); |
|
834 |
|
|
835 |
if($fast_cgi == 'yes') { |
|
836 |
$alias = $inst->free_query('Script Alias', '/php/'); |
|
837 |
$path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin'); |
|
838 |
$conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path); |
|
839 |
} else { |
|
840 |
$conf['apache']['vhost_cgi_alias'] = ""; |
|
841 |
} |
|
842 |
*/ |
|
843 |
|
|
844 |
//** Customise the port ISPConfig runs on |
b04e82
|
845 |
$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); |
55cb02
|
846 |
$conf['interface_password'] = $inst->free_query('Admin password', 'admin'); |
272da6
|
847 |
if($conf['interface_password'] != 'admin') { |
FS |
848 |
$check = false; |
|
849 |
do { |
|
850 |
unset($temp_password); |
480eba
|
851 |
$temp_password = $inst->free_query('Re-enter admin password', ''); |
272da6
|
852 |
$check = @($temp_password == $conf['interface_password'])?true:false; |
480eba
|
853 |
if(!$check) swriteln('Passwords do not match.'); |
272da6
|
854 |
} while (!$check); |
FS |
855 |
} |
|
856 |
unset($check); |
|
857 |
unset($temp_password); |
4ffb51
|
858 |
if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port; |
F |
859 |
if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port; |
|
860 |
unset($ispconfig_vhost_port); |
b1a6a5
|
861 |
|
b04e82
|
862 |
if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') { |
532ae5
|
863 |
$inst->make_ispconfig_ssl_cert(); |
L |
864 |
} |
b1a6a5
|
865 |
|
532ae5
|
866 |
$inst->install_ispconfig_interface = true; |
b1a6a5
|
867 |
|
532ae5
|
868 |
} else { |
L |
869 |
$inst->install_ispconfig_interface = false; |
|
870 |
} |
b1a6a5
|
871 |
|
532ae5
|
872 |
$inst->install_ispconfig(); |
b1a6a5
|
873 |
|
532ae5
|
874 |
//* Configure DBServer |
L |
875 |
swriteln('Configuring DBServer'); |
|
876 |
$inst->configure_dbserver(); |
b1a6a5
|
877 |
|
532ae5
|
878 |
//* Configure ISPConfig |
L |
879 |
swriteln('Installing ISPConfig crontab'); |
|
880 |
$inst->install_crontab(); |
33bcd0
|
881 |
if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); |
4ffb51
|
882 |
//* Reload is enough for nginx |
F |
883 |
if($conf['nginx']['installed'] == true){ |
33bcd0
|
884 |
if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
FT |
885 |
if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
4ffb51
|
886 |
} |
d22277
|
887 |
|
MB |
888 |
swriteln('Detect IP addresses'); |
|
889 |
$inst->detect_ips(); |
b1a6a5
|
890 |
|
MC |
891 |
|
|
892 |
|
532ae5
|
893 |
} //* << $install_mode / 'Standard' or Genius |
L |
894 |
|
d5f2d5
|
895 |
$inst->create_mount_script(); |
MC |
896 |
|
1ed92e
|
897 |
//* Create md5 filelist |
TB |
898 |
$md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5'; |
|
899 |
exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename); |
|
900 |
chmod($md5_filename,0700); |
|
901 |
|
532ae5
|
902 |
|
L |
903 |
echo "Installation completed.\n"; |
|
904 |
|
|
905 |
|
bedf79
|
906 |
?> |