Skip to content

Commit fdb5142

Browse files
committed
- Added dovecot Support for opensuse
- added installation instructions for opensuse 11.2 with bind and dovecot - fixed a bug in bind plugin. - improved opensuse installer.
1 parent 03c48f0 commit fdb5142

File tree

11 files changed

+1798
-36
lines changed

11 files changed

+1798
-36
lines changed

docs/INSTALL_OPENSUSE_11_2.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
2+
Installation
3+
-----------
4+
5+
It is recommended to use a clean (fresh) OpenSUSE installatiom where you selected to install just the minimal packages. A Gnome or KDE desktop is not needed and will just slow down the server. Then follow the steps below to setup your server with ISPConfig 3:
6+
7+
The following guide is for the 32Bit version of openSUSE, for 64Bit installations the package names may differ especially the names of downloaded rpm files.
8+
9+
This guide will use Dovecote as pop3 / imap server and BIND as DNS Server. Dovecot and BIND are supported by ISPConfig version > 3.0.2
10+
11+
Install some basic packes and the compilers that we need later
12+
13+
// yast2 -i findutils readline libgcc glibc-devel findutils-locate gcc flex lynx compat-readline4 db-devel wget gcc-c++ make vim telnet cron iptables iputils man man-pages nano pico
14+
15+
yast2 -i findutils lynx wget vim telnet cron iptables iputils man man-pages nano pico sudo
16+
17+
18+
1) Install Postfix, Divecot, MySQL with the following command line (on one line!):
19+
20+
yast2 -i postfix postfix-mysql mysql mysql-client python libmysqlclient-devel dovecot12 dovecot12-backend-mysql
21+
22+
chkconfig --add mysql
23+
/etc/init.d/mysql start
24+
25+
chkconfig --add postfix
26+
/etc/init.d/postfix start
27+
28+
chkconfig --add dovecot
29+
/etc/init.d/dovecot start
30+
31+
rpm -i http://download.opensuse.org/repositories/server:/mail/openSUSE_11.2/noarch/getmail-4.16.0-1.1.noarch.rpm
32+
33+
34+
// Set the mysql database password:
35+
36+
mysql_secure_installation
37+
38+
39+
2) Install Amavisd-new, Spamassassin and Clamav (1 line!):
40+
41+
yast2 -i amavisd-new clamav clamav-db zoo unzip unrar bzip2 unarj perl-DBD-mysql
42+
43+
Open /etc/amavisd.conf...
44+
45+
vi /etc/amavisd.conf
46+
47+
... and add the $myhostname line with your correct hostname below the $mydomain line:
48+
49+
[...]
50+
$mydomain = 'example.com'; # a convenient default for other settings
51+
$myhostname = "server1.$mydomain";
52+
[...]
53+
54+
then execute:
55+
56+
chkconfig --add amavis
57+
chkconfig --add clamd
58+
/etc/init.d/amavis start
59+
/etc/init.d/clamd start
60+
61+
2.1) Install apache2
62+
63+
yast2 -i apache2 apache2-mod_fcgid
64+
65+
3) Install PHP5 modules (1 line!):
66+
67+
yast2 -i php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-mysql php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-fastcgi php5-pear php5-sysvmsg php5-sysvshm ImageMagick curl apache2-mod_php5
68+
69+
rpm -i http://download.opensuse.org/repositories/server:/php/openSUSE_11.2/i586/suphp-0.7.1-3.1.i586.rpm
70+
71+
72+
Then run the following to enable the Apache modules:
73+
74+
a2enmod suexec
75+
a2enmod rewrite
76+
a2enmod ssl
77+
a2enmod actions
78+
a2enmod suphp
79+
a2enmod fcgid
80+
81+
// Fix a suexec permission problem
82+
83+
chown root:www /usr/sbin/suexec2
84+
chmod 4755 /usr/sbin/suexec2
85+
86+
// and start apache
87+
88+
chkconfig --add apache2
89+
/etc/init.d/apache2 start
90+
91+
cd /tmp
92+
93+
yast2 -i pwgen
94+
rpm -i http://download.opensuse.org/repositories/server:/php:/applications/openSUSE_11.2/noarch/phpMyAdmin-3.2.5-1.1.noarch.rpm
95+
96+
// Warnings like "warning: phpMyAdmin-3.1.2-1.1.src.rpm: Header V3 DSA signature: NOKEY, key ID 367fe7fc" can be ignored.
97+
98+
4) Install pure-ftpd and quota
99+
100+
yast2 -i pure-ftpd quota
101+
102+
chkconfig --add pure-ftpd
103+
/etc/init.d/pure-ftpd start
104+
105+
106+
5) Install Bind
107+
108+
yast2 -i bind
109+
110+
chkconfig --add named
111+
112+
6) Install webalizer
113+
114+
yast2 -i webalizer perl-DateManip
115+
116+
6.1 Install fail2ban
117+
118+
yast2 -i fail2ban
119+
120+
121+
6.2 Install jailkit
122+
123+
rpm -i http://download.opensuse.org/repositories/security/openSUSE_11.2/i586/jailkit-2.11-1.1.i586.rpm
124+
125+
7) Install ISPConfig 3
126+
127+
cd /tmp
128+
wget http://www.ispconfig.org/downloads/ISPConfig-3.0.2.tar.gz
129+
tar xvfz ISPConfig-3.0.2.tar.gz
130+
cd ispconfig3_install/install/
131+
php -q install.php
132+
133+
The installer will configure all services like postfix, sasl, courier, etc. for you. A manual setup as required for ISPConfig 2 (perfect setup guides) is not nescessary. To login to the ISPConfig controlpanel, open the following URL in your browser (replace the IP to match your settings!):
134+
135+
http://192.168.0.100:8080/
136+
137+
the default login is:
138+
139+
user: admin
140+
password: admin
141+
142+
In case you get a permission denied error from apache, please restart the apache webserver process.
143+
144+
Optional:
145+
146+
Install a webbased Email Client
147+
148+
rpm -i http://download.opensuse.org/repositories/server:/php:/applications/openSUSE_11.2/noarch/squirrelmail-1.4.19-4.1.noarch.rpm
149+
150+

install/dist/conf/opensuse110.conf.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@
161161

162162
//* BIND DNS Server
163163
$conf['bind']['installed'] = false; // will be detected automatically during installation
164-
$conf['bind']['bind_user'] = 'root';
165-
$conf['bind']['bind_group'] = 'bind';
166-
$conf['bind']['bind_zonefiles_dir'] = '/etc/bind';
167-
$conf['bind']['named_conf_path'] = '/etc/bind/named.conf';
168-
$conf['bind']['named_conf_local_path'] = '/etc/bind/named.conf.local';
164+
$conf['bind']['bind_user'] = 'named';
165+
$conf['bind']['bind_group'] = 'named';
166+
$conf['bind']['bind_zonefiles_dir'] = '/var/lib/named';
167+
$conf['bind']['named_conf_path'] = '/etc/named.conf';
168+
$conf['bind']['named_conf_local_path'] = '/etc/named.conf.include';
169169
$conf['bind']['init_script'] = 'named';
170170

171171
//* Jailkit

install/dist/lib/opensuse.lib.php

Lines changed: 87 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,21 @@ function configure_postfix($options = '')
7777
__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
7878

7979
//* Creating virtual mail user and group
80-
$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
81-
if(!is_group($cf['vmail_groupname'])) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
82-
83-
$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
84-
if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
80+
if(is_group($cf['vmail_groupname'])) {
81+
$command = 'groupmod -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
82+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
83+
} else {
84+
$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
85+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
86+
}
87+
88+
if(is_user($cf['vmail_username'])) {
89+
$command = 'usermod -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' -d '.$cf['vmail_mailbox_base'].' -s /bin/bash '.$cf['vmail_username'];
90+
caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
91+
} else {
92+
$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
93+
caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
94+
}
8595

8696
$postconf_commands = array (
8797
'myhostname = '.$conf['hostname'],
@@ -172,6 +182,9 @@ function configure_postfix($options = '')
172182
' flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
173183
$content);
174184

185+
// enable tlsmanager
186+
$content = str_replace('#tlsmgr unix - - n 1000? 1 tlsmgr','tlsmgr unix - - n 1000? 1 tlsmgr',$content);
187+
175188
wf($configfile, $content);
176189

177190
//* Writing the Maildrop mailfilter file
@@ -235,7 +248,7 @@ public function configure_saslauthd() {
235248
$content = str_replace('/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1','/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1',$content);
236249

237250

238-
wf($configfile,$content);
251+
if(is_file($configfile)) wf($configfile,$content);
239252

240253

241254

@@ -294,12 +307,79 @@ public function configure_courier()
294307
wf($configfile, $content);
295308
}
296309

310+
public function configure_dovecot()
311+
{
312+
global $conf;
313+
314+
$config_dir = $conf['dovecot']['config_dir'];
315+
316+
//* Configure master.cf and add a line for deliver
317+
if(is_file($config_dir.'/master.cf')){
318+
copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
319+
}
320+
if(is_file($config_dir.'/master.cf~')){
321+
exec('chmod 400 '.$config_dir.'/master.cf~2');
322+
}
323+
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
324+
// Only add the content if we had not addded it before
325+
if(!stristr($content,"dovecot/deliver")) {
326+
$deliver_content = 'dovecot unix - n n - - pipe'."\n".' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
327+
af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
328+
}
329+
unset($content);
330+
unset($deliver_content);
331+
332+
333+
//* Reconfigure postfix to use dovecot authentication
334+
// Adding the amavisd commands to the postfix configuration
335+
$postconf_commands = array (
336+
'dovecot_destination_recipient_limit = 1',
337+
'virtual_transport = dovecot',
338+
'smtpd_sasl_type = dovecot',
339+
'smtpd_sasl_path = private/auth',
340+
'receive_override_options = no_address_mappings'
341+
);
342+
343+
// Make a backup copy of the main.cf file
344+
copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
345+
346+
// Executing the postconf commands
347+
foreach($postconf_commands as $cmd) {
348+
$command = "postconf -e '$cmd'";
349+
caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
350+
}
351+
352+
//* copy dovecot.conf
353+
$configfile = 'dovecot.conf';
354+
if(is_file("$config_dir/$configfile")){
355+
copy("$config_dir/$configfile", "$config_dir/$configfile~");
356+
}
357+
copy('tpl/opensuse_dovecot.conf.master',"$config_dir/$configfile");
358+
359+
//* dovecot-sql.conf
360+
$configfile = 'dovecot-sql.conf';
361+
if(is_file("$config_dir/$configfile")){
362+
copy("$config_dir/$configfile", "$config_dir/$configfile~");
363+
}
364+
exec("chmod 400 $config_dir/$configfile~");
365+
$content = rf("tpl/opensuse_dovecot-sql.conf.master");
366+
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
367+
$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
368+
$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
369+
$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
370+
wf("$config_dir/$configfile", $content);
371+
372+
exec("chmod 600 $config_dir/$configfile");
373+
exec("chown root:root $config_dir/$configfile");
374+
375+
}
376+
297377
public function configure_amavis() {
298378
global $conf;
299379

300380
// amavisd user config file
301381
$configfile = 'opensuse_amavisd_conf';
302-
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["courier"]["config_dir"].'/amavisd.conf~');
382+
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) @copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["courier"]["config_dir"].'/amavisd.conf~');
303383
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
304384
$content = rf("tpl/".$configfile.".master");
305385
$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);

install/lib/installer_base.lib.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ public function add_database_server_record() {
218218
$tpl_ini_array['web']['group'] = $conf['apache']['group'];
219219
$tpl_ini_array['mail']['pop3_imap_daemon'] = ($conf['dovecot']['installed'] == true)?'dovecot':'courier';
220220
$tpl_ini_array['mail']['mail_filter_syntax'] = ($conf['dovecot']['installed'] == true)?'sieve':'maildrop';
221+
$tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user'];
222+
$tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group'];
223+
$tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir'];
224+
$tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path'];
225+
$tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path'];
221226

222227
$server_ini_content = array_to_ini($tpl_ini_array);
223228
$server_ini_content = mysql_real_escape_string($server_ini_content);

0 commit comments

Comments
 (0)