Skip to content

Commit a63d158

Browse files
author
Till Brehm
committed
Merge branch 'stretch' into 'master'
Debian stretch See merge request !563
2 parents c4a5bae + f81fa58 commit a63d158

File tree

3 files changed

+402
-1
lines changed

3 files changed

+402
-1
lines changed
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2017, 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+
//* Main
32+
$conf['language'] = 'en';
33+
$conf['distname'] = 'debian90';
34+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
35+
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
36+
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
37+
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
38+
$conf['ispconfig_log_dir'] = '/var/log/ispconfig';
39+
$conf['server_id'] = 1;
40+
$conf['init_scripts'] = '/etc/init.d';
41+
$conf['runlevel'] = '/etc';
42+
$conf['shells'] = '/etc/shells';
43+
$conf['pam'] = '/etc/pam.d';
44+
45+
//* Services provided by this server, this selection will be overridden by the expert mode
46+
$conf['services']['mail'] = true;
47+
$conf['services']['web'] = true;
48+
$conf['services']['dns'] = true;
49+
$conf['services']['file'] = true;
50+
$conf['services']['db'] = true;
51+
$conf['services']['vserver'] = true;
52+
$conf['services']['proxy'] = false;
53+
$conf['services']['firewall'] = false;
54+
55+
//* MySQL
56+
$conf['mysql']['installed'] = false; // will be detected automatically during installation
57+
$conf['mysql']['init_script'] = 'mysql';
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'] = 'utf8mb4';
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'] = 'www-data';
78+
$conf['apache']['group'] = 'www-data';
79+
$conf['apache']['init_script'] = 'apache2';
80+
$conf['apache']['version'] = '2.4';
81+
$conf['apache']['vhost_conf_dir'] = '/etc/apache2/sites-available';
82+
$conf['apache']['vhost_conf_enabled_dir'] = '/etc/apache2/sites-enabled';
83+
$conf['apache']['vhost_port'] = '8080';
84+
$conf['apache']['php_ini_path_apache'] = '/etc/php/7.0/apache2/php.ini';
85+
$conf['apache']['php_ini_path_cgi'] = '/etc/php/7.0/cgi/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/php/7.0/cgi/';
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+
//* mlmmj
122+
$conf['mlmmj']['installed'] = false; // will be detected automatically during installation
123+
$conf['mlmmj']['config_dir'] = '/etc/mlmmj';
124+
125+
//* Getmail
126+
$conf['getmail']['installed'] = false; // will be detected automatically during installation
127+
$conf['getmail']['config_dir'] = '/etc/getmail';
128+
$conf['getmail']['program'] = '/usr/bin/getmail';
129+
130+
//* Courier
131+
$conf['courier']['installed'] = false; // will be detected automatically during installation
132+
$conf['courier']['config_dir'] = '/etc/courier';
133+
$conf['courier']['courier-authdaemon'] = 'courier-authdaemon';
134+
$conf['courier']['courier-imap'] = 'courier-imap';
135+
$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl';
136+
$conf['courier']['courier-pop'] = 'courier-pop';
137+
$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl';
138+
139+
//* Dovecot
140+
$conf['dovecot']['installed'] = false; // will be detected automatically during installation
141+
$conf['dovecot']['config_dir'] = '/etc/dovecot';
142+
$conf['dovecot']['init_script'] = 'dovecot';
143+
144+
//* SASL
145+
$conf['saslauthd']['installed'] = false; // will be detected automatically during installation
146+
$conf['saslauthd']['config'] = '/etc/default/saslauthd';
147+
$conf['saslauthd']['init_script'] = 'saslauthd';
148+
149+
//* Amavisd
150+
$conf['amavis']['installed'] = false; // will be detected automatically during installation
151+
$conf['amavis']['config_dir'] = '/etc/amavis';
152+
$conf['amavis']['init_script'] = 'amavis';
153+
154+
//* ClamAV
155+
$conf['clamav']['installed'] = false; // will be detected automatically during installation
156+
$conf['clamav']['init_script'] = 'clamav-daemon';
157+
158+
//* Pureftpd
159+
$conf['pureftpd']['installed'] = false; // will be detected automatically during installation
160+
$conf['pureftpd']['config_dir'] = '/etc/pure-ftpd';
161+
$conf['pureftpd']['init_script'] = 'pure-ftpd-mysql';
162+
163+
//* MyDNS
164+
$conf['mydns']['installed'] = false; // will be detected automatically during installation
165+
$conf['mydns']['config_dir'] = '/etc';
166+
$conf['mydns']['init_script'] = 'mydns';
167+
168+
//* PowerDNS
169+
$conf['powerdns']['installed'] = false; // will be detected automatically during installation
170+
$conf['powerdns']['database'] = 'powerdns';
171+
$conf['powerdns']['config_dir'] = '/etc/powerdns/pdns.d';
172+
$conf['powerdns']['init_script'] = 'pdns';
173+
174+
//* BIND DNS Server
175+
$conf['bind']['installed'] = false; // will be detected automatically during installation
176+
$conf['bind']['bind_user'] = 'root';
177+
$conf['bind']['bind_group'] = 'bind';
178+
$conf['bind']['bind_zonefiles_dir'] = '/etc/bind';
179+
$conf['bind']['named_conf_path'] = '/etc/bind/named.conf';
180+
$conf['bind']['named_conf_local_path'] = '/etc/bind/named.conf.local';
181+
$conf['bind']['init_script'] = 'bind9';
182+
183+
//* Jailkit
184+
$conf['jailkit']['installed'] = false; // will be detected automatically during installation
185+
$conf['jailkit']['config_dir'] = '/etc/jailkit';
186+
$conf['jailkit']['jk_init'] = 'jk_init.ini';
187+
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
188+
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch';
189+
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
190+
191+
//* Squid
192+
$conf['squid']['installed'] = false; // will be detected automatically during installation
193+
$conf['squid']['config_dir'] = '/etc/squid';
194+
$conf['squid']['init_script'] = 'squid';
195+
196+
//* Nginx
197+
$conf['nginx']['installed'] = false; // will be detected automatically during installation
198+
$conf['nginx']['user'] = 'www-data';
199+
$conf['nginx']['group'] = 'www-data';
200+
$conf['nginx']['config_dir'] = '/etc/nginx';
201+
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
202+
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
203+
$conf['nginx']['init_script'] = 'nginx';
204+
$conf['nginx']['vhost_port'] = '8080';
205+
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
206+
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
207+
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
208+
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
209+
$conf['nginx']['php_fpm_start_port'] = 9010;
210+
$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php5-fpm';
211+
212+
//* OpenVZ
213+
$conf['openvz']['installed'] = false;
214+
215+
//*Bastille-Firwall
216+
$conf['bastille']['installed'] = false;
217+
$conf['bastille']['config_dir'] = '/etc/Bastille';
218+
219+
//* vlogger
220+
$conf['vlogger']['config_dir'] = '/etc';
221+
222+
//* cron
223+
$conf['cron']['init_script'] = 'cron';
224+
$conf['cron']['crontab_dir'] = '/etc/cron.d';
225+
$conf['cron']['wget'] = '/usr/bin/wget';
226+
227+
//* Metronome XMPP
228+
$conf['xmpp']['installed'] = false;
229+
$conf['xmpp']['init_script'] = 'metronome';
230+
?>

install/dist/lib/debian90.lib.php

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
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+
class installer extends installer_base {
32+
33+
public function configure_dovecot()
34+
{
35+
global $conf;
36+
37+
$virtual_transport = 'dovecot';
38+
39+
$configure_lmtp = false;
40+
41+
// check if virtual_transport must be changed
42+
if ($this->is_update) {
43+
$tmp = $this->db->queryOneRecord("SELECT * FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . ".server", $conf['server_id']);
44+
$ini_array = ini_to_array(stripslashes($tmp['config']));
45+
// ini_array needs not to be checked, because already done in update.php -> updateDbAndIni()
46+
47+
if(isset($ini_array['mail']['mailbox_virtual_uidgid_maps']) && $ini_array['mail']['mailbox_virtual_uidgid_maps'] == 'y') {
48+
$virtual_transport = 'lmtp:unix:private/dovecot-lmtp';
49+
$configure_lmtp = true;
50+
}
51+
}
52+
53+
$config_dir = $conf['postfix']['config_dir'];
54+
if(!$this->get_postfix_service('dovecot', 'unix')) {
55+
//* backup
56+
if(is_file($config_dir.'/master.cf')){
57+
copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
58+
}
59+
if(is_file($config_dir.'/master.cf~')){
60+
chmod($config_dir.'/master.cf~2', 0400);
61+
}
62+
//* Configure master.cf and add a line for deliver
63+
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
64+
$deliver_content = 'dovecot unix - n n - - pipe'."\n".' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}'."\n";
65+
af($config_dir.'/master.cf', $deliver_content);
66+
unset($content);
67+
unset($deliver_content);
68+
}
69+
70+
//* Reconfigure postfix to use dovecot authentication
71+
// Adding the amavisd commands to the postfix configuration
72+
$postconf_commands = array (
73+
'dovecot_destination_recipient_limit = 1',
74+
'virtual_transport = '.$virtual_transport,
75+
'smtpd_sasl_type = dovecot',
76+
'smtpd_sasl_path = private/auth'
77+
);
78+
79+
// Make a backup copy of the main.cf file
80+
copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
81+
82+
// Executing the postconf commands
83+
foreach($postconf_commands as $cmd) {
84+
$command = "postconf -e '$cmd'";
85+
caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
86+
}
87+
88+
//* copy dovecot.conf
89+
$config_dir = $conf['dovecot']['config_dir'];
90+
$configfile = 'dovecot.conf';
91+
if(is_file($config_dir.'/'.$configfile)){
92+
copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
93+
}
94+
95+
//* Get the dovecot version
96+
exec('dovecot --version', $tmp);
97+
$dovecot_version = $tmp[0];
98+
unset($tmp);
99+
100+
//* Copy dovecot configuration file
101+
if(version_compare($dovecot_version,2) >= 0) {
102+
if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master')) {
103+
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
104+
} else {
105+
copy('tpl/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
106+
}
107+
replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0);
108+
if(version_compare($dovecot_version,2.1) < 0) {
109+
removeLine($config_dir.'/'.$configfile, 'ssl_protocols =');
110+
}
111+
} else {
112+
if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) {
113+
copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
114+
} else {
115+
copy('tpl/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
116+
}
117+
}
118+
119+
//* dovecot-lmtpd
120+
if($configure_lmtp) {
121+
replaceLine($config_dir.'/'.$configfile, 'protocols = imap pop3', 'protocols = imap pop3 lmtp', 1, 0);
122+
}
123+
124+
//* dovecot-sql.conf
125+
$configfile = 'dovecot-sql.conf';
126+
if(is_file($config_dir.'/'.$configfile)){
127+
copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
128+
chmod($config_dir.'/'.$configfile.'~', 0400);
129+
}
130+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot-sql.conf.master', 'tpl/debian6_dovecot-sql.conf.master');
131+
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
132+
$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
133+
$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
134+
$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
135+
$content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
136+
$content = str_replace('{server_id}', $conf['server_id'], $content);
137+
wf($config_dir.'/'.$configfile, $content);
138+
139+
chmod($config_dir.'/'.$configfile, 0600);
140+
chown($config_dir.'/'.$configfile, 'root');
141+
chgrp($config_dir.'/'.$configfile, 'root');
142+
143+
// Dovecot shall ignore mounts in website directory
144+
if(is_installed('doveadm')) exec("doveadm mount add '/var/www/*' ignore > /dev/null 2> /dev/null");
145+
146+
}
147+
148+
public function configure_apache() {
149+
global $conf;
150+
151+
if(file_exists('/etc/apache2/mods-available/fcgid.conf')) replaceLine('/etc/apache2/mods-available/fcgid.conf', 'MaxRequestLen', 'MaxRequestLen 15728640', 0, 1);
152+
153+
parent::configure_apache();
154+
}
155+
156+
public function configure_fail2ban() {
157+
/*
158+
copy('tpl/dovecot-pop3imap.conf.master',"/etc/fail2ban/filter.d/dovecot-pop3imap.conf");
159+
copy('tpl/dovecot_fail2ban_jail.local.master','/etc/fail2ban/jail.local');
160+
*/
161+
}
162+
163+
}
164+
165+
?>

0 commit comments

Comments
 (0)