Skip to content

Commit ccebb93

Browse files
author
Till Brehm
committed
Improved Centos 7 support in installer.
1 parent b79f6ca commit ccebb93

File tree

3 files changed

+384
-1
lines changed

3 files changed

+384
-1
lines changed
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2007, 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+
//*** Fedora 9 default settings
32+
33+
//* Main
34+
$conf['language'] = 'en';
35+
$conf['distname'] = 'centos52';
36+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
37+
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
38+
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
39+
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
40+
$conf['ispconfig_log_dir'] = '/var/log/ispconfig';
41+
$conf['server_id'] = 1;
42+
$conf['init_scripts'] = '/etc/init.d';
43+
$conf['runlevel'] = '/etc';
44+
$conf['shells'] = '/etc/shells';
45+
$conf['pam'] = '/etc/pam.d';
46+
47+
//* Services provided by this server, this selection will be overridden by the expert mode
48+
$conf['services']['mail'] = true;
49+
$conf['services']['web'] = true;
50+
$conf['services']['dns'] = true;
51+
$conf['services']['file'] = true;
52+
$conf['services']['db'] = true;
53+
$conf['services']['vserver'] = true;
54+
55+
//* MySQL
56+
$conf['mysql']['installed'] = false; // will be detected automatically during installation
57+
$conf['mysql']['init_script'] = 'mariadb';
58+
$conf['mysql']['host'] = 'localhost';
59+
$conf['mysql']['ip'] = '127.0.0.1';
60+
$conf['mysql']['port'] = '3306';
61+
$conf['mysql']['database'] = 'dbispconfig';
62+
$conf['mysql']['admin_user'] = 'root';
63+
$conf['mysql']['admin_password'] = '';
64+
$conf['mysql']['charset'] = 'utf8';
65+
$conf['mysql']['ispconfig_user'] = 'ispconfig';
66+
$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
67+
$conf['mysql']['master_slave_setup'] = 'n';
68+
$conf['mysql']['master_host'] = '';
69+
$conf['mysql']['master_database'] = 'dbispconfig';
70+
$conf['mysql']['master_admin_user'] = 'root';
71+
$conf['mysql']['master_admin_password'] = '';
72+
$conf['mysql']['master_ispconfig_user'] = '';
73+
$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
74+
75+
//* Apache
76+
$conf['apache']['installed'] = false; // will be detected automatically during installation
77+
$conf['apache']['user'] = 'apache';
78+
$conf['apache']['group'] = 'apache';
79+
$conf['apache']['init_script'] = 'httpd';
80+
$conf['apache']['version'] = '2.2';
81+
$conf['apache']['vhost_conf_dir'] = '/etc/httpd/conf/sites-available';
82+
$conf['apache']['vhost_conf_enabled_dir'] = '/etc/httpd/conf/sites-enabled';
83+
$conf['apache']['vhost_port'] = '8080';
84+
$conf['apache']['php_ini_path_apache'] = '/etc/php.ini';
85+
$conf['apache']['php_ini_path_cgi'] = '/etc/php.ini';
86+
87+
//* Website base settings
88+
$conf['web']['website_basedir'] = '/var/www';
89+
$conf['web']['website_path'] = '/var/www/clients/client[client_id]/web[website_id]';
90+
$conf['web']['website_symlinks'] = '/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/';
91+
92+
//* Apps base settings
93+
$conf['web']['apps_vhost_ip'] = '_default_';
94+
$conf['web']['apps_vhost_port'] = '8081';
95+
$conf['web']['apps_vhost_servername'] = '';
96+
$conf['web']['apps_vhost_user'] = 'ispapps';
97+
$conf['web']['apps_vhost_group'] = 'ispapps';
98+
99+
//* Fastcgi
100+
$conf['fastcgi']['fastcgi_phpini_path'] = '/etc/';
101+
$conf['fastcgi']['fastcgi_starter_path'] = '/var/www/php-fcgi-scripts/[system_user]/';
102+
$conf['fastcgi']['fastcgi_bin'] = '/usr/bin/php-cgi';
103+
104+
//* Postfix
105+
$conf['postfix']['installed'] = false; // will be detected automatically during installation
106+
$conf['postfix']['config_dir'] = '/etc/postfix';
107+
$conf['postfix']['init_script'] = 'postfix';
108+
$conf['postfix']['user'] = 'postfix';
109+
$conf['postfix']['group'] = 'postfix';
110+
$conf['postfix']['vmail_userid'] = '5000';
111+
$conf['postfix']['vmail_username'] = 'vmail';
112+
$conf['postfix']['vmail_groupid'] = '5000';
113+
$conf['postfix']['vmail_groupname'] = 'vmail';
114+
$conf['postfix']['vmail_mailbox_base'] = '/var/vmail';
115+
116+
//* Mailman
117+
$conf['mailman']['installed'] = false; // will be detected automatically during installation
118+
$conf['mailman']['config_dir'] = '/etc/mailman';
119+
$conf['mailman']['init_script'] = 'mailman';
120+
121+
//* Getmail
122+
$conf['getmail']['installed'] = false; // will be detected automatically during installation
123+
$conf['getmail']['config_dir'] = '/etc/getmail';
124+
$conf['getmail']['program'] = '/usr/bin/getmail';
125+
126+
//* Courier
127+
$conf['courier']['installed'] = false; // will be detected automatically during installation
128+
$conf['courier']['config_dir'] = '/etc/authlib';
129+
$conf['courier']['courier-authdaemon'] = 'courier-authlib';
130+
$conf['courier']['courier-imap'] = 'courier-imap';
131+
$conf['courier']['courier-imap-ssl'] = '';
132+
$conf['courier']['courier-pop'] = '';
133+
$conf['courier']['courier-pop-ssl'] = '';
134+
135+
//* Dovecot
136+
$conf['dovecot']['installed'] = false; // will be detected automatically during installation
137+
$conf['dovecot']['config_dir'] = '/etc';
138+
$conf['dovecot']['init_script'] = 'dovecot';
139+
140+
//* SASL
141+
$conf['saslauthd']['installed'] = false; // will be detected automatically during installation
142+
$conf['saslauthd']['config'] = '/etc/sysconfig/saslauthd';
143+
$conf['saslauthd']['init_script'] = 'saslauthd';
144+
145+
//* Amavisd
146+
$conf['amavis']['installed'] = false; // will be detected automatically during installation
147+
$conf['amavis']['config_dir'] = '/etc';
148+
$conf['amavis']['init_script'] = 'amavisd';
149+
150+
//* ClamAV
151+
$conf['clamav']['installed'] = false; // will be detected automatically during installation
152+
$conf['clamav']['init_script'] = 'clamd@amavisd';
153+
154+
//* Pureftpd
155+
$conf['pureftpd']['installed'] = false; // will be detected automatically during installation
156+
$conf['pureftpd']['config_dir'] = '/etc/pure-ftpd';
157+
$conf['pureftpd']['init_script'] = 'pure-ftpd';
158+
159+
//* MyDNS
160+
$conf['mydns']['installed'] = false; // will be detected automatically during installation
161+
$conf['mydns']['config_dir'] = '/etc';
162+
$conf['mydns']['init_script'] = 'mydns';
163+
164+
//* PowerDNS
165+
$conf['powerdns']['installed'] = false; // will be detected automatically during installation
166+
$conf['powerdns']['database'] = 'powerdns';
167+
$conf["powerdns"]["config_dir"] = '/etc/powerdns/pdns.d';
168+
$conf['powerdns']['init_script'] = 'pdns';
169+
170+
//* BIND DNS Server
171+
$conf['bind']['installed'] = false; // will be detected automatically during installation
172+
$conf['bind']['bind_user'] = 'named';
173+
$conf['bind']['bind_group'] = 'named';
174+
$conf['bind']['bind_zonefiles_dir'] = '/var/named/chroot/var/named/';
175+
$conf['bind']['named_conf_path'] = '/var/named/chroot/etc/named.conf';
176+
$conf['bind']['named_conf_local_path'] = '/var/named/chroot/var/named/named.local';
177+
$conf['bind']['init_script'] = 'named';
178+
179+
//* Jailkit
180+
$conf['jailkit']['installed'] = false; // will be detected automatically during installation
181+
$conf['jailkit']['config_dir'] = '/etc/jailkit';
182+
$conf['jailkit']['jk_init'] = 'jk_init.ini';
183+
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
184+
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano';
185+
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
186+
187+
//* Squid
188+
$conf['squid']['installed'] = false; // will be detected automatically during installation
189+
$conf['squid']['config_dir'] = '/etc/squid';
190+
$conf['squid']['init_script'] = 'squid';
191+
192+
//* Nginx
193+
$conf['nginx']['installed'] = false; // will be detected automatically during installation
194+
$conf['nginx']['user'] = 'nginx';
195+
$conf['nginx']['group'] = 'nginx';
196+
$conf['nginx']['config_dir'] = '/etc/nginx';
197+
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
198+
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
199+
$conf['nginx']['init_script'] = 'nginx';
200+
$conf['nginx']['vhost_port'] = '8080';
201+
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
202+
$conf['nginx']['php_fpm_init_script'] = 'php-fpm';
203+
$conf['nginx']['php_fpm_ini_path'] = '/etc/php.ini';
204+
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php-fpm.d';
205+
$conf['nginx']['php_fpm_start_port'] = 9010;
206+
$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm';
207+
208+
//* vlogger
209+
$conf['vlogger']['config_dir'] = '/etc';
210+
211+
//* cron
212+
$conf['cron']['init_script'] = 'crond';
213+
$conf['cron']['crontab_dir'] = '/etc/cron.d';
214+
$conf['cron']['wget'] = '/usr/bin/wget';
215+
216+
//* OpenVZ
217+
$conf['openvz']['installed'] = false;
218+
219+
?>

install/dist/lib/centos70.lib.php

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2014, Till Brehm, ISPConfig UG
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+
class installer extends installer_dist {
32+
33+
public function configure_mailman($status = 'insert') {
34+
global $conf;
35+
36+
$config_dir = $conf['mailman']['config_dir'].'/';
37+
$full_file_name = $config_dir.'mm_cfg.py';
38+
//* Backup exiting file
39+
if(is_file($full_file_name)) {
40+
copy($full_file_name, $config_dir.'mm_cfg.py~');
41+
}
42+
43+
// load files
44+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
45+
$old_file = rf($full_file_name);
46+
47+
$old_options = array();
48+
$lines = explode("\n", $old_file);
49+
foreach ($lines as $line)
50+
{
51+
if (trim($line) != '' && substr($line, 0, 1) != '#')
52+
{
53+
@list($key, $value) = @explode("=", $line);
54+
if (!empty($value))
55+
{
56+
$key = rtrim($key);
57+
$old_options[$key] = trim($value);
58+
}
59+
}
60+
}
61+
62+
$config_dir = $conf['mailman']['config_dir'].'/';
63+
$full_file_name = $config_dir.'virtual_to_transport.sh';
64+
65+
//* Backup exiting virtual_to_transport.sh script
66+
if(is_file($full_file_name)) {
67+
copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
68+
}
69+
70+
if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
71+
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
72+
} else {
73+
copy('tpl/mailman-virtual_to_transport.sh', $full_file_name);
74+
}
75+
chgrp($full_file_name, 'mailman');
76+
chmod($full_file_name, 0750);
77+
78+
if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
79+
exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
80+
81+
exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
82+
83+
$virtual_domains = '';
84+
if($status == 'update')
85+
{
86+
// create virtual_domains list
87+
$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
88+
89+
if(is_array($domainAll)) {
90+
foreach($domainAll as $domain)
91+
{
92+
if ($domainAll[0]['domain'] == $domain['domain'])
93+
$virtual_domains .= "'".$domain['domain']."'";
94+
else
95+
$virtual_domains .= ", '".$domain['domain']."'";
96+
}
97+
}
98+
}
99+
else
100+
$virtual_domains = "' '";
101+
102+
$content = str_replace('{hostname}', $conf['hostname'], $content);
103+
if(!isset($old_options['DEFAULT_SERVER_LANGUAGE'])) $old_options['DEFAULT_SERVER_LANGUAGE'] = '';
104+
$content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
105+
$content = str_replace('{virtual_domains}', $virtual_domains, $content);
106+
107+
wf($full_file_name, $content);
108+
}
109+
110+
public function configure_amavis() {
111+
global $conf;
112+
113+
// amavisd user config file
114+
$configfile = 'fedora_amavisd_conf';
115+
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
116+
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
117+
if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
118+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
119+
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
120+
$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
121+
$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
122+
$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
123+
$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
124+
$content = str_replace('{hostname}', $conf['hostname'], $content);
125+
$content = str_replace('/var/spool/amavisd/clamd.sock', '/var/run/clamav/clamd.sock', $content);
126+
wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
127+
128+
129+
// Adding the amavisd commands to the postfix configuration
130+
$postconf_commands = array (
131+
'content_filter = amavis:[127.0.0.1]:10024',
132+
'receive_override_options = no_address_mappings'
133+
);
134+
135+
// Make a backup copy of the main.cf file
136+
copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
137+
138+
// Executing the postconf commands
139+
foreach($postconf_commands as $cmd) {
140+
$command = "postconf -e '$cmd'";
141+
caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
142+
}
143+
144+
// Append the configuration for amavisd to the master.cf file
145+
if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
146+
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
147+
// Only add the content if we had not addded it before
148+
if(!stristr($content, "127.0.0.1:10025")) {
149+
unset($content);
150+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
151+
af($conf["postfix"]["config_dir"].'/master.cf', $content);
152+
}
153+
unset($content);
154+
155+
removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn # REMOVE ME', 1);
156+
replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
157+
158+
159+
}
160+
161+
162+
}
163+
164+
?>

install/lib/install.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function get_distname() {
264264
} elseif(stristr($content, 'CentOS Linux release 7')) {
265265
$distname = 'CentOS';
266266
$distver = 'Unknown';
267-
$distid = 'centos53';
267+
$distid = 'centos70';
268268
$distbaseid = 'fedora';
269269
swriteln("Operating System: CentOS 7 or compatible\n");
270270
} else {

0 commit comments

Comments
 (0)