Skip to content

Commit d78707d

Browse files
author
latham
committed
Start the iptables upload, disabled in menu, sql coming in a minute
1 parent 027d48d commit d78707d

File tree

10 files changed

+567
-7
lines changed

10 files changed

+567
-7
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?php
2+
3+
$form["title"] = "IPTables";
4+
$form["description"] = "IPTables based firewall";
5+
$form["name"] = "iptables";
6+
$form["action"] = "iptables_edit.php";
7+
$form["db_table"] = "iptables";
8+
$form["db_table_idx"] = "iptables_id";
9+
$form["db_history"] = "no";
10+
$form["tab_default"] = "iptables";
11+
$form["list_default"] = "iptables_list.php";
12+
//$form["auth"] = 'yes'; // yes / no
13+
14+
//$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
15+
//$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
16+
//$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
17+
//$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
18+
//$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
19+
20+
$form["tabs"]['iptables'] = array (
21+
'title' => "Rules",
22+
'width' => "100",
23+
'template' => "templates/iptables_edit.htm",
24+
'fields' => array (
25+
'server_id' => array (
26+
'datatype' => 'INTEGER',
27+
'formtype' => 'SELECT',
28+
'default' => '',
29+
'datasource' => array ( 'type' => 'SQL',
30+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
31+
'keyfield'=> 'server_id',
32+
'valuefield'=> 'server_name'),
33+
'value' => ''
34+
),
35+
'protocol' => array (
36+
'datatype' => 'VARCHAR',
37+
'formtype' => 'SELECT',
38+
'default' => '',
39+
'value' => array('none'=>'None','tcp'=>'TCP','udp'=>'UDP'),
40+
'width' => '',
41+
'maxlength' => ''
42+
),
43+
'table' => array (
44+
'datatype' => 'VARCHAR',
45+
'formtype' => 'SELECT',
46+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'table_error_empty')),
47+
'default' => 'INPUT',
48+
'value' => array('INPUT'=>'INPUT','OUTPUT'=>'OUTPUT','FORWARD'=>'FORWARD'),
49+
'width' => '',
50+
'maxlength' => ''
51+
),
52+
'source_ip' => array (
53+
'datatype' => 'VARCHAR',
54+
'formtype' => 'TEXT',
55+
'default' => '',
56+
'value' => '',
57+
'width' => '',
58+
'maxlength' => ''
59+
),
60+
'destination_ip' => array (
61+
'datatype' => 'VARCHAR',
62+
'formtype' => 'TEXT',
63+
'default' => '',
64+
'value' => '',
65+
'width' => '',
66+
'maxlength' => ''
67+
),
68+
'singleport' => array (
69+
'datatype' => 'VARCHAR',
70+
'formtype' => 'TEXT',
71+
'default' => '',
72+
'value' => '',
73+
'width' => '',
74+
'maxlength' => ''
75+
),
76+
'multiport' => array (
77+
'datatype' => 'VARCHAR',
78+
'formtype' => 'TEXT',
79+
'default' => '',
80+
'value' => '',
81+
'width' => '',
82+
'maxlength' => ''
83+
),
84+
'state' => array (
85+
'datatype' => 'VARCHAR',
86+
'formtype' => 'TEXT',
87+
'default' => '',
88+
'value' => '',
89+
'width' => '',
90+
'maxlength' => ''
91+
),
92+
'target' => array (
93+
'datatype' => 'VARCHAR',
94+
'formtype' => 'SELECT',
95+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'target_error_empty')),
96+
'default' => '',
97+
'value' => array('ACCEPT'=>'ACCEPT','DROP'=>'DROP','REJECT'=>'REJECT'),
98+
'width' => '',
99+
'maxlength' => ''
100+
),
101+
'active' => array (
102+
'datatype' => 'VARCHAR',
103+
'formtype' => 'CHECKBOX',
104+
'default' => 'y',
105+
'value' => array(0 => 'n',1 => 'y')
106+
),
107+
)
108+
);
109+
?>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/*
3+
Copyright (c) 2011, Andrew "lathama" Latham, Till Brehm, projektfarm Gmbh
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
/******************************************
31+
* Begin Form configuration
32+
******************************************/
33+
34+
$list_def_file = "list/iptables.list.php";
35+
$tform_def_file = "form/iptables.tform.php";
36+
37+
/******************************************
38+
* End Form configuration
39+
******************************************/
40+
41+
require_once('../../lib/config.inc.php');
42+
require_once('../../lib/app.inc.php');
43+
44+
//* Check permissions for module
45+
$app->auth->check_module_permissions('admin');
46+
47+
$app->uses("tform_actions");
48+
$app->tform_actions->onDelete();
49+
50+
?>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/*
3+
Copyright (c) 2011, Andrew "lathama" Latham, Till Brehm, projektfarm Gmbh
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
31+
/******************************************
32+
* Begin Form configuration
33+
******************************************/
34+
35+
$tform_def_file = "form/iptables.tform.php";
36+
37+
/******************************************
38+
* End Form configuration
39+
******************************************/
40+
41+
require_once('../../lib/config.inc.php');
42+
require_once('../../lib/app.inc.php');
43+
44+
//* Check permissions for module
45+
$app->auth->check_module_permissions('admin');
46+
47+
// Loading classes
48+
$app->uses('tpl,tform,tform_actions');
49+
$app->load('tform_actions');
50+
51+
class page_action extends tform_actions {
52+
53+
}
54+
55+
$page = new page_action;
56+
$page->onLoad();
57+
58+
?>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/*
3+
Copyright (c) 2011, Andrew "lathama" Latham, Till Brehm, projektfarm Gmbh
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
require_once('../../lib/config.inc.php');
31+
require_once('../../lib/app.inc.php');
32+
33+
/******************************************
34+
* Begin Form configuration
35+
******************************************/
36+
37+
$list_def_file = "list/iptables.list.php";
38+
39+
/******************************************
40+
* End Form configuration
41+
******************************************/
42+
43+
//* Check permissions for module
44+
$app->auth->check_module_permissions('admin');
45+
46+
$app->uses('listform_actions');
47+
48+
$app->listform_actions->onLoad();
49+
50+
51+
?>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$wb["server_id_txt"] = 'Server';
4+
$wb["multiport_txt"] = 'Multi Port';
5+
$wb["singleport_txt"] = 'Single Port';
6+
$wb["protocol_txt"] = 'Protocol';
7+
$wb["table_txt"] = 'Table';
8+
$wb["target_txt"] = 'Target';
9+
$wb["state_txt"] = 'State';
10+
$wb["destination_ip_txt"] = 'Destination Address';
11+
$wb["source_ip_txt"] = 'Source Address';
12+
$wb["active_txt"] = 'Active';
13+
$wb["iptables_error_unique"] = 'There is already a firewall record for this server.';
14+
15+
?>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/*
3+
templates/iptables_list.htm:<h2><tmpl_var name="list_head_txt"></h2>
4+
templates/iptables_list.htm: <span>{tmpl_var name="add_new_rule_txt"}</span>
5+
templates/iptables_list.htm: <fieldset><legend><tmpl_var name="list_head_txt"></legend>
6+
templates/iptables_list.htm: <th class="tbl_col_active" scope="col"><tmpl_var name="active_txt"></th>
7+
templates/iptables_list.htm: <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th>
8+
templates/iptables_list.htm: <!-- th class="tbl_col_source_ip" scope="col"><tmpl_var name="source_ip_txt"></th>
9+
templates/iptables_list.htm: <th class="tbl_col_destination_ip" scope="col"><tmpl_var name="destination_ip_txt"></th -->
10+
templates/iptables_list.htm: <th class="tbl_col_port" scope="col"><tmpl_var name="singleport_txt"></th>
11+
templates/iptables_list.htm: <th class="tbl_col_port" scope="col"><tmpl_var name="multiport_txt"></th>
12+
templates/iptables_list.htm: <th class="tbl_col_protocol" scope="col"><tmpl_var name="protocol_txt"></th>
13+
templates/iptables_list.htm: <th class="tbl_col_table" scope="col"><tmpl_var name="table_txt"></th>
14+
templates/iptables_list.htm: <th class="tbl_col_target" scope="col"><tmpl_var name="target_txt"></th>
15+
templates/iptables_list.htm: <th class="tbl_col_state" scope="col"><tmpl_var name="state_txt"></th>
16+
templates/iptables_list.htm: <button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','admin/iptables_list.php');">
17+
templates/iptables_list.htm: <span>{tmpl_var name="filter_txt"}filter_txt</span></button></div>
18+
templates/iptables_list.htm: <span>{tmpl_var name='delete_txt'}</span></a>
19+
*/
20+
21+
$wb["list_head_txt"] = 'IPTables';
22+
$wb["add_new_rule_txt"] = 'Add IPTables Rule';
23+
$wb["server_id_txt"] = 'Server';
24+
$wb["multiport_txt"] = 'Multi Port';
25+
$wb["singleport_txt"] = 'Single Port';
26+
$wb["protocol_txt"] = 'Protocol';
27+
$wb["table_txt"] = 'Table';
28+
$wb["target_txt"] = 'Target';
29+
$wb["state_txt"] = 'State';
30+
$wb["destination_ip_txt"] = 'Destination Address';
31+
$wb["source_ip_txt"] = 'Source Address';
32+
$wb["active_txt"] = 'Active';
33+
$wb["iptables_error_unique"] = 'There is already a firewall record for this server.';
34+
35+
?>

interface/web/admin/lib/module.conf.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@
8484
'items' => $items);
8585
// cleanup
8686
unset($items);
87-
8887
/*
88+
$items[] = array( 'title' => 'IPTables',
89+
'target' => 'content',
90+
'link' => 'admin/iptables_list.php');
91+
8992
$items[] = array( 'title' => 'Firewall',
9093
'target' => 'content',
9194
'link' => 'admin/firewall_list.php',
@@ -99,17 +102,12 @@
99102
'target' => 'content',
100103
'link' => 'admin/firewall_filter_list.php');
101104

102-
103105
$items[] = array( 'title' => 'Port Forward',
104106
'target' => 'content',
105107
'link' => 'admin/firewall_forward_list.php');
106108

107-
108-
109-
110-
111109
$module['nav'][] = array( 'title' => 'Firewall',
112-
'open' => 1,
110+
'open' => "1",
113111
'items' => $items);
114112

115113

0 commit comments

Comments
 (0)