diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index 919f8d480135128ac942da3edae51bc71f2853d4..bbf80e6952342b29aa69537a15eb369b6b74289f 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -166,3 +166,5 @@ CREATE TABLE `server_ip_map` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ALTER TABLE `web_domain` ADD COLUMN `rewrite_to_https` ENUM('y','n') NOT NULL DEFAULT 'n' AFTER `seo_redirect`; + +ALTER TABLE openvz_ip ADD COLUMN `additional` VARCHAR(255) NOT NULL DEFAULT 'n'; diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 1ed6e5ecf0f7c05ac75a96668dc380b042cc2fce..6089f3f7454bed945ce8112f11038edc6c99e6ad 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1004,6 +1004,7 @@ CREATE TABLE IF NOT EXISTS `openvz_ip` ( `ip_address` varchar(39) DEFAULT NULL, `vm_id` int(11) NOT NULL DEFAULT '0', `reserved` varchar(255) NOT NULL DEFAULT 'n', + `additional` varchar(255) NOT NULL DEFAULT 'n', PRIMARY KEY (`ip_address_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; diff --git a/install/tpl/master_cf_amavis10025.master b/install/tpl/master_cf_amavis10025.master index fb0481b39052dc00e9389d3586eb9bb943a24a30..43f362d5c0f43b8c39f95db09ede9ac90c840fd9 100644 --- a/install/tpl/master_cf_amavis10025.master +++ b/install/tpl/master_cf_amavis10025.master @@ -12,4 +12,5 @@ -o strict_rfc821_envelopes=yes -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtp_send_xforward_command=yes + -o disable_dns_lookups=yes diff --git a/install/tpl/master_cf_amavis10027.master b/install/tpl/master_cf_amavis10027.master index 44126e2c20c9682824d57bd881ad6de71c8646ae..f9fdf1cf6045faca63eab27d6f8774a689bac44a 100644 --- a/install/tpl/master_cf_amavis10027.master +++ b/install/tpl/master_cf_amavis10027.master @@ -14,4 +14,5 @@ -o smtp_send_xforward_command=yes -o milter_default_action=accept -o milter_macro_daemon_name=ORIGINATING + -o disable_dns_lookups=yes diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php index 7cbf843d31dda5589abe91dca5a9c14e94fe5989..305118d33ac02354bd440e6c02055b89ea5a964c 100644 --- a/interface/lib/plugins/vm_openvz_plugin.inc.php +++ b/interface/lib/plugins/vm_openvz_plugin.inc.php @@ -60,6 +60,14 @@ class vm_openvz_plugin { // Set the IP address $app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']); + // Set additional IPs + if (isset($this->dataRecord['additional_ip'])) { + $app->db->query("UPDATE openvz_ip SET vm_id = 0, additional = 'n' WHERE vm_id = ? AND additional='y'", $this->id); + foreach ($this->dataRecord['additional_ip'] as $idx => $rec) { + $app->db->query("UPDATE openvz_ip SET vm_id = ?, additional = 'y' WHERE ip_address = ?", $this->id, $rec); + } + } + // Create the OpenVZ config file and store it in config field $this->makeOpenVZConfig(); @@ -95,8 +103,16 @@ class vm_openvz_plugin { // Set the IP address if(isset($this->dataRecord['ip_address'])) { - $app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = ?", $this->id); - $app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']); + $app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = ? AND additional='n'", $this->id); + $app->db->query("UPDATE openvz_ip SET vm_id = ?, additional = 'n' WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']); + } + + // Set additional IPs + if (isset($this->dataRecord['additional_ip'])) { + $app->db->query("UPDATE openvz_ip SET vm_id = 0, additional = 'n' WHERE (vm_id = ? AND additional='y')", $this->id); + foreach ($this->dataRecord['additional_ip'] as $idx => $rec) { + $app->db->query("UPDATE openvz_ip SET vm_id = ?, additional = 'y' WHERE ip_address = ?", $this->id, $rec); + } } // Create the OpenVZ config file and store it in config field @@ -195,6 +211,17 @@ class vm_openvz_plugin { $hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']); $tpl->setVar('hostname', $hostname); + + $additional_ips = $app->db->queryAllRecords("SELECT * FROM openvz_ip WHERE vm_id = ?",$this->id); + if (isset($additional_ips)) { + $vm['ip_address']=''; + foreach ($additional_ips as $ip) { + $vm['ip_address'] .= " ".$ip['ip_address']; + } + $vm['ip_address'] = substr($vm['ip_address'],1); + } + $tpl->setVar('ip_address', $vm['ip_address']); + $tpl->setVar('ip_address', $vm['ip_address']); $tpl->setVar('nameserver', $vm['nameserver']); $tpl->setVar('capability', $vm['capability']); diff --git a/interface/web/vm/form/openvz_vm.tform.php b/interface/web/vm/form/openvz_vm.tform.php index 666d06cf353c37a4bdff4f340fa7c00f1ac8470f..d6911ccfda4910dd45a4f0705499dc4de79b21c3 100644 --- a/interface/web/vm/form/openvz_vm.tform.php +++ b/interface/web/vm/form/openvz_vm.tform.php @@ -327,6 +327,12 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') { //################################# ) ); + + $form["tabs"]['additional_ip'] = array ( + 'title' => "Additional IP", + 'width' => 100, + 'template' => "templates/openvz_vm_additional_ip_edit.htm", + ); } diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php index 07f6aaa530f414a171209649eb6e2c43a5e4bce6..0db2053a36a8a8bc46bc2667bf65f79861220b90 100644 --- a/interface/web/vm/openvz_vm_edit.php +++ b/interface/web/vm/openvz_vm_edit.php @@ -178,6 +178,19 @@ class page_action extends tform_actions { $app->tpl->setVar("ip_address", $ip_select); unset($tmp); unset($ips); + + //* Additional IPs + $sql="SELECT * FROM openvz_ip WHERE reserved = 'n' AND ((vm_id = ? AND additional='y') OR vm_id = 0) AND server_id = ?"; + $additional_ips = $app->db->queryAllRecords($sql, $this->id, $vm_server_id); + foreach ($additional_ips as $idx => $rec) { + $temp .= ""; + $used = @($rec['additional']=='y')?'CHECKED':''; + $temp .= " ".$rec['ip_address']."
"; + } + $app->tpl->setVar("additional_ip", $temp); + unset($used); + unset($temp); + unset($additional_ips); if($this->id > 0) { //* we are editing a existing record diff --git a/interface/web/vm/templates/openvz_vm_additional_ip_edit.htm b/interface/web/vm/templates/openvz_vm_additional_ip_edit.htm new file mode 100644 index 0000000000000000000000000000000000000000..f19eb6ca9c0d94bab783c60715ebd913528cc4e2 --- /dev/null +++ b/interface/web/vm/templates/openvz_vm_additional_ip_edit.htm @@ -0,0 +1,19 @@ + +

+ +Additional IPs + +
+
+ {tmpl_var name='additional_ip'} +
+
+ + + +
+ + +
+ +