diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php new file mode 100644 index 0000000000000000000000000000000000000000..5957e4887600fa32564db65a2a3c63be28f3e6a3 --- /dev/null +++ b/install/dist/conf/debian40.conf.php @@ -0,0 +1,59 @@ + \ No newline at end of file diff --git a/install/dist/lib/debian40.lib.php b/install/dist/lib/debian40.lib.php new file mode 100644 index 0000000000000000000000000000000000000000..cf8e864e6b00227b6730ef61a6c7aea8595dfe8f --- /dev/null +++ b/install/dist/lib/debian40.lib.php @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/install/install.php b/install/install.php new file mode 100644 index 0000000000000000000000000000000000000000..ec2e5ff1163d5126866994b16e23d18447eb3971 --- /dev/null +++ b/install/install.php @@ -0,0 +1,113 @@ +request_language(); + +// TODO: all other queries, for testing I will setup everything in $conf + +// Initialize the MySQL server connection +include_once('lib/mysql.lib.php'); +$inst->db = new db(); + +// Create the mysql database +//$inst->configure_database(); + +// Configure postfix +$inst->configure_postfix(); + +// Configure saslauthd +swriteln('Configuring SASL'); +$inst->configure_saslauthd(); + + +// Configure PAM +swriteln('Configuring PAM'); +$inst->configure_pam(); + +// Configure courier +swriteln('Configuring Courier'); +$inst->configure_courier(); + +// Configure Spamasassin +swriteln('Configuring Spamassassin'); +$inst->configure_spamassassin(); + +// Configure Amavis +swriteln('Configuring Amavisd'); +$inst->configure_amavis(); + +// Configure Amavis +swriteln('Installing ISPConfig'); +$inst->install_ispconfig(); + + +/* +Restart services: + +saslauthd +all courier +apache2 +postfix +amavisd +calmd +spamd + + + +*/ + + +echo "Installation finished.\n"; + + +?> \ No newline at end of file diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php new file mode 100644 index 0000000000000000000000000000000000000000..a9f120df5ba547a6d63f27f31e8df4062f36c431 --- /dev/null +++ b/install/lib/install.lib.php @@ -0,0 +1,382 @@ +> ".$logfile); +} + +function error($msg){ + ilog($msg); + die($msg."\n"); +} + +function caselog($command, $file = '', $line = '', $success = '', $failure = ''){ + exec($command,$arr,$ret_val); + $arr = NULL; + if(!empty($file) && !empty($line)){ + $pre = $file.", Line ".$line.": "; + } else { + $pre = ""; + } + if($ret_val != 0){ + if($failure == "") $failure = "could not ".$command; + ilog($pre."WARNING: ".$failure); + } else { + if($success == "") $success = $command; + ilog($pre.$success); + } +} + +function phpcaselog($ret_val, $msg, $file = '', $line = ''){ + if(!empty($file) && !empty($line)){ + $pre = $file.", Line ".$line.": "; + } else { + $pre = ""; + } + if($ret_val == true){ + ilog($pre.$msg); + } else { + ilog($pre."WARNING: could not ".$msg); + } + return $ret_val; +} + +function mkdirs($strPath, $mode = '0755'){ + if(isset($strPath) && $strPath != ""){ + // Verzeichnisse rekursiv erzeugen + if(is_dir($strPath)) return true; + $pStrPath = dirname($strPath); + if(!mkdirs($pStrPath, $mode)) return false; + $old_umask = umask(0); + $ret_val = mkdir($strPath, octdec($mode)); + umask($old_umask); + return $ret_val; + } else { + return false; + } +} + +function rf($file){ + clearstatcache(); + if(!$fp = fopen ($file, "rb")) ilog("WARNING: could not open file ".$file); + if(filesize($file) > 0){ + $content = fread($fp, filesize($file)); + } else { + $content = ""; + } + fclose($fp); + return $content; +} + +function wf($file, $content){ + mkdirs(dirname($file)); + if(!$fp = fopen ($file, "wb")) ilog("WARNING: could not open file ".$file); + fwrite($fp,$content); + fclose($fp); +} + +function af($file, $content){ + mkdirs(dirname($file)); + if(!$fp = fopen ($file, "ab")) ilog("WARNING: could not open file ".$file); + fwrite($fp,$content); + fclose($fp); +} + +function aftsl($file, $content){ + if(!$fp = fopen ($file, "ab")) ilog("WARNING: could not open file ".$file); + fwrite($fp,$content); + fclose($fp); +} + +function unix_nl($input){ + $output = str_replace("\r\n", "\n", $input); + $output = str_replace("\r", "\n", $output); + return $output; +} + +function remove_blank_lines($input, $file = 1){ + //Leerzeilen l�schen + if($file){ + $content = unix_nl(rf($input)); + } else { + $content = $input; + } + $lines = explode("\n", $content); + if(!empty($lines)){ + foreach($lines as $line){ + if(trim($line) != "") $new_lines[] = $line; + } + } + if(is_array($new_lines)){ + $content = implode("\n", $new_lines); + } else { + $content = ""; + } + if($file){ + wf($input, $content); + } else { + return $content; + } +} + +function no_comments($file, $comment = '#'){ + $content = unix_nl(rf($file)); + $lines = explode("\n", $content); + if(!empty($lines)){ + foreach($lines as $line){ + if(strstr($line, $comment)){ + $pos = strpos($line, $comment); + if($pos != 0){ + $new_lines[] = substr($line,0,$pos); + } else { + $new_lines[] = ""; + } + } else { + $new_lines[] = $line; + } + } + } + if(is_array($new_lines)){ + $content_without_comments = implode("\n", $new_lines); + $new_lines = NULL; + return $content_without_comments; + } else { + return ""; + } +} + +function find_includes($file){ + global $httpd_root; + clearstatcache(); + if(is_file($file) && filesize($file) > 0){ + $includes[] = $file; + $inhalt = unix_nl(no_comments($file)); + $lines = explode("\n", $inhalt); + if(!empty($lines)){ + foreach($lines as $line){ + if(stristr($line, "include ")){ + $include_file = str_replace("\n", "", trim(shell_exec("echo \"$line\" | awk '{print \$2}'"))); + if(substr($include_file,0,1) != "/"){ + $include_file = $httpd_root."/".$include_file; + } + if(is_file($include_file)){ + if($further_includes = find_includes($include_file)){ + $includes = array_merge($includes, $further_includes); + } + } else { + if(strstr($include_file, "*")){ + $more_files = explode("\n", shell_exec("ls -l $include_file | awk '{print \$9}'")); + if(!empty($more_files)){ + foreach($more_files as $more_file){ + if(is_file($more_file)){ + if($further_includes = find_includes($more_file)){ + $includes = array_merge($includes, $further_includes); + } + } + } + } + unset($more_files); + $more_files = explode("\n", shell_exec("ls -l $include_file | awk '{print \$10}'")); + if(!empty($more_files)){ + foreach($more_files as $more_file){ + if(is_file($more_file)){ + if($further_includes = find_includes($more_file)){ + $includes = array_merge($includes, $further_includes); + } + } + } + } + } + } + } + } + } + } + if(is_array($includes)){ + $includes = array_unique($includes); + return $includes; + } else { + return false; + } +} + +function comment_out($file, $string){ + $inhalt = no_comments($file); + $gesamt_inhalt = rf($file); + $modules = explode(",",$string); + foreach($modules as $val){ + $val = trim($val); + if(strstr($inhalt, $val)){ + $gesamt_inhalt = str_replace($val, "##ISPConfig INSTALL## ".$val, $gesamt_inhalt); + } + } + wf($file, $gesamt_inhalt); +} + +function is_word($string, $text, $params = ''){ + // params: i + if(preg_match("/\b$string\b/$params", $text)) { + return true; + } else { + return false; + } +} + +function grep($content, $string, $params = ''){ + // params: i, v, w + $content = unix_nl($content); + $lines = explode("\n", $content); + foreach($lines as $line){ + if(!strstr($params, 'w')){ + if(strstr($params, 'i')){ + if(strstr($params, 'v')){ + if(!stristr($line, $string)) $find[] = $line; + } else { + if(stristr($line, $string)) $find[] = $line; + } + } else { + if(strstr($params, 'v')){ + if(!strstr($line, $string)) $find[] = $line; + } else { + if(strstr($line, $string)) $find[] = $line; + } + } + } else { + if(strstr($params, 'i')){ + if(strstr($params, 'v')){ + if(!is_word($string, $line, 'i')) $find[] = $line; + } else { + if(is_word($string, $line, 'i')) $find[] = $line; + } + } else { + if(strstr($params, 'v')){ + if(!is_word($string, $line)) $find[] = $line; + } else { + if(is_word($string, $line)) $find[] = $line; + } + } + } + } + if(is_array($find)){ + $ret_val = implode("\n", $find); + if(substr($ret_val,-1) != "\n") $ret_val .= "\n"; + $find = NULL; + return $ret_val; + } else { + return false; + } +} + +function edit_xinetd_conf($service){ + $xinetd_conf = "/etc/xinetd.conf"; + $contents = unix_nl(rf($xinetd_conf)); + $lines = explode("\n", $contents); + $j = sizeof($lines); + for($i=0;$i + +*/ + + + +?> \ No newline at end of file diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php new file mode 100644 index 0000000000000000000000000000000000000000..3dc0214ebbd29e33c572e1b89a7cf925ee6e2a0d --- /dev/null +++ b/install/lib/installer_base.lib.php @@ -0,0 +1,500 @@ +check_break($lang) or $this-> + */ + + + } + + /* + This function creates the database for ISPConfig + */ + + function configure_database() { + global $conf; + + // Create the database + if(!$this->db->query("CREATE DATABASE IF NOT EXISTS ".$conf["mysql_server_database"])) { + $this->error('Unable to create MySQL database: '.$conf["mysql_server_database"].';'); + } + + // Create the ISPConfig database user + if(!$this->db->query("GRANT SELECT, INSERT, UPDATE, DELETE ON ".$conf["mysql_server_database"].".* TO '".$conf["mysql_server_ispconfig_user"]."'@'".$conf["mysql_server_host"]."' IDENTIFIED BY '".$conf["mysql_server_ispconfig_password"]."';")) { + $this->error('Unable to create database user: '.$conf["mysql_server_ispconfig_user"]); + } + + // Reload database priveliges + $this->db->query('FLUSH PRIVILEGES;'); + + // Set the database name in the DB library + $this->db->dbName = $conf["mysql_server_database"]; + + // loading the database dump into the database, if database is empty + $db_tables = $this->db->getTables(); + if(count($db_tables) > 0) { + $this->error('Stopped: Database contains already some tables.'); + } else { + if($conf["mysql_server_admin_password"] == '') { + caselog("mysql -h '".$conf["mysql_server_host"]."' -u '".$conf["mysql_server_admin_user"]."' '".$conf["mysql_server_database"]."' < 'sql/ispconfig3.sql' &> /dev/null", $FILE, __LINE__,"read in ispconfig3.sql","could not read in ispconfig3.sql"); + } else { + caselog("mysql -h '".$conf["mysql_server_host"]."' -u '".$conf["mysql_server_admin_user"]."' -p'".$conf["mysql_server_admin_password"]."' '".$conf["mysql_server_database"]."' < 'sql/ispconfig3.sql' &> /dev/null", $FILE, __LINE__,"read in ispconfig3.sql","could not read in ispconfig3.sql"); + } + $db_tables = $this->db->getTables(); + if(count($db_tables) == 0) { + $this->error('Unable to load SQL-Dump into database table.'); + } + } + } + + /* + Create postfix configuration files + */ + + function configure_postfix() { + global $conf; + + if(!is_dir($conf["dist_postfix_config_dir"])) $this->error("The postfix configuration directory ".$conf["dist_postfix_config_dir"]." does not exist."); + + // mysql-virtual_domains.cf + $configfile = 'mysql-virtual_domains.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_forwardings.cf + $configfile = 'mysql-virtual_forwardings.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_mailboxes.cf + $configfile = 'mysql-virtual_mailboxes.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_email2email.cf + $configfile = 'mysql-virtual_email2email.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_transports.cf + $configfile = 'mysql-virtual_transports.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_recipient.cf + $configfile = 'mysql-virtual_recipient.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_sender.cf + $configfile = 'mysql-virtual_sender.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // mysql-virtual_client.cf + $configfile = 'mysql-virtual_client.cf'; + if(is_file($conf["dist_postfix_config_dir"].'/'.$configfile)) copy($conf["dist_postfix_config_dir"].'/'.$configfile,$conf["dist_postfix_config_dir"].'/'.$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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/'.$configfile,$content); + + // Changing mode and group of the new created config files. + caselog("chmod o= ".$conf["dist_postfix_config_dir"]."/mysql-virtual_*.cf* &> /dev/null", __FILE__, __LINE__,"chmod on mysql-virtual_*.cf*","chmod on mysql-virtual_*.cf* failed"); + caselog("chgrp ".$conf["dist_postfix_groupname"]." ".$conf["dist_postfix_config_dir"]."/mysql-virtual_*.cf* &> /dev/null", __FILE__, __LINE__,"chgrp on mysql-virtual_*.cf*","chgrp on mysql-virtual_*.cf* failed"); + + // Creating virtual mail user and group + $command = "groupadd -g ".$conf["dist_postfix_vmail_groupid"]." ".$conf["dist_postfix_vmail_groupname"]; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + $command = "useradd -g ".$conf["dist_postfix_vmail_groupname"]." -u ".$conf["dist_postfix_vmail_userid"]." ".$conf["dist_postfix_vmail_username"]." -d ".$conf["dist_postfix_vmail_mailbox_base"]." -m"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + $postconf_commands = array ( + 'myhostname = '.$conf["hostname"], + 'mydestination = '.$conf["hostname"].', localhost, localhost.localdomain', + 'mynetworks = 127.0.0.0/8', + 'virtual_alias_domains =', + 'virtual_alias_maps = proxy:mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_forwardings.cf, mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_email2email.cf', + 'virtual_mailbox_domains = proxy:mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_domains.cf', + 'virtual_mailbox_maps = proxy:mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_mailboxes.cf', + 'virtual_mailbox_base = '.$conf["dist_postfix_vmail_mailbox_base"], + 'virtual_uid_maps = static:'.$conf["dist_postfix_vmail_userid"], + 'virtual_gid_maps = static:'.$conf["dist_postfix_vmail_groupid"], + 'smtpd_sasl_auth_enable = yes', + 'broken_sasl_auth_clients = yes', + 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_recipient.cf, reject_unauth_destination', + 'smtpd_use_tls = yes', + 'smtpd_tls_cert_file = '.$conf["dist_postfix_config_dir"].'/smtpd.cert', + 'smtpd_tls_key_file = '.$conf["dist_postfix_config_dir"].'/smtpd.key', + 'transport_maps = proxy:mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_transports.cf', + 'virtual_create_maildirsize = yes', + 'virtual_mailbox_extended = yes', + 'virtual_mailbox_limit_maps = proxy:mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_mailbox_limit_maps.cf', + 'virtual_mailbox_limit_override = yes', + 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."', + 'virtual_overquota_bounce = yes', + 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps', + 'smtpd_sender_restrictions = check_sender_access mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_sender.cf', + 'smtpd_client_restrictions = check_client_access mysql:'.$conf["dist_postfix_config_dir"].'/mysql-virtual_client.cf', + 'maildrop_destination_concurrency_limit = 1', + 'maildrop_destination_recipient_limit = 1', + 'virtual_transport = maildrop' + ); + + // Make a backup copy of the main.cf file + copy($conf["dist_postfix_config_dir"].'/main.cf',$conf["dist_postfix_config_dir"].'/main.cf~'); + + // Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + } + + // TODO: Change the master.cf file + /* + Add: +maildrop unix - n n - - pipe + flags=R user=vmail argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender} + + */ + + // Create the SSL certificate + $command = "cd ".$conf["dist_postfix_config_dir"]."; openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509"; + exec($command); + + $command = "chmod o= ".$conf["dist_postfix_config_dir"]."/smtpd.key"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + /* + We have to change the permissions of the courier authdaemon directory + to make it accessible for maildrop. + */ + + $command = "chmod 755 /var/run/courier/authdaemon/"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // Writing the Maildrop mailfilter file + $configfile = 'mailfilter'; + if(is_file($conf["dist_postfix_vmail_mailbox_base"].'/.'.$configfile)) copy($conf["dist_postfix_vmail_mailbox_base"].'/.'.$configfile,$conf["dist_postfix_vmail_mailbox_base"].'/.'.$configfile.'~'); + $content = rf("tpl/".$configfile.".master"); + $content = str_replace('{dist_postfix_vmail_mailbox_base}',$conf["dist_postfix_vmail_mailbox_base"],$content); + wf($conf["dist_postfix_vmail_mailbox_base"].'/.'.$configfile,$content); + + // Create the directory for the custom mailfilters + $command = "mkdir ".$conf["dist_postfix_vmail_mailbox_base"]."/mailfilters"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // Chmod and chown the .mailfilter file + $command = "chown -R ".$conf["dist_postfix_vmail_username"].":".$conf["dist_postfix_vmail_groupname"]." ".$conf["dist_postfix_vmail_mailbox_base"]."/.mailfilter"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + $command = "chmod -R 600 ".$conf["dist_postfix_vmail_mailbox_base"]."/.mailfilter"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + + + } + + function configure_saslauthd() { + global $conf; + + /* + + TODO: The example below is for Ubuntu 6.10 + + mkdir -p /var/spool/postfix/var/run/saslauthd + +Edit /etc/default/saslauthd. Remove the # in front of START=yes and add the line PARAMS="-m /var/spool/postfix/var/run/saslauthd -r". + +vi /etc/default/saslauthd + +The file should then look like this: + +# This needs to be uncommented before saslauthd will be run automatically +START=yes + +# You must specify the authentication mechanisms you wish to use. +# This defaults to "pam" for PAM support, but may also include +# "shadow" or "sasldb", like this: +# MECHANISMS="pam shadow" + +MECHANISMS="pam" +PARAMS="-m /var/spool/postfix/var/run/saslauthd -r" + +We must also edit /etc/init.d/saslauthd and change the location of saslauthd's PID file. + +vi /etc/init.d/saslauthd + +Change the value of PIDFILE to /var/spool/postfix/var/run/${NAME}/saslauthd.pid: + +PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid" + + +Then restart Postfix and Saslauthd: + +/etc/init.d/postfix restart +postfix check +/etc/init.d/saslauthd restart + + + */ + + $configfile = 'sasl_smtpd.conf'; + if(is_file($conf["dist_postfix_config_dir"].'/sasl/smtpd.conf')) copy($conf["dist_postfix_config_dir"].'/sasl/smtpd.conf',$conf["dist_postfix_config_dir"].'/sasl/smtpd.conf~'); + exec('chmod 400 '.$conf["dist_postfix_config_dir"].'/sasl/smtpd.conf~'); + $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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_postfix_config_dir"].'/sasl/smtpd.conf',$content); + + // TODO: Chmod and chown on the config file + + + } + + function configure_pam() { + global $conf; + + // configure pam for SMTP authentication agains the ispconfig database + $configfile = 'pamd_smtp'; + if(is_file('/etc/pam.d/smtp')) copy('/etc/pam.d/smtp','/etc/pam.d/smtp~'); + exec('chmod 400 /etc/pam.d/smtp~'); + $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_ip}',$conf["mysql_server_ip"],$content); + wf('/etc/pam.d/smtp',$content); + exec('chmod 660 /etc/pam.d/smtp'); + exec('chown daemon:daemon /etc/pam.d/smtp'); + + } + + function configure_courier() { + global $conf; + + // authmysqlrc + $configfile = 'authmysqlrc'; + if(is_file($conf["dist_courier_config_dir"].'/'.$configfile)) copy($conf["dist_courier_config_dir"].'/'.$configfile,$conf["dist_courier_config_dir"].'/'.$configfile.'~'); + exec('chmod 400 '.$conf["dist_courier_config_dir"].'/'.$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["dist_courier_config_dir"].'/'.$configfile,$content); + + exec('chmod 660 '.$conf["dist_courier_config_dir"].'/'.$configfile); + exec('chown daemon:daemon '.$conf["dist_courier_config_dir"].'/'.$configfile); + } + + function configure_amavis() { + global $conf; + + // amavisd user config file + $configfile = 'amavisd_user_config'; + if(is_file($conf["dist_amavis_config_dir"].'/50-user')) copy($conf["dist_amavis_config_dir"].'/50-user',$conf["dist_courier_config_dir"].'/50-user~'); + exec('chmod 400 '.$conf["dist_courier_config_dir"].'/50-user~'); + $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_ip}',$conf["mysql_server_ip"],$content); + wf($conf["dist_amavis_config_dir"].'/50-user',$content); + + // TODO: chmod and chown on the config file + + + // Adding the amavisd commands to the postfix configuration + $postconf_commands = array ( + 'content_filter = amavis:[127.0.0.1]:10024', + 'receive_override_options = no_address_mappings' + ); + + // Make a backup copy of the main.cf file + copy($conf["dist_postfix_config_dir"].'/main.cf',$conf["dist_postfix_config_dir"].'/main.cf~2'); + + // Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + } + + // Append the configuration for amavisd to the master.cf file + if(is_file($conf["dist_postfix_config_dir"].'/master.cf')) copy($conf["dist_postfix_config_dir"].'/master.cf',$conf["dist_postfix_config_dir"].'/master.cf~'); + $content = rf("tpl/master_cf_amavis.master"); + // Only add the content if we had not addded it before + if(!stristr("127.0.0.1:10025 inet n - - - - smtpd",$content)) { + af($conf["dist_postfix_config_dir"].'/master.cf',$content); + } + + // Add the clamav user to the amavis group + exec('adduser clamav amavis'); + + + } + + function configure_spamassassin() { + global $conf; + + // Enable spamasasssin in debian and ubunti + $configfile = '/etc/default/spamassassin'; + if(is_file($configfile)) copy($configfile,$configfile.'~'); + $content = rf($configfile); + $content = str_replace('ENABLED=0','ENABLED=1',$content); + wf($configfile,$content); + } + + + function install_ispconfig() { + global $conf; + + // Create the ISPConfig installation directory + $command = "mkdir ".$conf["ispconfig_install_dir"]; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // Create a ISPConfig user and group + $command = "groupadd ispconfig"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + $command = "useradd -g ispconfig -d ".$conf["ispconfig_install_dir"]." ispconfig"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // copy the ISPConfig interface part + $command = "cp -rf ../interface ".$conf["ispconfig_install_dir"]; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // copy the ISPConfig server part + $command = "cp -rf ../server ".$conf["ispconfig_install_dir"]; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // Create a symlink, so ISPConfig is accessible via web + $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 + $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"); + $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"].'/interface/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); + + // chown the files to the ispconfig user and group + $command = "chown -R ispconfig:ispconfig ".$conf["ispconfig_install_dir"]; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + // TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing + // and must be fixed as this will allow the apache user to read the ispconfig files. + // Later this must run as own apache server or via suexec! + + $command = "adduser www-data ispconfig"; + caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command); + + + } + + + +} + +?> \ No newline at end of file diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php new file mode 100644 index 0000000000000000000000000000000000000000..5cf4f0a594a3294c293144d37af8bab3532d5638 --- /dev/null +++ b/install/lib/mysql.lib.php @@ -0,0 +1,498 @@ +dbHost = $conf["mysql_server_host"]; + //$this->dbName = $conf["mysql_server_database"]; + $this->dbUser = $conf["mysql_server_admin_user"]; + $this->dbPass = $conf["mysql_server_admin_password"]; + //$this->connect(); + } + + // error handler + function updateError($location) + { + $this->errorNumber = mysql_errno(); + $this->errorMessage = mysql_error(); + $this->errorLocation = $location; + if($this->errorNumber && $this->show_error_messages) + { + echo('
'.$this->errorLocation.'
'.$this->errorMessage); + flush(); + } + } + + function connect() + { + if($this->linkId == 0) + { + $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); + if(!$this->linkId) + { + $this->updateError('DB::connect()
mysql_connect'); + return false; + } + } + return true; + } + + function query($queryString) + { + if(!$this->connect()) + { + return false; + } + if($this->dbName != '') { + if(!mysql_select_db($this->dbName, $this->linkId)) + { + $this->updateError('DB::connect()
mysql_select_db'); + return false; + } + } + $this->queryId = @mysql_query($queryString, $this->linkId); + $this->updateError('DB::query('.$queryString.')
mysql_query'); + if(!$this->queryId) + { + return false; + } + $this->currentRow = 0; + return $this->queryId; + } + + // returns all records in an array + function queryAllRecords($queryString) + { + if(!$this->query($queryString)) + { + return false; + } + $ret = array(); + while($line = $this->nextRecord()) + { + $ret[] = $line; + } + return $ret; + } + + // returns one record in an array + function queryOneRecord($queryString) + { + if(!$this->query($queryString) || $this->numRows() == 0) + { + return false; + } + return $this->nextRecord(); + } + + // returns the next record in an array + function nextRecord() + { + $this->record = mysql_fetch_assoc($this->queryId); + $this->updateError('DB::nextRecord()
mysql_fetch_array'); + if(!$this->record || !is_array($this->record)) + { + return false; + } + $this->currentRow++; + return $this->record; + } + + // returns number of rows returned by the last select query + function numRows() + { + return mysql_num_rows($this->queryId); + } + + function affectedRows() + { + return mysql_affected_rows($this->linkId); + } + + // returns mySQL insert id + function insertID() + { + return mysql_insert_id($this->linkId); + } + + // Check der variablen + // deprecated, now use quote + function check($formfield) + { + return $this->quote($formfield); + } + + // Check der variablen + function quote($formfield) + { + return addslashes($formfield); + } + + // Check der variablen + function unquote($formfield) + { + return stripslashes($formfield); + } + + function toLower($record) { + if(is_array($record)) { + foreach($record as $key => $val) { + $key = strtolower($key); + $out[$key] = $val; + } + } + return $out; + } + + + function insert($tablename,$form,$debug = 0) + { + if(is_array($form)){ + foreach($form as $key => $value) + { + $sql_key .= "$key, "; + $sql_value .= "'".$this->check($value)."', "; + } + $sql_key = substr($sql_key,0,strlen($sql_key) - 2); + $sql_value = substr($sql_value,0,strlen($sql_value) - 2); + + $sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")"; + + if($debug == 1) echo "SQL-Statement: ".$sql."

"; + $this->query($sql); + if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage; + } + } + + function update($tablename,$form,$bedingung,$debug = 0) + { + + if(is_array($form)){ + foreach($form as $key => $value) + { + $insql .= "$key = '".$this->check($value)."', "; + } + $insql = substr($insql,0,strlen($insql) - 2); + $sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung"; + if($debug == 1) echo "SQL-Statement: ".$sql."

"; + $this->query($sql); + if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage; + } + } + + function closeConn() { + + } + + function freeResult() { + + + } + + function delete() { + + } + + function Transaction($action) { + //action = begin, commit oder rollback + + } + + /* + $columns = array(action => add | alter | drop + name => Spaltenname + name_new => neuer Spaltenname, nur bei 'alter' belegt + type => 42go-Meta-Type: int16, int32, int64, double, char, varchar, text, blob + typeValue => Wert z.B. bei Varchar + defaultValue => Default Wert + notNull => true | false + autoInc => true | false + option => unique | primary | index) + + + */ + + function createTable($table_name,$columns) { + $index = ""; + $sql = "CREATE TABLE $table_name ("; + foreach($columns as $col){ + $sql .= $col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." "; + + if($col["defaultValue"] != "") { + if($col["defaultValue"] == "NULL" or $col["defaultValue"] == "NOT NULL") { + $sql .= "DEFAULT ".$col["defaultValue"]." "; + } else { + $sql .= "DEFAULT '".$col["defaultValue"]."' "; + } + + } elseif($col["defaultValue"] != false) { + $sql .= "DEFAULT '' "; + } + if($col["defaultValue"] != "NULL" && $col["defaultValue"] != "NOT NULL") { + if($col["notNull"] == true) { + $sql .= "NOT NULL "; + } else { + $sql .= "NULL "; + } + } + if($col["autoInc"] == true) $sql .= "auto_increment "; + $sql.= ","; + // key Definitionen + if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),"; + if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),"; + if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),"; + } + $sql .= $index; + $sql = substr($sql,0,-1); + $sql .= ")"; + + $this->query($sql); + return true; + } + + /* + $columns = array(action => add | alter | drop + name => Spaltenname + name_new => neuer Spaltenname, nur bei 'alter' belegt + type => 42go-Meta-Type: int16, int32, int64, double, char, varchar, text, blob + typeValue => Wert z.B. bei Varchar + defaultValue => Default Wert + notNull => true | false + autoInc => true | false + option => unique | primary | index) + + + */ + function alterTable($table_name,$columns) { + $index = ""; + $sql = "ALTER TABLE $table_name "; + foreach($columns as $col){ + if($col["action"] == 'add') { + $sql .= "ADD ".$col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." "; + } elseif ($col["action"] == 'alter') { + $sql .= "CHANGE ".$col["name"]." ".$col["name_new"]." ".$this->mapType($col["type"],$col["typeValue"])." "; + } elseif ($col["action"] == 'drop') { + $sql .= "DROP ".$col["name"]." "; + } + if($col["action"] != 'drop') { + if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' "; + if($col["notNull"] == true) { + $sql .= "NOT NULL "; + } else { + $sql .= "NULL "; + } + if($col["autoInc"] == true) $sql .= "auto_increment "; + $sql.= ","; + // key Definitionen + if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),"; + if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),"; + if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),"; + } + } + $sql .= $index; + $sql = substr($sql,0,-1); + + //die($sql); + $this->query($sql); + return true; + } + + function dropTable($table_name) { + $this->check($table_name); + $sql = "DROP TABLE '". $table_name."'"; + return $this->query($sql); + } + + // gibt Array mit Tabellennamen zurück + function getTables($database_name = '') { + + if($database_name == '') $database_name = $this->dbName; + $result = mysql_list_tables($database_name); + for ($i = 0; $i < mysql_num_rows($result); $i++) { + $tb_names[$i] = mysql_tablename($result, $i); + } + return $tb_names; + } + + // gibt Feldinformationen zur Tabelle zurück + /* + $columns = array(action => add | alter | drop + name => Spaltenname + name_new => neuer Spaltenname, nur bei 'alter' belegt + type => 42go-Meta-Type: int16, int32, int64, double, char, varchar, text, blob + typeValue => Wert z.B. bei Varchar + defaultValue => Default Wert + notNull => true | false + autoInc => true | false + option => unique | primary | index) + + + */ + + function tableInfo($table_name) { + + global $go_api,$go_info; + // Tabellenfelder einlesen + + if($rows = $go_api->db->queryAllRecords("SHOW FIELDS FROM ".$table_name)){ + foreach($rows as $row) { + $name = $row[0]; + $default = $row[4]; + $key = $row[3]; + $extra = $row[5]; + $isnull = $row[2]; + $type = $row[1]; + + + $column = array(); + + $column["name"] = $name; + //$column["type"] = $type; + $column["defaultValue"] = $default; + if(stristr($key,"PRI")) $column["option"] = "primary"; + if(stristr($isnull,"YES")) { + $column["notNull"] = false; + } else { + $column["notNull"] = true; + } + if($extra == 'auto_increment') $column["autoInc"] = true; + + + // Type in Metatype umsetzen + + if(stristr($type,"int(")) $metaType = 'int32'; + if(stristr($type,"bigint")) $metaType = 'int64'; + if(stristr($type,"char")) { + $metaType = 'char'; + $tmp_typeValue = explode('(',$type); + $column["typeValue"] = substr($tmp_typeValue[1],0,-1); + } + if(stristr($type,"varchar")) { + $metaType = 'varchar'; + $tmp_typeValue = explode('(',$type); + $column["typeValue"] = substr($tmp_typeValue[1],0,-1); + } + if(stristr($type,"text")) $metaType = 'text'; + if(stristr($type,"double")) $metaType = 'double'; + if(stristr($type,"blob")) $metaType = 'blob'; + + + $column["type"] = $metaType; + + $columns[] = $column; + } + return $columns; + } else { + return false; + } + + + //$this->createTable('tester',$columns); + + /* + $result = mysql_list_fields($go_info["server"]["db_name"],$table_name); + $fields = mysql_num_fields ($result); + $i = 0; + $table = mysql_field_table ($result, $i); + while ($i < $fields) { + $name = mysql_field_name ($result, $i); + $type = mysql_field_type ($result, $i); + $len = mysql_field_len ($result, $i); + $flags = mysql_field_flags ($result, $i); + print_r($flags); + + $columns = array(name => $name, + type => "", + defaultValue => "", + isnull => 1, + option => ""); + $returnvar[] = $columns; + + $i++; + } + */ + + + + } + + function mapType($metaType,$typeValue) { + global $go_api; + $metaType = strtolower($metaType); + switch ($metaType) { + case 'int16': + return 'smallint'; + break; + case 'int32': + return 'int'; + break; + case 'int64': + return 'bigint'; + break; + case 'double': + return 'double'; + break; + case 'char': + return 'char'; + break; + case 'varchar': + if($typeValue < 1) die("Datenbank Fehler: Für diesen Datentyp ist eine Längenangabe notwendig."); + return 'varchar('.$typeValue.')'; + break; + case 'text': + return 'text'; + break; + case 'blob': + return 'blob'; + break; + } + } + + } + +?> \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql new file mode 100644 index 0000000000000000000000000000000000000000..7d3f881059dc79e46d8f5b8ab1b4ed05be2e55ba --- /dev/null +++ b/install/sql/ispconfig3.sql @@ -0,0 +1,618 @@ +-- phpMyAdmin SQL Dump +-- version 2.9.0.3 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 19. April 2007 um 12:05 +-- Server Version: 5.0.24 +-- PHP-Version: 5.1.4 +-- +-- Datenbank: `ispconfig3` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `dns_rr` +-- + +CREATE TABLE `dns_rr` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL, + `sys_groupid` int(11) NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `zone` int(10) unsigned NOT NULL, + `name` char(64) NOT NULL, + `type` enum('A','AAAA','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') default NULL, + `data` char(128) NOT NULL, + `aux` int(10) unsigned NOT NULL, + `ttl` int(10) unsigned NOT NULL default '86400', + PRIMARY KEY (`id`), + UNIQUE KEY `rr` (`zone`,`name`,`type`,`data`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `dns_rr` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `dns_soa` +-- + +CREATE TABLE `dns_soa` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL, + `sys_groupid` int(11) NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `origin` char(255) NOT NULL, + `ns` char(255) NOT NULL, + `mbox` char(255) NOT NULL, + `serial` int(10) unsigned NOT NULL default '1', + `refresh` int(10) unsigned NOT NULL default '28800', + `retry` int(10) unsigned NOT NULL default '7200', + `expire` int(10) unsigned NOT NULL default '604800', + `minimum` int(10) unsigned NOT NULL default '86400', + `ttl` int(10) unsigned NOT NULL default '86400', + `active` enum('Y','N') NOT NULL, + `xfer` char(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `origin` (`origin`), + KEY `active` (`active`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `dns_soa` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_access` +-- + +CREATE TABLE `mail_access` ( + `access_id` int(11) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `source` varchar(255) NOT NULL, + `access` varchar(255) NOT NULL, + `type` set('recipient','sender','client') NOT NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`access_id`), + KEY `server_id` (`server_id`,`source`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +-- +-- Daten für Tabelle `mail_access` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_domain` +-- + +CREATE TABLE `mail_domain` ( + `domain_id` int(11) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `active` enum('y','n') NOT NULL, + PRIMARY KEY (`domain_id`), + KEY `server_id` (`server_id`,`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; + +-- +-- Daten für Tabelle `mail_domain` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_forwarding` +-- + +CREATE TABLE `mail_forwarding` ( + `forwarding_id` int(11) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `source` varchar(255) NOT NULL, + `destination` varchar(255) NOT NULL default '', + `type` enum('alias','forward','catchall') NOT NULL default 'alias', + `active` enum('y','n') NOT NULL, + PRIMARY KEY (`forwarding_id`), + KEY `server_id` (`server_id`,`source`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; + +-- +-- Daten für Tabelle `mail_forwarding` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_greylist` +-- + +CREATE TABLE `mail_greylist` ( + `greylist_id` int(11) NOT NULL auto_increment, + `relay_ip` varchar(64) default NULL, + `from_domain` varchar(255) default NULL, + `block_expires` datetime NOT NULL default '0000-00-00 00:00:00', + `record_expires` datetime NOT NULL default '0000-00-00 00:00:00', + `origin_type` enum('MANUAL','AUTO') NOT NULL default 'AUTO', + `create_time` datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`greylist_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `mail_greylist` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_mailman_domain` +-- + +CREATE TABLE `mail_mailman_domain` ( + `mailman_id` int(11) NOT NULL auto_increment, + `server_id` int(11) NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `mm_home` varchar(255) NOT NULL default '', + `mm_wrap` varchar(255) NOT NULL default '', + `mm_user` varchar(50) NOT NULL default '', + `mm_group` varchar(50) NOT NULL default '', + PRIMARY KEY (`mailman_id`,`server_id`,`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `mail_mailman_domain` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_transport` +-- + +CREATE TABLE `mail_transport` ( + `transport_id` int(11) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `transport` varchar(255) NOT NULL, + `sort_order` int(11) NOT NULL default '5', + `active` enum('y','n') NOT NULL, + PRIMARY KEY (`transport_id`), + KEY `server_id` (`server_id`,`transport`), + KEY `server_id_2` (`server_id`,`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; + +-- +-- Daten für Tabelle `mail_transport` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_user` +-- + +CREATE TABLE `mail_user` ( + `mailuser_id` int(11) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `email` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL, + `name` varchar(128) NOT NULL default '', + `uid` int(10) unsigned NOT NULL default '5000', + `gid` int(10) unsigned NOT NULL default '5000', + `maildir` varchar(255) NOT NULL default '', + `quota` int(11) NOT NULL, + `homedir` varchar(255) NOT NULL, + `autoresponder` enum('n','y') NOT NULL default 'n', + `autoresponder_text` tinytext NOT NULL, + `postfix` enum('y','n') NOT NULL, + `access` enum('y','n') NOT NULL, + PRIMARY KEY (`mailuser_id`), + KEY `server_id` (`server_id`,`email`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; + +-- +-- Daten für Tabelle `mail_user` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `reseller` +-- + +CREATE TABLE `reseller` ( + `reseller_id` bigint(20) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `company` varchar(255) NOT NULL default '', + `title` varchar(255) NOT NULL default '', + `firstname` varchar(255) NOT NULL default '', + `surname` varchar(255) NOT NULL default '', + `street` varchar(255) NOT NULL default '', + `zip` varchar(255) NOT NULL default '', + `city` varchar(255) NOT NULL default '', + `country` varchar(255) NOT NULL default '', + `telephone` varchar(255) NOT NULL default '', + `mobile` varchar(255) NOT NULL default '', + `fax` varchar(255) NOT NULL default '', + `email` varchar(255) NOT NULL default '', + `internet` varchar(255) NOT NULL default '', + `icq` varchar(255) NOT NULL default '', + `notes` text NOT NULL, + `limit_client` int(11) NOT NULL default '-1', + `limit_domain` int(11) NOT NULL default '-1', + `limit_subdomain` int(11) NOT NULL default '-1', + `limit_mailbox` int(11) NOT NULL default '-1', + `limit_mailalias` int(11) NOT NULL default '-1', + `limit_webquota` int(11) NOT NULL default '-1', + `limit_mailquota` int(11) NOT NULL default '-1', + `limit_database` int(11) NOT NULL default '-1', + `ip_address` text NOT NULL, + PRIMARY KEY (`reseller_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `reseller` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `server` +-- + +CREATE TABLE `server` ( + `server_id` bigint(20) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_name` varchar(255) NOT NULL default '', + `mail_server` tinyint(4) NOT NULL default '0', + `web_server` tinyint(4) NOT NULL default '0', + `dns_server` tinyint(4) NOT NULL default '0', + `file_server` tinyint(4) NOT NULL default '0', + `db_server` tinyint(4) NOT NULL default '0', + `vserver_server` tinyint(4) NOT NULL default '0', + `config` text NOT NULL, + `updated` tinyint(4) NOT NULL default '0', + `active` tinyint(4) NOT NULL default '1', + PRIMARY KEY (`server_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; + +-- +-- Daten für Tabelle `server` +-- + +INSERT INTO `server` (`server_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`) VALUES +(1, 1, 1, 'riud', 'riud', '', 'Server 1', 1, 1, 1, 1, 1, 1, '[global]\r\nwebserver=apache\r\nmailserver=exim\r\ndnsserver=mydns\r\n\r\n[mail]\r\nmodule=postfix_mysql\r\nmaildir_path=/home/vmail/[domain]/[localpart]/\r\nhomedir_path=/home/vmail/\r\nmailuser_uid=5000\r\nmailuser_gid=5000', 0, 1); + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `spamfilter_policy` +-- + +CREATE TABLE `spamfilter_policy` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL, + `sys_groupid` int(11) NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `policy_name` varchar(32) default NULL, + `virus_lover` char(1) default NULL, + `spam_lover` char(1) default NULL, + `banned_files_lover` char(1) default NULL, + `bad_header_lover` char(1) default NULL, + `bypass_virus_checks` char(1) default NULL, + `bypass_spam_checks` char(1) default NULL, + `bypass_banned_checks` char(1) default NULL, + `bypass_header_checks` char(1) default NULL, + `spam_modifies_subj` char(1) default NULL, + `virus_quarantine_to` varchar(64) default NULL, + `spam_quarantine_to` varchar(64) default NULL, + `banned_quarantine_to` varchar(64) default NULL, + `bad_header_quarantine_to` varchar(64) default NULL, + `clean_quarantine_to` varchar(64) default NULL, + `other_quarantine_to` varchar(64) default NULL, + `spam_tag_level` float default NULL, + `spam_tag2_level` float default NULL, + `spam_kill_level` float default NULL, + `spam_dsn_cutoff_level` float default NULL, + `spam_quarantine_cutoff_level` float default NULL, + `addr_extension_virus` varchar(64) default NULL, + `addr_extension_spam` varchar(64) default NULL, + `addr_extension_banned` varchar(64) default NULL, + `addr_extension_bad_header` varchar(64) default NULL, + `warnvirusrecip` char(1) default NULL, + `warnbannedrecip` char(1) default NULL, + `warnbadhrecip` char(1) default NULL, + `newvirus_admin` varchar(64) default NULL, + `virus_admin` varchar(64) default NULL, + `banned_admin` varchar(64) default NULL, + `bad_header_admin` varchar(64) default NULL, + `spam_admin` varchar(64) default NULL, + `spam_subject_tag` varchar(64) default NULL, + `spam_subject_tag2` varchar(64) default NULL, + `message_size_limit` int(11) default NULL, + `banned_rulenames` varchar(64) default NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ; + +-- +-- Daten für Tabelle `spamfilter_policy` +-- + +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES +(1, 0, 0, '', '', '', 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 7, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2, 0, 0, '', '', '', 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(3, 0, 0, '', '', '', 'Wants all spam', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(4, 0, 0, '', '', '', 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5, 0, 0, '', '', '', 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6, 0, 0, '', '', '', 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7, 0, 0, '', '', '', 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(8, 0, 0, '', '', '', '6.5/7.8', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.5, 7.8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(9, 0, 0, '', '', '', 'userB', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.3, 6.3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10, 0, 0, '', '', '', 'userC', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6, 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(11, 0, 0, '', '', '', 'userD', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 7, 7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12, 1, 0, 'riud', 'riud', '', 'test', 'Y', 'Y', 'N', 'N', 'N', NULL, 'N', 'N', 'N', '', '', '', '', '', '', 0.7, 0, 0, 0, 0, '', '', '', '', 'N', 'N', 'N', '', '', '', '', '', '', '', 0, ''); + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `spamfilter_users` +-- + +CREATE TABLE `spamfilter_users` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL, + `sys_groupid` int(11) NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `priority` int(11) NOT NULL default '7', + `policy_id` int(10) unsigned NOT NULL default '1', + `email` varchar(255) NOT NULL, + `fullname` varchar(255) default NULL, + `local` char(1) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ; + +-- +-- Daten für Tabelle `spamfilter_users` +-- + +INSERT INTO `spamfilter_users` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) VALUES +(1, 0, 0, '', '', '', 0, 9, 5, 'user1+foo@y.example.com', 'Name1 Surname1', 'Y'), +(2, 0, 0, '', '', '', 0, 7, 5, 'user1@y.example.com', 'Name1 Surname1', 'Y'), +(3, 0, 0, '', '', '', 0, 7, 2, 'user2@y.example.com', 'Name2 Surname2', 'Y'), +(4, 0, 0, '', '', '', 0, 7, 7, 'user3@z.example.com', 'Name3 Surname3', 'Y'), +(5, 0, 0, '', '', '', 0, 7, 7, 'user4@example.com', 'Name4 Surname4', 'Y'), +(6, 0, 0, '', '', '', 0, 7, 1, 'user5@example.com', 'Name5 Surname5', 'Y'), +(7, 0, 0, '', '', '', 0, 5, 0, '@sub1.example.com', NULL, 'Y'), +(8, 0, 0, '', '', '', 0, 5, 7, '@sub2.example.com', NULL, 'Y'), +(9, 0, 0, '', '', '', 0, 5, 5, '@example.com', NULL, 'Y'), +(10, 0, 0, '', '', '', 0, 3, 8, 'userA', 'NameA SurnameA anywhere', 'Y'), +(11, 0, 0, '', '', '', 0, 3, 9, 'userB', 'NameB SurnameB', 'Y'), +(12, 0, 0, '', '', '', 0, 3, 10, 'userC', 'NameC SurnameC', 'Y'), +(13, 0, 0, '', '', '', 0, 3, 11, 'userD', 'NameD SurnameD', 'Y'), +(14, 0, 0, '', '', '', 0, 3, 0, '@sub1.example.net', NULL, 'Y'), +(15, 0, 0, '', '', '', 0, 3, 7, '@sub2.example.net', NULL, 'Y'), +(16, 0, 0, '', '', '', 0, 3, 5, '@example.net', NULL, 'Y'), +(17, 0, 0, '', '', '', 0, 7, 5, 'u1@example.org', 'u1', 'Y'), +(18, 0, 0, '', '', '', 0, 7, 6, 'u2@example.org', 'u2', 'Y'), +(19, 0, 0, '', '', '', 0, 7, 3, 'u3@example.org', 'u3', 'Y'), +(20, 1, 0, 'riud', 'riud', '', 1, 5, 0, '@ensign.de', 'ensign all', 'N'); + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `spamfilter_wblist` +-- + +CREATE TABLE `spamfilter_wblist` ( + `wblist_id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL, + `sys_groupid` int(11) NOT NULL, + `sys_perm_user` varchar(5) NOT NULL, + `sys_perm_group` varchar(5) NOT NULL, + `sys_perm_other` varchar(5) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `wb` enum('W','B') NOT NULL default 'W', + `rid` int(10) unsigned NOT NULL, + `email` varchar(255) NOT NULL, + `priority` int(11) NOT NULL, + `active` enum('y','n') NOT NULL default 'y', + PRIMARY KEY (`wblist_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +-- +-- Daten für Tabelle `spamfilter_wblist` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `sys_datalog` +-- + +CREATE TABLE `sys_datalog` ( + `datalog_id` bigint(20) NOT NULL auto_increment, + `dbtable` varchar(255) NOT NULL default '', + `dbidx` varchar(255) NOT NULL default '', + `action` char(1) NOT NULL default '', + `tstamp` bigint(20) NOT NULL default '0', + `user` varchar(255) NOT NULL default '', + `data` text NOT NULL, + PRIMARY KEY (`datalog_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ; + +-- +-- Daten für Tabelle `sys_datalog` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `sys_dbsync` +-- + +CREATE TABLE `sys_dbsync` ( + `id` bigint(20) NOT NULL auto_increment, + `jobname` varchar(255) NOT NULL default '', + `sync_interval_minutes` int(11) NOT NULL default '0', + `db_type` varchar(255) NOT NULL default '', + `db_host` varchar(255) NOT NULL default '', + `db_name` varchar(255) NOT NULL default '', + `db_username` varchar(255) NOT NULL default '', + `db_password` varchar(255) NOT NULL default '', + `db_tables` varchar(255) NOT NULL default 'admin,forms', + `empty_datalog` int(11) NOT NULL default '0', + `sync_datalog_external` int(11) NOT NULL default '0', + `active` int(11) NOT NULL default '1', + `last_datalog_id` bigint(20) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `last_datalog_id` (`last_datalog_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `sys_dbsync` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `sys_filesync` +-- + +CREATE TABLE `sys_filesync` ( + `id` bigint(20) NOT NULL auto_increment, + `jobname` varchar(255) NOT NULL default '', + `sync_interval_minutes` int(11) NOT NULL default '0', + `ftp_host` varchar(255) NOT NULL default '', + `ftp_path` varchar(255) NOT NULL default '', + `ftp_username` varchar(255) NOT NULL default '', + `ftp_password` varchar(255) NOT NULL default '', + `local_path` varchar(255) NOT NULL default '', + `wput_options` varchar(255) NOT NULL default '--timestamping --reupload --dont-continue', + `active` int(11) NOT NULL default '1', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `sys_filesync` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `sys_group` +-- + +CREATE TABLE `sys_group` ( + `groupid` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL default '', + `description` text NOT NULL, + PRIMARY KEY (`groupid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +-- +-- Daten für Tabelle `sys_group` +-- + +INSERT INTO `sys_group` (`groupid`, `name`, `description`) VALUES +(1, 'admin', 'Administrators group'), +(2, 'user', 'Users Group'); + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `sys_user` +-- + +CREATE TABLE `sys_user` ( + `userid` int(11) NOT NULL auto_increment, + `sys_userid` int(11) NOT NULL default '0', + `sys_groupid` int(11) NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `username` varchar(100) NOT NULL default '', + `passwort` varchar(100) NOT NULL default '', + `modules` varchar(255) NOT NULL default '', + `startmodule` varchar(255) NOT NULL default '', + `app_theme` varchar(100) NOT NULL default 'default', + `typ` varchar(20) NOT NULL default 'user', + `active` tinyint(4) NOT NULL default '1', + `name` varchar(100) NOT NULL default '', + `vorname` varchar(100) NOT NULL default '', + `unternehmen` varchar(100) NOT NULL default '', + `strasse` varchar(100) NOT NULL default '', + `ort` varchar(100) NOT NULL default '', + `plz` varchar(10) NOT NULL default '', + `land` varchar(50) NOT NULL default '', + `email` varchar(100) NOT NULL default '', + `url` varchar(255) NOT NULL default '', + `telefon` varchar(100) NOT NULL default '', + `fax` varchar(100) NOT NULL default '', + `language` varchar(10) NOT NULL default 'de', + `groups` varchar(255) NOT NULL default '', + `default_group` int(11) NOT NULL default '0', + PRIMARY KEY (`userid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; + +-- +-- Daten für Tabelle `sys_user` +-- + +INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `username`, `passwort`, `modules`, `startmodule`, `app_theme`, `typ`, `active`, `name`, `vorname`, `unternehmen`, `strasse`, `ort`, `plz`, `land`, `email`, `url`, `telefon`, `fax`, `language`, `groups`, `default_group`) VALUES +(1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin,designer,mail', 'mail', 'default', 'admin', 1, '', 'Administrator', '', '', '', '', '', '', '', '', '', 'en', '1,2', 1); diff --git a/install/tpl/amavisd_user_config.master b/install/tpl/amavisd_user_config.master new file mode 100644 index 0000000000000000000000000000000000000000..fefd2eab191148ad40ff1157c24e7fd929504154 --- /dev/null +++ b/install/tpl/amavisd_user_config.master @@ -0,0 +1,55 @@ +use strict; + +# +# Place your configuration directives here. They will override those in +# earlier files. +# +# See /usr/share/doc/amavisd-new/ for documentation and examples of +# the directives you can use in this file +# + +@bypass_virus_checks_maps = ( + \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re); + +@bypass_spam_checks_maps = ( + \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re); + +# +# Database connection settings +# + +@lookup_sql_dsn = + ( ['DBI:mysql:database={mysql_server_database};host={mysql_server_ip};port={mysql_server_port}', '{mysql_server_ispconfig_user}', '{mysql_server_ispconfig_password}'] ); + +# @storage_sql_dsn = @lookup_sql_dsn; # none, same, or separate database +#$sql_select_policy = 'SELECT "Y" as local FROM mail_domain WHERE CONCAT("@",domain) IN (%k)'; +# $banned_files_quarantine_method = 'sql'; +# $spam_quarantine_method = 'sql'; + +# +# SQL Select statements +# + +$sql_select_policy = + 'SELECT *,spamfilter_users.id'. + ' FROM spamfilter_users LEFT JOIN spamfilter_policy ON spamfilter_users.policy_id=spamfilter_policy.id'. + ' WHERE spamfilter_users.email IN (%k) ORDER BY spamfilter_users.priority DESC'; + + +$sql_select_white_black_list = 'SELECT wb FROM spamfilter_wblist'. + ' WHERE (spamfilter_wblist.rid=?) AND (spamfilter_wblist.email IN (%k))' . + ' ORDER BY spamfilter_wblist.priority DESC'; + + +# +# Enable Logging +# + +$DO_SYSLOG = 1; +$LOGFILE = "/var/log/amavis.log"; # (defaults to empty, no log) + +$log_level = 5; # (defaults to 0) + + +#------------ Do not modify anything below this line ------------- +1; # insure a defined return diff --git a/install/tpl/authmysqlrc.master b/install/tpl/authmysqlrc.master new file mode 100644 index 0000000000000000000000000000000000000000..9e50a4a219c5d84fe9c8ae9027011f138e9d68bf --- /dev/null +++ b/install/tpl/authmysqlrc.master @@ -0,0 +1,17 @@ +MYSQL_SERVER {mysql_server_host} +MYSQL_USERNAME {mysql_server_ispconfig_user} +MYSQL_PASSWORD {mysql_server_ispconfig_password} +MYSQL_PORT 0 +MYSQL_DATABASE {mysql_server_database} +MYSQL_USER_TABLE mail_user +MYSQL_CRYPT_PWFIELD password +#MYSQL_CLEAR_PWFIELD password +MYSQL_UID_FIELD uid +MYSQL_GID_FIELD gid +MYSQL_LOGIN_FIELD email +MYSQL_HOME_FIELD homedir +MYSQL_MAILDIR_FIELD maildir +#MYSQL_NAME_FIELD +#MYSQL_QUOTA_FIELD quota +MYSQL_QUOTA_FIELD concat(quota,'S') +MYSQL_WHERE_CLAUSE access='y' \ No newline at end of file diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master new file mode 100644 index 0000000000000000000000000000000000000000..79150295efa1f12b31312b806de87e98aedd04a1 --- /dev/null +++ b/install/tpl/config.inc.php.master @@ -0,0 +1,107 @@ + \ No newline at end of file diff --git a/install/tpl/mailfilter.master b/install/tpl/mailfilter.master new file mode 100644 index 0000000000000000000000000000000000000000..6333fa13807533ee2b91eb14434264e20106b7f8 --- /dev/null +++ b/install/tpl/mailfilter.master @@ -0,0 +1,63 @@ +# +# Import variables +# + +LOGNAME=tolower("$LOGNAME") +EXTENSION="$1" +RECIPIENT=tolower("$2") +USER="$3" +HOST="$4" +SENDER="$5" +DEFAULT="{dist_postfix_vmail_mailbox_base}/$HOST/$USER/." + +if ( "$EXTENSION" ne "" ) +{ + DELIMITER="+" +} + +if (!$SENDER) +{ + SENDER = "<>" +} + +# +# Autocreate maildir, if not existant +# + +`test -e {dist_postfix_vmail_mailbox_base}/$HOST` +if ( $RETURNCODE != 0 ) +{ + `mkdir {dist_postfix_vmail_mailbox_base}/$HOST` +} + +`test -e {dist_postfix_vmail_mailbox_base}/$HOST/$USER` +if ( $RETURNCODE != 0 ) +{ + `maildirmake {dist_postfix_vmail_mailbox_base}/$HOST/$USER` + `chmod -R 0700 {dist_postfix_vmail_mailbox_base}/$HOST` +} + +# +# Check that user has his own maildrop include, +# if not available, check if $DEFAULT is set +# (newer maildrop get's that from the DB and updates +# it) and deliver or fail temporarily if not available +# + +`test -f {dist_postfix_vmail_mailbox_base}/mailfilters/$LOGNAME` +if ( $RETURNCODE == 0 ) +{ + include "{dist_postfix_vmail_mailbox_base}/mailfilters/$LOGNAME" +} +else +{ + if ( "$DEFAULT" ne "" ) + { + to "$DEFAULT" + } + else + { + EXITCODE=75 + exit + } +} \ No newline at end of file diff --git a/install/tpl/master_cf_amavis.master b/install/tpl/master_cf_amavis.master new file mode 100644 index 0000000000000000000000000000000000000000..cb6f8762c78e9b78ce6067dc57462da824a0d94d --- /dev/null +++ b/install/tpl/master_cf_amavis.master @@ -0,0 +1,18 @@ + +amavis unix - - - - 2 smtp + -o smtp_data_done_timeout=1200 + -o smtp_send_xforward_command=yes + +127.0.0.1:10025 inet n - - - - smtpd + -o content_filter= + -o local_recipient_maps= + -o relay_recipient_maps= + -o smtpd_restriction_classes= + -o smtpd_client_restrictions= + -o smtpd_helo_restrictions= + -o smtpd_sender_restrictions= + -o smtpd_recipient_restrictions=permit_mynetworks,reject + -o mynetworks=127.0.0.0/8 + -o strict_rfc821_envelopes=yes + -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks + -o smtpd_bind_address=127.0.0.1 \ No newline at end of file diff --git a/install/tpl/mysql-virtual_client.cf.master b/install/tpl/mysql-virtual_client.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..bad0cb9655db1fcb2924438f51b073de7b61f6db --- /dev/null +++ b/install/tpl/mysql-virtual_client.cf.master @@ -0,0 +1,8 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_access +select_field = access +where_field = source +additional_conditions = and type = 'client' and active = 'y' +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_domains.cf.master b/install/tpl/mysql-virtual_domains.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..8cb0d18f95b20557f2fdd5a9c3d9c521b85cb33a --- /dev/null +++ b/install/tpl/mysql-virtual_domains.cf.master @@ -0,0 +1,7 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_domain +select_field = 'virtual' +where_field = domain +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_email2email.cf.master b/install/tpl/mysql-virtual_email2email.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..df3be047630e9ee4c5d28d216487e6a02052937b --- /dev/null +++ b/install/tpl/mysql-virtual_email2email.cf.master @@ -0,0 +1,7 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_user +select_field = email +where_field = email +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_forwardings.cf.master b/install/tpl/mysql-virtual_forwardings.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..01281e353cb1e0aed1f6cd1e9426d40bc7399103 --- /dev/null +++ b/install/tpl/mysql-virtual_forwardings.cf.master @@ -0,0 +1,8 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_forwarding +select_field = destination +where_field = source +additional_conditions = and active = 'y' +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_mailboxes.cf.master b/install/tpl/mysql-virtual_mailboxes.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..570f069e253870cf2e90400618204d7dc4ff0a4b --- /dev/null +++ b/install/tpl/mysql-virtual_mailboxes.cf.master @@ -0,0 +1,8 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_user +select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') +where_field = email +additional_conditions = and postfix = 'y' +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_recipient.cf.master b/install/tpl/mysql-virtual_recipient.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..254cfe5cbf4b43c81871bb50a863d71326119108 --- /dev/null +++ b/install/tpl/mysql-virtual_recipient.cf.master @@ -0,0 +1,8 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_access +select_field = access +where_field = source +additional_conditions = and type = 'recipient' and active = 'y' +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_sender.cf.master b/install/tpl/mysql-virtual_sender.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..7531451277c86665e35e6f8a0ef58eb9bf24d37c --- /dev/null +++ b/install/tpl/mysql-virtual_sender.cf.master @@ -0,0 +1,8 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_access +select_field = access +where_field = source +additional_conditions = and type = 'sender' and active = 'y' +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/mysql-virtual_transports.cf.master b/install/tpl/mysql-virtual_transports.cf.master new file mode 100644 index 0000000000000000000000000000000000000000..0040d1d4ed9bd5f8399e2525a1857c312e3d4836 --- /dev/null +++ b/install/tpl/mysql-virtual_transports.cf.master @@ -0,0 +1,8 @@ +user = {mysql_server_ispconfig_user} +password = {mysql_server_ispconfig_password} +dbname = {mysql_server_database} +table = mail_transport +select_field = transport +where_field = domain +additional_conditions = and active = 'y' +hosts = {mysql_server_ip} \ No newline at end of file diff --git a/install/tpl/pamd_smtp.master b/install/tpl/pamd_smtp.master new file mode 100644 index 0000000000000000000000000000000000000000..f03bed97b0bd01512e981cc27641ccf0d40cbaa9 --- /dev/null +++ b/install/tpl/pamd_smtp.master @@ -0,0 +1,2 @@ +auth required pam_mysql.so user={mysql_server_ispconfig_user} passwd={mysql_server_ispconfig_password} host={mysql_server_ip} db={mysql_server_database} table=mail_user usercolumn=email passwdcolumn=password crypt=1 +account sufficient pam_mysql.so user={mysql_server_ispconfig_user} passwd={mysql_server_ispconfig_password} host={mysql_server_ip} db={mysql_server_database} table=mail_user usercolumn=email passwdcolumn=password crypt=1 \ No newline at end of file diff --git a/install/tpl/sasl_smtpd.conf.master b/install/tpl/sasl_smtpd.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..35a9c3d6849f26d206880b69bf4d58252a725d4e --- /dev/null +++ b/install/tpl/sasl_smtpd.conf.master @@ -0,0 +1,9 @@ +pwcheck_method: saslauthd +mech_list: plain login +allow_plaintext: true +auxprop_plugin: mysql +sql_hostnames: {mysql_server_ip} +sql_user: {mysql_server_ispconfig_user} +sql_passwd: {mysql_server_ispconfig_password} +sql_database: {mysql_server_database} +sql_select: select password from mail_user where email = '%u' \ No newline at end of file