Commit ba747c0b authored by tbrehm's avatar tbrehm

Enhanced getmail support and the installer.

parent 32b40db8
......@@ -86,7 +86,11 @@ $inst->configure_spamassassin();
swriteln('Configuring Amavisd');
$inst->configure_amavis();
// Configure Amavis
// Configure Getmail
swriteln('Configuring Getmail');
$inst->configure_getmail();
// Configure ISPConfig
swriteln('Installing ISPConfig');
$inst->install_ispconfig();
......@@ -101,11 +105,19 @@ postfix
amavisd
calmd
spamd
*/
exec("/etc/init.d/mysql restart");
exec("/etc/init.d/postfix restart");
exec("/etc/init.d/saslauthd restart");
exec("/etc/init.d/amavis restart");
exec("/etc/init.d/clamav-daemon restart");
exec("/etc/init.d/courier-authdaemon restart");
exec("/etc/init.d/courier-imap restart");
exec("/etc/init.d/courier-imap-ssl restart");
exec("/etc/init.d/courier-pop restart");
exec("/etc/init.d/courier-pop-ssl restart");
echo "Installation finished.\n";
......
......@@ -439,6 +439,16 @@ postfix check
wf($configfile,$content);
}
function configure_getmail() {
global $conf;
$command = "useradd -b /etc/getmail -d /etc/getmail getmail";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
$command = "chmod -R 700 /etc/getmail";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
}
function install_ispconfig() {
global $conf;
......@@ -466,7 +476,7 @@ postfix check
$command = "ln -s ".$conf["ispconfig_install_dir"]."/interface/web/ /var/www/ispconfig";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
// Create the config file for ISPConfig
// Create the config file for ISPConfig interface
$configfile = 'config.inc.php';
if(is_file($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile)) copy($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile,$conf["ispconfig_install_dir"].'/interface/lib/'.$configfile.'~');
$content = rf("tpl/".$configfile.".master");
......@@ -476,6 +486,17 @@ postfix check
$content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
wf($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile,$content);
// Create the config file for ISPConfig server
$configfile = 'config.inc.php';
if(is_file($conf["ispconfig_install_dir"].'/server/lib/'.$configfile)) copy($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$conf["ispconfig_install_dir"].'/interface/lib/'.$configfile.'~');
$content = rf("tpl/".$configfile.".master");
$content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content);
$content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content);
$content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
$content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
wf($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$content);
// Chmod the files
$command = "chmod -R 750 ".$conf["ispconfig_install_dir"];
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
......@@ -491,6 +512,9 @@ postfix check
$command = "adduser www-data ispconfig";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
// Make the shell scripts executable
$command = "chmod +x ".$conf["ispconfig_install_dir"]."/server/scripts/*.sh";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
}
......
......@@ -35,6 +35,7 @@ ini_set('register_globals',0);
$conf["app_title"] = "ISPConfig";
$conf["app_version"] = "3.0.0";
$conf["server_id"] = "1";
/*
......@@ -69,6 +70,13 @@ define("DB_DATABASE",$conf["db_database"]);
define("DB_USER",$conf["db_user"]);
define("DB_PASSWORD",$conf["db_password"]);
/*
Logging
*/
$conf["log_file"] = $conf["rootpath"].$conf["fs_div"]."ispconfig.log";
$conf["log_priority"] = 0; // 0 = Debug, 1 = Warning, 2 = Error
/*
Themes
*/
......@@ -104,4 +112,8 @@ $conf["default_retry"] = 7200;
$conf["default_expire"] = 604800;
$conf["default_minimum_ttl"] = 86400;
define("LOGLEVEL_DEBUG",0);
define("LOGLEVEL_WARN",1);
define("LOGLEVEL_ERROR",2);
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require("/usr/local/ispconfig/server/lib/config.inc.php");
require("/usr/local/ispconfig/server/lib/app.inc.php");
// Delete the ISPConfig database
$app->db->query('DROP DATABASE '.$conf["db_database"]);
// Deleting the symlink in /var/www
unlink("/var/www/ispconfig");
// Delete the ispconfig files
exec('rm -rf /usr/local/ispconfig');
echo "Finished.\n";
?>
\ No newline at end of file
......@@ -875,14 +875,17 @@ class tform {
}
function getAuthSQL($perm) {
$sql = '(';
$sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
$sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
$sql .= "sys_perm_other like '%$perm%'";
$sql .= ')';
return $sql;
if($_SESSION["s"]["user"]["typ"] == 'admin') {
return '1';
} else {
$sql = '(';
$sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
$sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
$sql .= "sys_perm_other like '%$perm%'";
$sql .= ')';
return $sql;
}
}
/*
......
......@@ -123,4 +123,29 @@ $form["tabs"]['services'] = array (
);
$form["tabs"]['config'] = array (
'title' => "Config",
'width' => 100,
'template' => "templates/server_edit_config.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
'config' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'default' => '',
'value' => '',
'width' => '',
'cols' => '40',
'rows' => '20',
'maxlength' => ''
),
##################################
# ENDE Datatable fields
##################################
)
);
?>
\ No newline at end of file
<?php
$wb["server_name_txt"] = 'Servername';
$wb["mail_server_txt"] = 'Mailserver';
$wb["web_server_txt"] = 'Webserver';
$wb["dns_server_txt"] = 'DNS-Server';
$wb["file_server_txt"] = 'Fileserver';
$wb["db_server_txt"] = 'DB-Server';
$wb["vserver_server_txt"] = 'VServer-Server';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
<?php
$wb["config_txt"] = 'config';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["server_name_txt"] = 'Servername';
$wb["mail_server_txt"] = 'Mailserver';
$wb["web_server_txt"] = 'Webserver';
$wb["dns_server_txt"] = 'DNS-Server';
$wb["file_server_txt"] = 'Fileserver';
$wb["db_server_txt"] = 'DB-Server';
$wb["vserver_server_txt"] = 'VServer-Server';
$wb["active_txt"] = 'Active';
?>
\ No newline at end of file
<table width="500" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="frmText11">{tmpl_var name='config_txt'}:</td>
<td class="frmText11"><textarea name='config' cols='60' rows='30'>{tmpl_var name='config'}</textarea></td>
</tr> <tr>
<td class="frmText11">&nbsp;</td>
<td class="frmText11">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_edit.php');"><div class="buttonEnding"></div>&nbsp;
<input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_list.php');"><div class="buttonEnding"></div>
</td>
</tr>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
......@@ -34,10 +34,12 @@
<td class="frmText11">{tmpl_var name='limit_mailrouting_txt'}:</td>
<td class="frmText11"><input name="limit_mailrouting" type="text" class="text" value="{tmpl_var name='limit_mailrouting'}" size="10" maxlength="10"></td>
</tr>
<!--
<tr>
<td class="frmText11">{tmpl_var name='limit_mailfilter_txt'}:</td>
<td class="frmText11"><input name="limit_mailfilter" type="text" class="text" value="{tmpl_var name='limit_mailfilter'}" size="10" maxlength="10"></td>
</tr>
-->
<tr>
<td class="frmText11">{tmpl_var name='limit_fetchmail_txt'}:</td>
<td class="frmText11"><input name="limit_fetchmail" type="text" class="text" value="{tmpl_var name='limit_fetchmail'}" size="10" maxlength="10"></td>
......
<?php
$wb["server_id_txt"] = 'server_id';
$wb["type_txt"] = 'type';
$wb["source_server_txt"] = 'source_server';
$wb["source_username_txt"] = 'source_username';
$wb["source_password_txt"] = 'source_password';
$wb["source_delete_txt"] = 'source_delete';
$wb["destination_txt"] = 'destination';
$wb["active_txt"] = 'active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
<?php
$wb["server_id_txt"] = 'Server';
$wb["type_txt"] = 'Type';
$wb["source_server_txt"] = 'Pop3/Imap Server';
$wb["source_username_txt"] = 'Username';
$wb["source_password_txt"] = 'Password';
$wb["source_delete_txt"] = 'Delete emails after retrieval';
$wb["destination_txt"] = 'Destination';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
?>
\ No newline at end of file
<?php
$wb["list_head_txt"] = 'mail_get';
$wb["active_txt"] = 'active';
$wb["server_id_txt"] = 'server_id';
$wb["source_server_txt"] = 'source_server';
$wb["source_username_txt"] = 'source_username';
$wb["destination_txt"] = 'destination';
$wb["page_txt"] = 'Page';
$wb["page_of_txt"] = 'of';
$wb["page_next_txt"] = 'Next';
$wb["page_back_txt"] = 'Back';
$wb["delete_txt"] = 'Delete';
$wb["filter_txt"] = 'Filter';
<?php
$wb["list_head_txt"] = 'Fetch emails from external POP3 / IMAP servers';
$wb["active_txt"] = 'Active';
$wb["server_id_txt"] = 'Server';
$wb["source_server_txt"] = 'External Server';
$wb["source_username_txt"] = 'Username';
$wb["destination_txt"] = 'Destination';
$wb["page_txt"] = 'Page';
$wb["page_of_txt"] = 'of';
$wb["page_next_txt"] = 'Next';
$wb["page_back_txt"] = 'Back';
$wb["delete_txt"] = 'Delete';
$wb["filter_txt"] = 'Filter';
$wb["add_new_record_txt"] = 'Add new Account';
?>
\ No newline at end of file
<?php
$wb["policy_name_txt"] = 'policy_name';
$wb["virus_lover_txt"] = 'virus_lover';
$wb["spam_lover_txt"] = 'spam_lover';
$wb["banned_files_lover_txt"] = 'banned_files_lover';
$wb["bad_header_lover_txt"] = 'bad_header_lover';
$wb["bypass_virus_checks_txt"] = 'bypass_virus_checks';
$wb["bypass_banned_checks_txt"] = 'bypass_banned_checks';
$wb["bypass_header_checks_txt"] = 'bypass_header_checks';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["virus_quarantine_to_txt"] = 'virus_quarantine_to';
$wb["spam_quarantine_to_txt"] = 'spam_quarantine_to';
$wb["banned_quarantine_to_txt"] = 'banned_quarantine_to';
$wb["bad_header_quarantine_to_txt"] = 'bad_header_quarantine_to';
$wb["clean_quarantine_to_txt"] = 'clean_quarantine_to';
$wb["other_quarantine_to_txt"] = 'other_quarantine_to';
$wb["spam_tag_level_txt"] = 'spam_tag_level';
$wb["spam_tag2_level_txt"] = 'spam_tag2_level';
$wb["spam_kill_level_txt"] = 'spam_kill_level';
$wb["spam_dsn_cutoff_level_txt"] = 'spam_dsn_cutoff_level';
$wb["spam_quarantine_cutoff_level_txt"] = 'spam_quarantine_cutoff_level';
$wb["spam_modifies_subj_txt"] = 'spam_modifies_subj';
$wb["spam_subject_tag_txt"] = 'spam_subject_tag';
$wb["spam_subject_tag2_txt"] = 'spam_subject_tag2';
$wb["addr_extension_virus_txt"] = 'addr_extension_virus';
$wb["addr_extension_spam_txt"] = 'addr_extension_spam';
$wb["addr_extension_banned_txt"] = 'addr_extension_banned';
$wb["addr_extension_bad_header_txt"] = 'addr_extension_bad_header';
$wb["warnvirusrecip_txt"] = 'warnvirusrecip';
$wb["warnbannedrecip_txt"] = 'warnbannedrecip';
$wb["warnbadhrecip_txt"] = 'warnbadhrecip';
$wb["newvirus_admin_txt"] = 'newvirus_admin';
$wb["virus_admin_txt"] = 'virus_admin';
$wb["banned_admin_txt"] = 'banned_admin';
$wb["bad_header_admin_txt"] = 'bad_header_admin';
$wb["spam_admin_txt"] = 'spam_admin';
$wb["message_size_limit_txt"] = 'message_size_limit';
$wb["banned_rulenames_txt"] = 'banned_rulenames';
<?php
$wb["policy_name_txt"] = 'Policy Name';
$wb["virus_lover_txt"] = 'Virusl lover';
$wb["spam_lover_txt"] = 'SPAM lover';
$wb["banned_files_lover_txt"] = 'Banned files lover';
$wb["bad_header_lover_txt"] = 'Bad header lover';
$wb["bypass_virus_checks_txt"] = 'Bypass virus checks';
$wb["bypass_banned_checks_txt"] = 'Bypass banned checks';
$wb["bypass_header_checks_txt"] = 'Bypass header checks';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["virus_quarantine_to_txt"] = 'Virus quarantine to';
$wb["spam_quarantine_to_txt"] = 'Spam quarantine to';
$wb["banned_quarantine_to_txt"] = 'Banned quarantine to';
$wb["bad_header_quarantine_to_txt"] = 'Bad header quarantine to';
$wb["clean_quarantine_to_txt"] = 'Clean quarantine to';
$wb["other_quarantine_to_txt"] = 'Other quarantine to';
$wb["spam_tag_level_txt"] = 'SPAM tag level';
$wb["spam_tag2_level_txt"] = 'SPAM tag2 level';
$wb["spam_kill_level_txt"] = 'SPAM kill level';
$wb["spam_dsn_cutoff_level_txt"] = 'SPAM dsn cutoff level';
$wb["spam_quarantine_cutoff_level_txt"] = 'SPAM quarantine cutoff level';
$wb["spam_modifies_subj_txt"] = 'SPAM modifies subject';
$wb["spam_subject_tag_txt"] = 'SPAM subject tag';
$wb["spam_subject_tag2_txt"] = 'SPAM subject tag2';
$wb["addr_extension_virus_txt"] = 'Addr. extension virus';
$wb["addr_extension_spam_txt"] = 'Addr. extension SPAM';
$wb["addr_extension_banned_txt"] = 'Addr. extension banned';
$wb["addr_extension_bad_header_txt"] = 'Addr extension bad header';
$wb["warnvirusrecip_txt"] = 'Warn virus recip.';
$wb["warnbannedrecip_txt"] = 'Warn banned recip.';
$wb["warnbadhrecip_txt"] = 'Warn bad header recip.';
$wb["newvirus_admin_txt"] = 'Newvirus admin';
$wb["virus_admin_txt"] = 'Virus admin';
$wb["banned_admin_txt"] = 'Banned admin';
$wb["bad_header_admin_txt"] = 'Bad header admin';
$wb["spam_admin_txt"] = 'SPAM admin';
$wb["message_size_limit_txt"] = 'Message size limit';
$wb["banned_rulenames_txt"] = 'Banned rulenames';
?>
\ No newline at end of file
<?php
$module = array (
'name' => 'mail',
'title' => 'Email',
'template' => 'module.tpl.htm',
'navframe_page' => '',
'startpage' => 'mail/mail_domain_list.php',
'tab_width' => '',
'nav' =>
array (
0 =>
array (
'title' => 'Email Accounts',
'open' => 1,
'items' =>
array (
0 =>
array (
'title' => 'Domain',
'target' => 'content',
'link' => 'mail/mail_domain_list.php',
),
3 =>
array (
'title' => 'Email Mailbox',
'target' => 'content',
'link' => 'mail/mail_user_list.php',
),
4 =>
array (
'title' => 'Email Alias',
'target' => 'content',
'link' => 'mail/mail_alias_list.php',
),
5 =>
array (
'title' => 'Email Forward',
'target' => 'content',
'link' => 'mail/mail_forward_list.php',
),
6 =>
array (
'title' => 'Email Catchall',
'target' => 'content',
'link' => 'mail/mail_domain_catchall_list.php',
),
7 =>
array (
'title' => 'Email Routing',
'target' => 'content',
'link' => 'mail/mail_transport_list.php',
),
),
),
1 =>
array (
'title' => 'Email Filter',
'open' => 1,
'items' =>
array (
0 =>
array (
'title' => 'Whitelist',
'target' => 'content',
'link' => 'mail/mail_whitelist_list.php',
),
1 =>
array (
'title' => 'Blacklist',
'target' => 'content',
'link' => 'mail/mail_blacklist_list.php',
),
),
),
2 =>
array (
'title' => 'Spamfilter',
'open' => 1,
'items' =>
array (
0 =>
array (
'title' => 'Whitelist',
'target' => 'content',
'link' => 'mail/spamfilter_whitelist_list.php',
),
1 =>
array (
'title' => 'Blacklist',
'target' => 'content',
'link' => 'mail/spamfilter_blacklist_list.php',
),
2 =>
array (
'title' => 'User',
'target' => 'content',
'link' => 'mail/spamfilter_users_list.php',
),
3 =>
array (
'title' => 'Policy',
'target' => 'content',
'link' => 'mail/spamfilter_policy_list.php',
),
),
),
3 =>
array (
'title' => 'Fetchmail',
'open' => 1,
'items' =>
array (
0 =>
array (
'title' => 'Fetchmail',
'target' => 'content',
'link' => 'mail/mail_get_list.php',
),
),
),
),
)
<?php
$module["name"] = "mail";
$module["title"] = "Email";
$module["template"] = "module.tpl.htm";
$module["startpage"] = "mail/mail_domain_list.php";
$module["tab_width"] = '';
/*
Email accounts menu
*/
$items[] = array( 'title' => "Domain",
'target' => 'content',
'link' => 'mail/mail_domain_list.php');
$items[] = array( 'title' => "Email Mailbox",
'target' => 'content',
'link' => 'mail/mail_user_list.php');
$items[] = array( 'title' => "Email Alias",
'target' => 'content',
'link' => 'mail/mail_alias_list.php');
$items[] = array( 'title' => "Email Forward",
'target' => 'content',
'link' => 'mail/mail_forward_list.php');
$items[] = array( 'title' => "Email Catchall",
'target' => 'content',
'link' => 'mail/mail_domain_catchall_list.php');
$items[] = array( 'title' => "Email Routing",
'target' => 'content',
'link' => 'mail/mail_transport_list.php');
$module["nav"][] = array( 'title' => 'Email Accounts',
'open' => 1,
'items' => $items);
// aufrumen
unset($items);
/*
Spamfilter menu
*/
$items[] = array( 'title' => "Whitelist",
'target' => 'content',
'link' => 'mail/spamfilter_whitelist_list.php');
$items[] = array( 'title' => "Blacklist",
'target' => 'content',
'link' => 'mail/spamfilter_blacklist_list.php');
if($_SESSION["s"]["user"]["typ"] == 'admin') {
$items[] = array