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')); |
|
118 |
$autoinstall = $tmp['install'] + $tmp['ssl_cert'] + $tmp['expert'] + $tmp['update']; |
|
119 |
unset($tmp); |
|
120 |
} |
|
121 |
unset($path_parts); |
|
122 |
define('AUTOINSTALL', true); |
|
123 |
} else { |
|
124 |
$autoinstall = array(); |
|
125 |
define('AUTOINSTALL', false); |
|
126 |
} |
|
127 |
|
bcd725
|
128 |
|
532ae5
|
129 |
//** Include the distribution-specific installer class library and configuration |
b1a6a5
|
130 |
if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php'; |
MC |
131 |
include_once 'dist/lib/'.$dist['id'].'.lib.php'; |
|
132 |
include_once 'dist/conf/'.$dist['id'].'.conf.php'; |
532ae5
|
133 |
|
L |
134 |
//**************************************************************************************************** |
b1a6a5
|
135 |
//** Installer Interface |
532ae5
|
136 |
//**************************************************************************************************** |
L |
137 |
$inst = new installer(); |
60b700
|
138 |
|
532ae5
|
139 |
swriteln($inst->lng(' Following will be a few questions for primary configuration so be careful.')); |
L |
140 |
swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.')); |
|
141 |
swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n")); |
|
142 |
|
|
143 |
//** Check log file is writable (probably not root or sudo) |
|
144 |
if(!is_writable(dirname(ISPC_LOG_FILE))){ |
b1a6a5
|
145 |
die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n"); |
532ae5
|
146 |
} |
L |
147 |
|
|
148 |
if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { |
|
149 |
die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); |
|
150 |
} |
|
151 |
|
|
152 |
if(is_dir('/usr/local/ispconfig')) { |
|
153 |
die('ISPConfig 3 installation found. Please use update.php instead if install.php to update the installation.'); |
|
154 |
} |
|
155 |
|
|
156 |
//** Detect the installed applications |
|
157 |
$inst->find_installed_apps(); |
|
158 |
|
8cf78b
|
159 |
//** Select the language and set default timezone |
b04e82
|
160 |
$conf['language'] = $inst->simple_query('Select language', array('en', 'de'), 'en','language'); |
3898c9
|
161 |
$conf['timezone'] = get_system_timezone(); |
532ae5
|
162 |
|
992797
|
163 |
//* Set default theme |
f598b0
|
164 |
$conf['theme'] = 'default'; |
992797
|
165 |
$conf['language_file_import_enabled'] = true; |
f598b0
|
166 |
|
532ae5
|
167 |
//** Select installation mode |
b04e82
|
168 |
$install_mode = $inst->simple_query('Installation mode', array('standard', 'expert'), 'standard','install_mode'); |
532ae5
|
169 |
|
L |
170 |
|
|
171 |
//** Get the hostname |
|
172 |
$tmp_out = array(); |
|
173 |
exec('hostname -f', $tmp_out); |
5a56e6
|
174 |
$conf['hostname'] = @$tmp_out[0]; |
7eade0
|
175 |
unset($tmp_out); |
bb690d
|
176 |
//** Prevent empty hostname |
FS |
177 |
$check = false; |
|
178 |
do { |
|
179 |
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $conf['hostname'], 'hostname'); |
|
180 |
$conf['hostname']=trim($conf['hostname']); |
|
181 |
$check = @($conf['hostname'] !== '')?true:false; |
|
182 |
if(!$check) swriteln('Hostname may not be empty.'); |
|
183 |
} while (!$check); |
ee405d
|
184 |
|
532ae5
|
185 |
// Check if the mysql functions are loaded in PHP |
L |
186 |
if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.'); |
|
187 |
|
|
188 |
//** Get MySQL root credentials |
|
189 |
$finished = false; |
|
190 |
do { |
b04e82
|
191 |
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host'],'mysql_hostname'); |
82e9b9
|
192 |
$tmp_mysql_server_port = $inst->free_query('MySQL server port', $conf['mysql']['port'],'mysql_port'); |
b04e82
|
193 |
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user'],'mysql_root_user'); |
TB |
194 |
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password'); |
|
195 |
$tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database'],'mysql_database'); |
|
196 |
$tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset'],'mysql_charset'); |
bcd725
|
197 |
|
8cf78b
|
198 |
if($install_mode == 'expert') { |
T |
199 |
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
|
200 |
|
b04e82
|
201 |
$conf['mysql']['ispconfig_user'] = $inst->free_query('ISPConfig mysql database username', $conf['mysql']['ispconfig_user'],'mysql_ispconfig_user'); |
TB |
202 |
$conf['mysql']['ispconfig_password'] = $inst->free_query('ISPConfig mysql database password', $conf['mysql']['ispconfig_password'],'mysql_ispconfig_password'); |
8cf78b
|
203 |
} |
b1a6a5
|
204 |
|
532ae5
|
205 |
//* Initialize the MySQL server connection |
7de1b7
|
206 |
if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
532ae5
|
207 |
$conf['mysql']['host'] = $tmp_mysql_server_host; |
82e9b9
|
208 |
$conf['mysql']['port'] = $tmp_mysql_server_port; |
532ae5
|
209 |
$conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; |
L |
210 |
$conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password; |
|
211 |
$conf['mysql']['database'] = $tmp_mysql_server_database; |
|
212 |
$conf['mysql']['charset'] = $tmp_mysql_server_charset; |
|
213 |
$finished = true; |
|
214 |
} else { |
|
215 |
swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysql_error()); |
|
216 |
} |
|
217 |
} while ($finished == false); |
|
218 |
unset($finished); |
|
219 |
|
|
220 |
// Resolve the IP address of the MySQL hostname. |
b1a6a5
|
221 |
$tmp = explode(':', $conf['mysql']['host']); |
532ae5
|
222 |
if(!$conf['mysql']['ip'] = gethostbyname($tmp[0])) die('Unable to resolve hostname'.$tmp[0]); |
L |
223 |
unset($tmp); |
|
224 |
|
|
225 |
|
|
226 |
//** Initializing database connection |
b1a6a5
|
227 |
include_once 'lib/mysql.lib.php'; |
532ae5
|
228 |
$inst->db = new db(); |
L |
229 |
|
|
230 |
//** Begin with standard or expert installation |
a75c81
|
231 |
|
FS |
232 |
$conf['services']['mail'] = false; |
|
233 |
$conf['services']['web'] = false; |
|
234 |
$conf['services']['dns'] = false; |
|
235 |
$conf['services']['file'] = false; |
|
236 |
$conf['services']['db'] = true; |
|
237 |
$conf['services']['vserver'] = false; |
|
238 |
$conf['services']['firewall'] = false; |
|
239 |
$conf['services']['proxy'] = false; |
|
240 |
$conf['services']['xmpp'] = false; |
|
241 |
|
532ae5
|
242 |
if($install_mode == 'standard') { |
b1a6a5
|
243 |
|
532ae5
|
244 |
//* Create the MySQL database |
L |
245 |
$inst->configure_database(); |
b1a6a5
|
246 |
|
a75c81
|
247 |
//* Insert the Server record into the database |
FS |
248 |
$inst->add_database_server_record(); |
|
249 |
|
|
250 |
//* Configure Postgrey |
bedf79
|
251 |
$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey', false); |
a75c81
|
252 |
if($force) swriteln('Configuring Postgrey'); |
FS |
253 |
|
|
254 |
//* Configure Postfix |
bedf79
|
255 |
$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix', false); |
a75c81
|
256 |
if($force) { |
FS |
257 |
swriteln('Configuring Postfix'); |
|
258 |
$inst->configure_postfix(); |
|
259 |
$conf['services']['mail'] = true; |
|
260 |
} |
|
261 |
|
|
262 |
if($conf['services']['mail']) { |
|
263 |
|
|
264 |
//* Configure Mailman |
bedf79
|
265 |
$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', false); |
a75c81
|
266 |
if($force) { |
FS |
267 |
swriteln('Configuring Mailman'); |
|
268 |
$inst->configure_mailman(); |
|
269 |
} |
|
270 |
|
|
271 |
//* Check for Dovecot and Courier |
|
272 |
if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { |
bedf79
|
273 |
$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', false); |
FS |
274 |
$conf['courier']['installed'] = $inst->force_configure_app('Courier', false); |
a75c81
|
275 |
} |
FS |
276 |
//* Configure Mailserver - Dovecot or Courier |
|
277 |
if($conf['dovecot']['installed'] && $conf['courier']['installed']) { |
|
278 |
$mail_server_to_use = $inst->simple_query('Dovecot and Courier detected. Select server to use with ISPConfig:', array('dovecot', 'courier'), 'dovecot','mail_server'); |
|
279 |
if($mail_server_to_use == 'dovecot'){ |
|
280 |
$conf['courier']['installed'] = false; |
|
281 |
} else { |
|
282 |
$conf['dovecot']['installed'] = false; |
|
283 |
} |
|
284 |
} |
|
285 |
//* Configure Dovecot |
|
286 |
if($conf['dovecot']['installed']) { |
|
287 |
swriteln('Configuring Dovecot'); |
|
288 |
$inst->configure_dovecot(); |
|
289 |
} |
|
290 |
//* Configure Courier |
|
291 |
if($conf['courier']['installed']) { |
|
292 |
swriteln('Configuring Courier'); |
|
293 |
$inst->configure_courier(); |
|
294 |
swriteln('Configuring SASL'); |
|
295 |
$inst->configure_saslauthd(); |
|
296 |
swriteln('Configuring PAM'); |
|
297 |
$inst->configure_pam(); |
|
298 |
} |
|
299 |
|
|
300 |
//* Configure Spamasassin |
bedf79
|
301 |
$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', false); |
a75c81
|
302 |
if($force) { |
FS |
303 |
swriteln('Configuring Spamassassin'); |
|
304 |
$inst->configure_spamassassin(); |
|
305 |
} |
|
306 |
|
|
307 |
//* Configure Amavis |
bedf79
|
308 |
$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd', false); |
a75c81
|
309 |
if($force) { |
FS |
310 |
swriteln('Configuring Amavisd'); |
|
311 |
$inst->configure_amavis(); |
|
312 |
} |
|
313 |
|
|
314 |
//* Configure Getmail |
bedf79
|
315 |
$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', false); |
a75c81
|
316 |
if($force) { |
FS |
317 |
swriteln('Configuring Getmail'); |
|
318 |
$inst->configure_getmail(); |
|
319 |
} |
|
320 |
|
|
321 |
} else swriteln('[ERROR] Postfix not installed - skipping Mail'); |
|
322 |
|
|
323 |
//* Check for DNS |
|
324 |
if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
bedf79
|
325 |
$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', false); |
FS |
326 |
$conf['bind']['installed'] = $inst->force_configure_app('BIND', false); |
|
327 |
$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS', false); |
a75c81
|
328 |
} |
FS |
329 |
//* Configure PowerDNS |
|
330 |
if($conf['powerdns']['installed']) { |
|
331 |
swriteln('Configuring PowerDNS'); |
|
332 |
$inst->configure_powerdns(); |
|
333 |
$conf['services']['dns'] = true; |
|
334 |
} |
|
335 |
//* Configure Bind |
|
336 |
if($conf['bind']['installed']) { |
|
337 |
swriteln('Configuring BIND'); |
|
338 |
$inst->configure_bind(); |
|
339 |
$conf['services']['dns'] = true; |
|
340 |
} |
|
341 |
//* Configure MyDNS |
|
342 |
if($conf['mydns']['installed']) { |
|
343 |
swriteln('Configuring MyDNS'); |
|
344 |
$inst->configure_mydns(); |
|
345 |
$conf['services']['dns'] = true; |
|
346 |
} |
|
347 |
|
|
348 |
//* Configure Jailkit |
bedf79
|
349 |
$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit', false); |
a75c81
|
350 |
if($force) { |
FS |
351 |
swriteln('Configuring Jailkit'); |
|
352 |
$inst->configure_jailkit(); |
|
353 |
} |
|
354 |
|
|
355 |
//* Configure Pureftpd |
bedf79
|
356 |
$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd', false); |
a75c81
|
357 |
if($force) { |
FS |
358 |
swriteln('Configuring Pureftpd'); |
|
359 |
$inst->configure_pureftpd(); |
|
360 |
} |
|
361 |
|
|
362 |
//* Check for Web-Server |
|
363 |
if(!$conf['apache']['installed'] && !$conf['nginx']['installed']) { |
bedf79
|
364 |
$conf['apache']['installed'] = $inst->force_configure_app('Apache', false); |
FS |
365 |
$conf['nginx']['installed'] = $inst->force_configure_app('nginx', false); |
a75c81
|
366 |
} |
FS |
367 |
|
4ffb51
|
368 |
//* Configure Webserver - Apache or nginx |
a75c81
|
369 |
if($conf['apache']['installed'] && $conf['nginx']['installed']) { |
b04e82
|
370 |
$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server'); |
4ffb51
|
371 |
if($http_server_to_use == 'apache'){ |
F |
372 |
$conf['nginx']['installed'] = false; |
|
373 |
} else { |
|
374 |
$conf['apache']['installed'] = false; |
|
375 |
} |
|
376 |
} |
b1a6a5
|
377 |
|
532ae5
|
378 |
//* Configure Apache |
a75c81
|
379 |
if($conf['apache']['installed']){ |
4ffb51
|
380 |
swriteln('Configuring Apache'); |
F |
381 |
$inst->configure_apache(); |
a75c81
|
382 |
$conf['services']['web'] = true; |
FS |
383 |
$conf['services']['file'] = true; |
|
384 |
//* Configure Vlogger |
bedf79
|
385 |
$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger', false); |
a75c81
|
386 |
if($force) { |
FS |
387 |
swriteln('Configuring vlogger'); |
|
388 |
$inst->configure_vlogger(); |
|
389 |
} |
|
390 |
//* Configure squid |
|
391 |
/* |
|
392 |
$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid'); |
|
393 |
if($force) { |
|
394 |
swriteln('Configuring Squid'); |
|
395 |
$inst->configure_squid(); |
|
396 |
$conf['services']['proxy'] = true; |
|
397 |
} |
|
398 |
*/ |
4ffb51
|
399 |
} |
b1a6a5
|
400 |
|
4ffb51
|
401 |
//* Configure nginx |
a75c81
|
402 |
if($conf['nginx']['installed']){ |
4ffb51
|
403 |
swriteln('Configuring nginx'); |
F |
404 |
$inst->configure_nginx(); |
a75c81
|
405 |
$conf['services']['web'] = true; |
4ffb51
|
406 |
} |
b1a6a5
|
407 |
|
a75c81
|
408 |
//* Configure XMPP |
bedf79
|
409 |
$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server', false); |
a75c81
|
410 |
if($force) { |
FS |
411 |
swriteln('Configuring Metronome XMPP Server'); |
|
412 |
$inst->configure_xmpp(); |
|
413 |
$conf['services']['xmpp'] = true; |
|
414 |
} |
b1a6a5
|
415 |
|
a75c81
|
416 |
//* Check for Firewall |
FS |
417 |
if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) { |
bedf79
|
418 |
$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall', false); |
FS |
419 |
$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall', false); |
a75c81
|
420 |
} |
FS |
421 |
//* Configure Firewall - Ubuntu or Bastille |
|
422 |
if($conf['ufw']['installed'] && $conf['firewall']['installed']) { |
|
423 |
$firewall_to_use = $inst->simple_query('Ubuntu and Bastille Firewall detected. Select firewall to use with ISPConfig:', array('bastille', 'ubuntu'), 'bastille','firewall_server'); |
|
424 |
if($firewall_to_use == 'bastille'){ |
|
425 |
$conf['ufw']['installed'] = false; |
|
426 |
} else { |
|
427 |
$conf['firewall']['installed'] = false; |
|
428 |
} |
|
429 |
} |
|
430 |
//* Configure Ubuntu Firewall |
|
431 |
if($conf['ufw']['installed']){ |
bd68aa
|
432 |
swriteln('Configuring Ubuntu Firewall'); |
MC |
433 |
$inst->configure_ufw_firewall(); |
|
434 |
$conf['services']['firewall'] = true; |
a75c81
|
435 |
} |
FS |
436 |
//* Configure Bastille Firewall |
|
437 |
if($conf['firewall']['installed']){ |
bd68aa
|
438 |
swriteln('Configuring Bastille Firewall'); |
MC |
439 |
$inst->configure_bastille_firewall(); |
a75c81
|
440 |
$conf['services']['firewall'] = true; |
bd68aa
|
441 |
} |
c12af9
|
442 |
|
b1a6a5
|
443 |
//* Configure Fail2ban |
bedf79
|
444 |
$force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', false); |
a75c81
|
445 |
if($force) { |
b1a6a5
|
446 |
swriteln('Configuring Fail2ban'); |
MC |
447 |
$inst->configure_fail2ban(); |
|
448 |
} |
|
449 |
|
a75c81
|
450 |
//* Configure OpenVZ |
bedf79
|
451 |
$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', false); |
a75c81
|
452 |
if($force) { |
FS |
453 |
$conf['services']['vserver'] = true; |
|
454 |
swriteln('Configuring OpenVZ'); |
80e3c9
|
455 |
} |
b1a6a5
|
456 |
|
a75c81
|
457 |
//** Configure apps vhost |
FS |
458 |
swriteln('Configuring Apps vhost'); |
|
459 |
$inst->configure_apps_vhost(); |
9f94a1
|
460 |
|
532ae5
|
461 |
//* Configure ISPConfig |
L |
462 |
swriteln('Installing ISPConfig'); |
b1a6a5
|
463 |
|
532ae5
|
464 |
//** Customize the port ISPConfig runs on |
b04e82
|
465 |
$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); |
55cb02
|
466 |
$conf['interface_password'] = $inst->free_query('Admin password', 'admin'); |
272da6
|
467 |
if($conf['interface_password'] != 'admin') { |
FS |
468 |
$check = false; |
|
469 |
do { |
|
470 |
unset($temp_password); |
480eba
|
471 |
$temp_password = $inst->free_query('Re-enter admin password', ''); |
272da6
|
472 |
$check = @($temp_password == $conf['interface_password'])?true:false; |
480eba
|
473 |
if(!$check) swriteln('Passwords do not match.'); |
272da6
|
474 |
} while (!$check); |
FS |
475 |
} |
|
476 |
unset($check); |
|
477 |
unset($temp_password); |
dec0df
|
478 |
if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port; |
T |
479 |
if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port; |
|
480 |
unset($ispconfig_vhost_port); |
532ae5
|
481 |
|
b04e82
|
482 |
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
|
483 |
$inst->make_ispconfig_ssl_cert(); |
939b92
|
484 |
} |
M |
485 |
|
532ae5
|
486 |
$inst->install_ispconfig(); |
b1a6a5
|
487 |
|
532ae5
|
488 |
//* Configure DBServer |
L |
489 |
swriteln('Configuring DBServer'); |
|
490 |
$inst->configure_dbserver(); |
|
491 |
|
|
492 |
//* Configure ISPConfig |
a75c81
|
493 |
if($conf['cron']['installed']) { |
FS |
494 |
swriteln('Installing ISPConfig crontab'); |
|
495 |
$inst->install_crontab(); |
|
496 |
} else swriteln('[ERROR] Cron not found'); |
b1a6a5
|
497 |
|
532ae5
|
498 |
swriteln('Restarting services ...'); |
574a16
|
499 |
if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); |
3327ed
|
500 |
if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
FT |
501 |
if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); |
|
502 |
if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); |
|
503 |
if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); |
|
504 |
if($conf['courier']['installed'] == true){ |
|
505 |
if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); |
|
506 |
if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); |
|
507 |
if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); |
|
508 |
if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); |
|
509 |
if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); |
|
510 |
} |
|
511 |
if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); |
|
512 |
if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); |
33bcd0
|
513 |
if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); |
4ffb51
|
514 |
//* Reload is enough for nginx |
F |
515 |
if($conf['nginx']['installed'] == true){ |
33bcd0
|
516 |
if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
FT |
517 |
if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
4ffb51
|
518 |
} |
3327ed
|
519 |
if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart')); |
33bcd0
|
520 |
if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null'); |
FT |
521 |
if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null'); |
|
522 |
if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null'); |
b1a6a5
|
523 |
//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
|
524 |
if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); |
7cf3e9
|
525 |
if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null'); |
9f94a1
|
526 |
if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null'); |
b1a6a5
|
527 |
|
a75c81
|
528 |
} else { //* expert mode |
b1a6a5
|
529 |
|
532ae5
|
530 |
//** Get Server ID |
L |
531 |
// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1'); |
|
532 |
// Server ID is an autoInc value of the mysql database now |
b04e82
|
533 |
if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup', array('y', 'n'), 'n','join_multiserver_setup')) == 'y') { |
532ae5
|
534 |
$conf['mysql']['master_slave_setup'] = 'y'; |
b1a6a5
|
535 |
|
532ae5
|
536 |
//** Get MySQL root credentials |
L |
537 |
$finished = false; |
|
538 |
do { |
b04e82
|
539 |
$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); |
82e9b9
|
540 |
$tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); |
b04e82
|
541 |
$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); |
TB |
542 |
$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); |
|
543 |
$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); |
b1a6a5
|
544 |
|
532ae5
|
545 |
//* Initialize the MySQL server connection |
7de1b7
|
546 |
if(@mysql_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
532ae5
|
547 |
$conf['mysql']['master_host'] = $tmp_mysql_server_host; |
82e9b9
|
548 |
$conf['mysql']['master_port'] = $tmp_mysql_server_port; |
532ae5
|
549 |
$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; |
L |
550 |
$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; |
|
551 |
$conf['mysql']['master_database'] = $tmp_mysql_server_database; |
|
552 |
$finished = true; |
|
553 |
} else { |
|
554 |
swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); |
|
555 |
} |
|
556 |
} while ($finished == false); |
|
557 |
unset($finished); |
b1a6a5
|
558 |
|
532ae5
|
559 |
// initialize the connection to the master database |
L |
560 |
$inst->dbmaster = new db(); |
|
561 |
if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); |
305dda
|
562 |
$inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]); |
MC |
563 |
$inst->dbmaster->setDBName($conf['mysql']["master_database"]); |
b1a6a5
|
564 |
|
532ae5
|
565 |
} else { |
L |
566 |
// the master DB is the same then the slave DB |
|
567 |
$inst->dbmaster = $inst->db; |
|
568 |
} |
b1a6a5
|
569 |
|
532ae5
|
570 |
//* Create the mysql database |
L |
571 |
$inst->configure_database(); |
b1a6a5
|
572 |
|
a75c81
|
573 |
//* Check for Web-Server |
FS |
574 |
if($conf['apache']['installed'] != true && $conf['nginx']['installed'] != true) { |
|
575 |
$conf['apache']['installed'] = $inst->force_configure_app('Apache'); |
|
576 |
$conf['nginx']['installed'] = $inst->force_configure_app('nginx'); |
|
577 |
} |
4ffb51
|
578 |
//* Configure Webserver - Apache or nginx |
F |
579 |
if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) { |
b04e82
|
580 |
$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache','http_server'); |
4ffb51
|
581 |
if($http_server_to_use == 'apache'){ |
F |
582 |
$conf['nginx']['installed'] = false; |
a75c81
|
583 |
$conf['services']['file'] = true; |
4ffb51
|
584 |
} else { |
F |
585 |
$conf['apache']['installed'] = false; |
|
586 |
} |
|
587 |
} |
b1a6a5
|
588 |
|
532ae5
|
589 |
//* Insert the Server record into the database |
L |
590 |
swriteln('Adding ISPConfig server record to database.'); |
|
591 |
swriteln(''); |
|
592 |
$inst->add_database_server_record(); |
|
593 |
|
b04e82
|
594 |
if(strtolower($inst->simple_query('Configure Mail', array('y', 'n') , 'y','configure_mail') ) == 'y') { |
b1a6a5
|
595 |
|
532ae5
|
596 |
$conf['services']['mail'] = true; |
b1a6a5
|
597 |
|
a75c81
|
598 |
//* Configure Postgrey |
FS |
599 |
$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey'); |
|
600 |
if($force) swriteln('Configuring Postgrey'); |
|
601 |
|
532ae5
|
602 |
//* Configure Postfix |
a75c81
|
603 |
$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix'); |
FS |
604 |
if($force) { |
|
605 |
swriteln('Configuring Postfix'); |
|
606 |
$inst->configure_postfix(); |
|
607 |
} |
b1a6a5
|
608 |
|
532ae5
|
609 |
//* Configure Mailman |
a75c81
|
610 |
$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman'); |
FS |
611 |
if($force) { |
|
612 |
swriteln('Configuring Mailman'); |
|
613 |
$inst->configure_mailman(); |
|
614 |
} |
532ae5
|
615 |
|
a75c81
|
616 |
//* Check for Dovecot and Courier |
FS |
617 |
if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) { |
12ab95
|
618 |
$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot'); |
FS |
619 |
$conf['courier']['installed'] = $inst->force_configure_app('Courier'); |
a75c81
|
620 |
} |
FS |
621 |
//* Configure Mailserver - Dovecot or Courier |
|
622 |
if($conf['dovecot']['installed'] && $conf['courier']['installed']) { |
|
623 |
$mail_server_to_use = $inst->simple_query('Dovecot and Courier detected. Select server to use with ISPConfig:', array('dovecot', 'courier'), 'dovecot','mail_server'); |
|
624 |
if($mail_server_to_use == 'dovecot'){ |
|
625 |
$conf['courier']['installed'] = false; |
|
626 |
} else { |
|
627 |
$conf['dovecot']['installed'] = false; |
|
628 |
} |
|
629 |
} |
|
630 |
//* Configure Dovecot |
|
631 |
if($conf['dovecot']['installed']) { |
532ae5
|
632 |
swriteln('Configuring Dovecot'); |
L |
633 |
$inst->configure_dovecot(); |
a75c81
|
634 |
} |
FS |
635 |
//* Configure Courier |
|
636 |
if($conf['courier']['installed']) { |
532ae5
|
637 |
swriteln('Configuring Courier'); |
L |
638 |
$inst->configure_courier(); |
a75c81
|
639 |
swriteln('Configuring SASL'); |
FS |
640 |
$inst->configure_saslauthd(); |
|
641 |
swriteln('Configuring PAM'); |
|
642 |
$inst->configure_pam(); |
532ae5
|
643 |
} |
L |
644 |
|
|
645 |
//* Configure Spamasassin |
a75c81
|
646 |
$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin'); |
FS |
647 |
if($force) { |
|
648 |
swriteln('Configuring Spamassassin'); |
|
649 |
$inst->configure_spamassassin(); |
|
650 |
} |
|
651 |
|
532ae5
|
652 |
//* Configure Amavis |
a75c81
|
653 |
$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd'); |
FS |
654 |
if($force) { |
|
655 |
swriteln('Configuring Amavisd'); |
|
656 |
$inst->configure_amavis(); |
|
657 |
} |
532ae5
|
658 |
|
L |
659 |
//* Configure Getmail |
a75c81
|
660 |
$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail'); |
FS |
661 |
if($force) { |
|
662 |
swriteln('Configuring Getmail'); |
|
663 |
$inst->configure_getmail(); |
|
664 |
} |
b1a6a5
|
665 |
|
3327ed
|
666 |
if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
FT |
667 |
if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); |
|
668 |
if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); |
|
669 |
if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); |
|
670 |
if($conf['courier']['installed'] == true){ |
|
671 |
if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); |
|
672 |
if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); |
|
673 |
if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); |
|
674 |
if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); |
|
675 |
if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); |
|
676 |
} |
|
677 |
if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); |
|
678 |
if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); |
532ae5
|
679 |
} |
b1a6a5
|
680 |
|
a75c81
|
681 |
//* Configure Jailkit |
FS |
682 |
$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit'); |
|
683 |
if($force) { |
532ae5
|
684 |
swriteln('Configuring Jailkit'); |
L |
685 |
$inst->configure_jailkit(); |
|
686 |
} |
b1a6a5
|
687 |
|
a75c81
|
688 |
//* Configure Pureftpd |
FS |
689 |
$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd'); |
|
690 |
if($force) { |
532ae5
|
691 |
swriteln('Configuring Pureftpd'); |
L |
692 |
$inst->configure_pureftpd(); |
|
693 |
} |
b1a6a5
|
694 |
|
532ae5
|
695 |
//** Configure DNS |
b04e82
|
696 |
if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y','configure_dns')) == 'y') { |
532ae5
|
697 |
$conf['services']['dns'] = true; |
a75c81
|
698 |
|
FS |
699 |
//* Check for DNS |
|
700 |
if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) { |
|
701 |
$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS'); |
|
702 |
$conf['bind']['installed'] = $inst->force_configure_app('BIND'); |
|
703 |
$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS'); |
|
704 |
} |
|
705 |
//* Configure PowerDNS |
|
706 |
if($conf['powerdns']['installed']) { |
532ae5
|
707 |
swriteln('Configuring PowerDNS'); |
L |
708 |
$inst->configure_powerdns(); |
a75c81
|
709 |
$conf['services']['dns'] = true; |
FS |
710 |
} |
|
711 |
//* Configure Bind |
|
712 |
if($conf['bind']['installed']) { |
532ae5
|
713 |
swriteln('Configuring BIND'); |
L |
714 |
$inst->configure_bind(); |
a75c81
|
715 |
$conf['services']['dns'] = true; |
FS |
716 |
} |
|
717 |
//* Configure MyDNS |
|
718 |
if($conf['mydns']['installed']) { |
532ae5
|
719 |
swriteln('Configuring MyDNS'); |
L |
720 |
$inst->configure_mydns(); |
a75c81
|
721 |
$conf['services']['dns'] = true; |
532ae5
|
722 |
} |
b1a6a5
|
723 |
|
532ae5
|
724 |
} |
b1a6a5
|
725 |
|
a75c81
|
726 |
if(strtolower($inst->simple_query('Configure Web Server', array('y', 'n'), 'y','configure_webserver')) == 'y') { |
FS |
727 |
$conf['services']['web'] = true; |
b1a6a5
|
728 |
|
a75c81
|
729 |
//* Configure Apache |
FS |
730 |
if($conf['apache']['installed']){ |
4ffb51
|
731 |
swriteln('Configuring Apache'); |
F |
732 |
$inst->configure_apache(); |
a75c81
|
733 |
$conf['services']['file'] = true; |
FS |
734 |
//* Configure Vlogger |
|
735 |
$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger'); |
|
736 |
if($force) { |
|
737 |
swriteln('Configuring vlogger'); |
|
738 |
$inst->configure_vlogger(); |
|
739 |
} |
|
740 |
//* Configure squid |
|
741 |
/* |
|
742 |
$force = @($conf['squid']['installed']) ? true : $inst->force_configure_app('squid'); |
|
743 |
if($force) { |
|
744 |
swriteln('Configuring Squid'); |
|
745 |
$inst->configure_squid(); |
|
746 |
$conf['services']['proxy'] = true; |
|
747 |
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'); |
|
748 |
} |
|
749 |
*/ |
4ffb51
|
750 |
} |
a75c81
|
751 |
//* Configure nginx |
FS |
752 |
if($conf['nginx']['installed']){ |
4ffb51
|
753 |
swriteln('Configuring nginx'); |
F |
754 |
$inst->configure_nginx(); |
|
755 |
} |
532ae5
|
756 |
} |
b1a6a5
|
757 |
|
a75c81
|
758 |
if($conf['openvz']['installed'] = true && strtolower($inst->simple_query('Enable Openvz-Server', array('y', 'n'), 'y','configure_openvz')) == 'y') |
FS |
759 |
$conf['services']['vserver'] = true; |
|
760 |
|
b04e82
|
761 |
if(strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y','configure_firewall')) == 'y') { |
a75c81
|
762 |
//* Check for Firewall |
FS |
763 |
if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) { |
|
764 |
$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall'); |
|
765 |
$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall'); |
|
766 |
} |
|
767 |
//* Configure Firewall - Ubuntu or Bastille |
|
768 |
if($conf['ufw']['installed'] && $conf['firewall']['installed']) { |
|
769 |
$firewall_to_use = $inst->simple_query('Ubuntu and Bastille Firewall detected. Select firewall to use with ISPConfig:', array('bastille', 'ubuntu'), 'bastille','firewall_server'); |
|
770 |
if($firewall_to_use == 'bastille'){ |
|
771 |
$conf['ufw']['installed'] = false; |
|
772 |
} else { |
|
773 |
$conf['firewall']['installed'] = false; |
|
774 |
} |
|
775 |
} |
|
776 |
//* Configure Ubuntu Firewall |
|
777 |
if($conf['ufw']['installed']){ |
|
778 |
swriteln('Configuring Ubuntu Firewall'); |
|
779 |
$inst->configure_ufw_firewall(); |
|
780 |
$conf['services']['firewall'] = true; |
|
781 |
} |
|
782 |
//* Configure Bastille Firewall |
|
783 |
if($conf['firewall']['installed']){ |
|
784 |
swriteln('Configuring Bastille Firewall'); |
|
785 |
$inst->configure_bastille_firewall(); |
|
786 |
$conf['services']['firewall'] = true; |
|
787 |
} |
80e3c9
|
788 |
} |
b1a6a5
|
789 |
|
a75c81
|
790 |
//* Configure XMPP |
FS |
791 |
$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server'); |
|
792 |
if($force) { |
|
793 |
swriteln('Configuring Metronome XMPP Server'); |
|
794 |
$inst->configure_xmpp(); |
|
795 |
$conf['services']['xmpp'] = true; |
|
796 |
} |
9f94a1
|
797 |
|
532ae5
|
798 |
//** Configure ISPConfig :-) |
7b47c0
|
799 |
$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y'; |
b04e82
|
800 |
if(strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') { |
532ae5
|
801 |
swriteln('Installing ISPConfig'); |
b1a6a5
|
802 |
|
532ae5
|
803 |
//** We want to check if the server is a module or cgi based php enabled server |
L |
804 |
//** TODO: Don't always ask for this somehow ? |
|
805 |
/* |
|
806 |
$fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no'); |
|
807 |
|
|
808 |
if($fast_cgi == 'yes') { |
|
809 |
$alias = $inst->free_query('Script Alias', '/php/'); |
|
810 |
$path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin'); |
|
811 |
$conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path); |
|
812 |
} else { |
|
813 |
$conf['apache']['vhost_cgi_alias'] = ""; |
|
814 |
} |
|
815 |
*/ |
|
816 |
|
|
817 |
//** Customise the port ISPConfig runs on |
b04e82
|
818 |
$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); |
55cb02
|
819 |
$conf['interface_password'] = $inst->free_query('Admin password', 'admin'); |
272da6
|
820 |
if($conf['interface_password'] != 'admin') { |
FS |
821 |
$check = false; |
|
822 |
do { |
|
823 |
unset($temp_password); |
480eba
|
824 |
$temp_password = $inst->free_query('Re-enter admin password', ''); |
272da6
|
825 |
$check = @($temp_password == $conf['interface_password'])?true:false; |
480eba
|
826 |
if(!$check) swriteln('Passwords do not match.'); |
272da6
|
827 |
} while (!$check); |
FS |
828 |
} |
|
829 |
unset($check); |
|
830 |
unset($temp_password); |
4ffb51
|
831 |
if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port; |
F |
832 |
if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port; |
|
833 |
unset($ispconfig_vhost_port); |
b1a6a5
|
834 |
|
b04e82
|
835 |
if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface', array('y', 'n'), 'y','ispconfig_use_ssl')) == 'y') { |
532ae5
|
836 |
$inst->make_ispconfig_ssl_cert(); |
L |
837 |
} |
b1a6a5
|
838 |
|
532ae5
|
839 |
$inst->install_ispconfig_interface = true; |
b1a6a5
|
840 |
|
532ae5
|
841 |
} else { |
L |
842 |
$inst->install_ispconfig_interface = false; |
|
843 |
} |
b1a6a5
|
844 |
|
532ae5
|
845 |
$inst->install_ispconfig(); |
b1a6a5
|
846 |
|
532ae5
|
847 |
//* Configure DBServer |
L |
848 |
swriteln('Configuring DBServer'); |
|
849 |
$inst->configure_dbserver(); |
b1a6a5
|
850 |
|
532ae5
|
851 |
//* Configure ISPConfig |
L |
852 |
swriteln('Installing ISPConfig crontab'); |
|
853 |
$inst->install_crontab(); |
33bcd0
|
854 |
if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); |
4ffb51
|
855 |
//* Reload is enough for nginx |
F |
856 |
if($conf['nginx']['installed'] == true){ |
33bcd0
|
857 |
if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
FT |
858 |
if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
4ffb51
|
859 |
} |
b1a6a5
|
860 |
|
MC |
861 |
|
|
862 |
|
532ae5
|
863 |
} //* << $install_mode / 'Standard' or Genius |
L |
864 |
|
d5f2d5
|
865 |
$inst->create_mount_script(); |
MC |
866 |
|
1ed92e
|
867 |
//* Create md5 filelist |
TB |
868 |
$md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5'; |
|
869 |
exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename); |
|
870 |
chmod($md5_filename,0700); |
|
871 |
|
532ae5
|
872 |
|
L |
873 |
echo "Installation completed.\n"; |
|
874 |
|
|
875 |
|
bedf79
|
876 |
?> |