Skip to content

Commit 6c424f1

Browse files
author
Florian Schaal
committed
add option to rewite ipv4-addresses on web-mirrors
1 parent daf5a71 commit 6c424f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+923
-1
lines changed

install/sql/incremental/upd_dev_collection.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,18 @@ ALTER TABLE openvz_template ADD COLUMN `features` varchar(255) DEFAULT NULL AFTE
150150
ALTER TABLE openvz_vm ADD COLUMN `features` TEXT DEFAULT NULL AFTER `capability`;
151151
ALTER TABLE openvz_template ADD COLUMN `iptables` varchar(255) DEFAULT NULL AFTER `features`;
152152
ALTER TABLE openvz_vm ADD COLUMN `iptables` TEXT DEFAULT NULL AFTER `features`;
153+
154+
CREATE TABLE `server_ip_map` (
155+
`server_ip_map_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
156+
`sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
157+
`sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
158+
`sys_perm_user` varchar(5) DEFAULT NULL,
159+
`sys_perm_group` varchar(5) DEFAULT NULL,
160+
`sys_perm_other` varchar(5) DEFAULT NULL,
161+
`server_id` int(11) unsigned NOT NULL DEFAULT '0',
162+
`source_ip` varchar(15) DEFAULT NULL,
163+
`destination_ip` varchar(35) DEFAULT '',
164+
`active` enum('n','y') NOT NULL DEFAULT 'y',
165+
PRIMARY KEY (`server_ip_map_id`)
166+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
167+

install/sql/ispconfig3.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,25 @@ CREATE TABLE `server_ip` (
12521252

12531253
-- --------------------------------------------------------
12541254

1255+
--
1256+
-- Table structure for table `server_ip_map`
1257+
--
1258+
1259+
CREATE TABLE `server_ip_map` (
1260+
`server_ip_map_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
1261+
`sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
1262+
`sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
1263+
`sys_perm_user` varchar(5) DEFAULT NULL,
1264+
`sys_perm_group` varchar(5) DEFAULT NULL,
1265+
`sys_perm_other` varchar(5) DEFAULT NULL,
1266+
`server_id` int(11) unsigned NOT NULL DEFAULT '0',
1267+
`source_ip` varchar(15) DEFAULT NULL,
1268+
`destination_ip` varchar(35) DEFAULT '',
1269+
`active` enum('n','y') NOT NULL DEFAULT 'y',
1270+
PRIMARY KEY (`server_ip_map_id`)
1271+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
1272+
1273+
-- --------------------------------------------------------
12551274

12561275
--
12571276
-- Table structure for table `server_php`
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2015, Florian Schaal, schaal @it
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
* Neither the name of ISPConfig nor the names of its contributors
16+
may be used to endorse or promote products derived from this software without
17+
specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
$form["title"] = "IP Addresse mapping";
32+
$form["description"] = "";
33+
$form["name"] = "server_ip_map";
34+
$form["action"] = "server_ip_map_edit.php";
35+
$form["db_table"] = "server_ip_map";
36+
$form["db_table_idx"] = "server_ip_map_id";
37+
$form["db_history"] = "yes";
38+
$form["tab_default"] = "server_ip_map";
39+
$form["list_default"] = "server_ip_map_list.php";
40+
$form["auth"] = 'yes';
41+
42+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
43+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
44+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
45+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
46+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
47+
48+
$form["tabs"]['server_ip_map'] = array (
49+
'title' => "IP Address Mapping",
50+
'width' => 80,
51+
'template' => "templates/server_ip_map_edit.htm",
52+
'fields' => array (
53+
'server_id' => array (
54+
// 'datatype' => 'INTEGER',
55+
'datatype' => 'VARCHAR',
56+
'formtype' => 'SELECT',
57+
'default' => '',
58+
// 'datasource' => array ( 'type' => 'SQL',
59+
// 'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND mirror_server_id > 0 ORDER BY server_name',
60+
// 'keyfield'=> 'server_id',
61+
// 'valuefield'=> 'server_name'
62+
// ),
63+
'value' => ''
64+
),
65+
'source_ip' => array (
66+
'datatype' => 'VARCHAR',
67+
'formtype' => 'SELECT',
68+
'validators' => array (
69+
0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'source_ip_empty'),
70+
),
71+
'default' => '',
72+
'value' => ''
73+
),
74+
'destination_ip' => array (
75+
'datatype' => 'VARCHAR',
76+
'formtype' => 'TEXT',
77+
'validators' => array (
78+
0 => array ( 'type' => 'ISIP', 'errmsg'=> 'ip_error_wrong'),
79+
1 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'destination_ip_empty'),
80+
),
81+
'default' => '',
82+
'value' => '',
83+
'separator' => '',
84+
'width' => '15',
85+
'maxlength' => '15',
86+
'rows' => '',
87+
'cols' => '',
88+
'searchable' => 1
89+
),
90+
'active' => array(
91+
'datatype' => 'VARCHAR',
92+
'formtype' => 'CHECKBOX',
93+
'default' => 'y',
94+
'value' => array(0 => 'n', 1 => 'y')
95+
),
96+
)
97+
);
98+
?>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Rewrite on Server';
3+
$wb["source_txt"] = 'Source IP';
4+
$wb["destination_txt"] = 'Destination IP';
5+
$wb["active_txt"] = 'Active';
6+
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
7+
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
8+
$wb["source_ip_empty"] = 'The Source IP is empty.';
9+
$wb["duplicate_mapping_error"] = "Mapping already exists.";
10+
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
11+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["list_head_txt"] = 'IP Mappings';
3+
$wb["server_id_txt"] = 'Server';
4+
$wb["source_ip_txt"] = 'Source IP';
5+
$wb["destination_ip_txt"] = 'Destination IP';
6+
$wb["active_txt"] = 'Active';
7+
?>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Rewrite on Server';
3+
$wb["source_txt"] = 'Source IP';
4+
$wb["destination_txt"] = 'Destination IP';
5+
$wb["active_txt"] = 'Active';
6+
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
7+
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
8+
$wb["source_ip_empty"] = 'The Source IP is empty.';
9+
$wb["duplicate_mapping_error"] = "Mapping already exists.";
10+
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
11+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["list_head_txt"] = 'IP Mappings';
3+
$wb["server_id_txt"] = 'Server';
4+
$wb["source_ip_txt"] = 'Source IP';
5+
$wb["destination_ip_txt"] = 'Destination IP';
6+
$wb["active_txt"] = 'Active';
7+
?>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Rewrite on Server';
3+
$wb["source_txt"] = 'Source IP';
4+
$wb["destination_txt"] = 'Destination IP';
5+
$wb["active_txt"] = 'Active';
6+
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
7+
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
8+
$wb["source_ip_empty"] = 'The Source IP is empty.';
9+
$wb["duplicate_mapping_error"] = "Mapping already exists.";
10+
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
11+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["list_head_txt"] = 'IP Mappings';
3+
$wb["server_id_txt"] = 'Server';
4+
$wb["source_ip_txt"] = 'Source IP';
5+
$wb["destination_ip_txt"] = 'Destination IP';
6+
$wb["active_txt"] = 'Active';
7+
?>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Rewrite on Server';
3+
$wb["source_txt"] = 'Source IP';
4+
$wb["destination_txt"] = 'Destination IP';
5+
$wb["active_txt"] = 'Active';
6+
$wb["ip_error_wrong"] = 'The Destination IP address is invalid';
7+
$wb["destination_ip_empty"] = 'The Destination IP is empty.';
8+
$wb["source_ip_empty"] = 'The Source IP is empty.';
9+
$wb["duplicate_mapping_error"] = "Mapping already exists.";
10+
$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server";
11+
?>

0 commit comments

Comments
 (0)