1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
vpn_ipsec_mobile.php
|
4 |
46bb8a0b
|
Sjon Hortensius
|
|
5 |
3462a529
|
Matthew Grooms
|
Copyright (C) 2008 Shrew Soft Inc
|
6 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
7 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
8 |
46bb8a0b
|
Sjon Hortensius
|
|
9 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
10 |
|
|
modification, are permitted provided that the following conditions are met:
|
11 |
46bb8a0b
|
Sjon Hortensius
|
|
12 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
this list of conditions and the following disclaimer.
|
14 |
46bb8a0b
|
Sjon Hortensius
|
|
15 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
notice, this list of conditions and the following disclaimer in the
|
17 |
|
|
documentation and/or other materials provided with the distribution.
|
18 |
46bb8a0b
|
Sjon Hortensius
|
|
19 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
29 |
|
|
*/
|
30 |
|
|
|
31 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
32 |
|
|
##|*IDENT=page-vpn-ipsec-mobile
|
33 |
|
|
##|*NAME=VPN: IPsec: Mobile page
|
34 |
|
|
##|*DESCR=Allow access to the 'VPN: IPsec: Mobile' page.
|
35 |
|
|
##|*MATCH=vpn_ipsec_mobile.php*
|
36 |
|
|
##|-PRIV
|
37 |
|
|
|
38 |
0f84b741
|
Scott Ullrich
|
require("functions.inc");
|
39 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
40 |
483e6de8
|
Scott Ullrich
|
require_once("ipsec.inc");
|
41 |
|
|
require_once("vpn.inc");
|
42 |
caaaf9ce
|
Renato Botelho
|
require_once("filter.inc");
|
43 |
5b237745
|
Scott Ullrich
|
|
44 |
3462a529
|
Matthew Grooms
|
if (!is_array($config['ipsec']['phase1']))
|
45 |
|
|
$config['ipsec']['phase1'] = array();
|
46 |
|
|
|
47 |
|
|
$a_phase1 = &$config['ipsec']['phase1'];
|
48 |
|
|
|
49 |
|
|
if (!is_array($config['ipsec']['client']))
|
50 |
|
|
$config['ipsec']['client'] = array();
|
51 |
|
|
|
52 |
|
|
$a_client = &$config['ipsec']['client'];
|
53 |
|
|
|
54 |
|
|
if (count($a_client)) {
|
55 |
|
|
|
56 |
|
|
$pconfig['enable'] = $a_client['enable'];
|
57 |
|
|
|
58 |
|
|
$pconfig['user_source'] = $a_client['user_source'];
|
59 |
|
|
$pconfig['group_source'] = $a_client['group_source'];
|
60 |
|
|
|
61 |
|
|
$pconfig['pool_address'] = $a_client['pool_address'];
|
62 |
|
|
$pconfig['pool_netbits'] = $a_client['pool_netbits'];
|
63 |
|
|
$pconfig['net_list'] = $a_client['net_list'];
|
64 |
4178a1dd
|
jim-p
|
$pconfig['save_passwd'] = $a_client['save_passwd'];
|
65 |
3462a529
|
Matthew Grooms
|
$pconfig['dns_domain'] = $a_client['dns_domain'];
|
66 |
d7402222
|
jim-p
|
$pconfig['dns_split'] = $a_client['dns_split'];
|
67 |
3462a529
|
Matthew Grooms
|
$pconfig['dns_server1'] = $a_client['dns_server1'];
|
68 |
|
|
$pconfig['dns_server2'] = $a_client['dns_server2'];
|
69 |
|
|
$pconfig['dns_server3'] = $a_client['dns_server3'];
|
70 |
|
|
$pconfig['dns_server4'] = $a_client['dns_server4'];
|
71 |
|
|
$pconfig['wins_server1'] = $a_client['wins_server1'];
|
72 |
|
|
$pconfig['wins_server2'] = $a_client['wins_server2'];
|
73 |
|
|
$pconfig['pfs_group'] = $a_client['pfs_group'];
|
74 |
|
|
$pconfig['login_banner'] = $a_client['login_banner'];
|
75 |
|
|
|
76 |
|
|
if (isset($pconfig['enable']))
|
77 |
|
|
$pconfig['enable'] = true;
|
78 |
|
|
|
79 |
|
|
if ($pconfig['pool_address']&&$pconfig['pool_netbits'])
|
80 |
|
|
$pconfig['pool_enable'] = true;
|
81 |
|
|
else
|
82 |
|
|
$pconfig['pool_netbits'] = 24;
|
83 |
|
|
|
84 |
|
|
if (isset($pconfig['net_list']))
|
85 |
|
|
$pconfig['net_list_enable'] = true;
|
86 |
|
|
|
87 |
4178a1dd
|
jim-p
|
if (isset($pconfig['save_passwd']))
|
88 |
|
|
$pconfig['save_passwd_enable'] = true;
|
89 |
|
|
|
90 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_domain'])
|
91 |
|
|
$pconfig['dns_domain_enable'] = true;
|
92 |
|
|
|
93 |
d7402222
|
jim-p
|
if ($pconfig['dns_split'])
|
94 |
|
|
$pconfig['dns_split_enable'] = true;
|
95 |
|
|
|
96 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server1']||$pconfig['dns_server2']||$pconfig['dns_server3']||$pconfig['dns_server4'])
|
97 |
|
|
$pconfig['dns_server_enable'] = true;
|
98 |
|
|
|
99 |
|
|
if ($pconfig['wins_server1']||$pconfig['wins_server2'])
|
100 |
|
|
$pconfig['wins_server_enable'] = true;
|
101 |
|
|
|
102 |
|
|
if (isset($pconfig['pfs_group']))
|
103 |
|
|
$pconfig['pfs_group_enable'] = true;
|
104 |
|
|
|
105 |
|
|
if ($pconfig['login_banner'])
|
106 |
|
|
$pconfig['login_banner_enable'] = true;
|
107 |
5b237745
|
Scott Ullrich
|
}
|
108 |
3462a529
|
Matthew Grooms
|
|
109 |
|
|
if ($_POST['create']) {
|
110 |
|
|
header("Location: vpn_ipsec_phase1.php?mobile=true");
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
if ($_POST['apply']) {
|
114 |
|
|
$retval = 0;
|
115 |
420fce04
|
Ermal LUÇI
|
/* NOTE: #4353 Always restart ipsec when mobile clients settings change */
|
116 |
|
|
$retval = vpn_ipsec_configure(true);
|
117 |
3462a529
|
Matthew Grooms
|
$savemsg = get_std_save_message($retval);
|
118 |
d17c7b79
|
jim-p
|
if ($retval >= 0)
|
119 |
a368a026
|
Ermal Lu?i
|
if (is_subsystem_dirty('ipsec'))
|
120 |
|
|
clear_subsystem_dirty('ipsec');
|
121 |
5b237745
|
Scott Ullrich
|
}
|
122 |
|
|
|
123 |
df7bc7cb
|
Sander van Leeuwen
|
if ($_POST['save']) {
|
124 |
3462a529
|
Matthew Grooms
|
|
125 |
5b237745
|
Scott Ullrich
|
unset($input_errors);
|
126 |
|
|
$pconfig = $_POST;
|
127 |
|
|
|
128 |
3462a529
|
Matthew Grooms
|
/* input consolidation */
|
129 |
|
|
|
130 |
df7bc7cb
|
Sander van Leeuwen
|
|
131 |
3462a529
|
Matthew Grooms
|
|
132 |
|
|
/* input validation */
|
133 |
|
|
|
134 |
|
|
$reqdfields = explode(" ", "user_source group_source");
|
135 |
bfbd2610
|
Carlos Eduardo Ramos
|
$reqdfieldsn = array(gettext("User Authentication Source"),gettext("Group Authentication Source"));
|
136 |
3462a529
|
Matthew Grooms
|
|
137 |
df7bc7cb
|
Sander van Leeuwen
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
138 |
3462a529
|
Matthew Grooms
|
|
139 |
|
|
if ($pconfig['pool_enable'])
|
140 |
|
|
if (!is_ipaddr($pconfig['pool_address']))
|
141 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'Virtual Address Pool Network' must be specified.");
|
142 |
3462a529
|
Matthew Grooms
|
|
143 |
|
|
if ($pconfig['dns_domain_enable'])
|
144 |
|
|
if (!is_domain($pconfig['dns_domain']))
|
145 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid value for 'DNS Default Domain' must be specified.");
|
146 |
3462a529
|
Matthew Grooms
|
|
147 |
d7402222
|
jim-p
|
if ($pconfig['dns_split_enable']) {
|
148 |
|
|
if (!empty($pconfig['dns_split'])) {
|
149 |
27781065
|
Renato Botelho
|
/* Replace multiple spaces by single */
|
150 |
|
|
$pconfig['dns_split'] = preg_replace('/\s+/', ' ', trim($pconfig['dns_split']));
|
151 |
1f3d4db0
|
Ermal LUÇI
|
$domain_array=explode(' ', $pconfig['dns_split']);
|
152 |
d7402222
|
jim-p
|
foreach ($domain_array as $curdomain) {
|
153 |
|
|
if (!is_domain($curdomain)) {
|
154 |
|
|
$input_errors[] = gettext("A valid split DNS domain list must be specified.");
|
155 |
|
|
break;
|
156 |
|
|
}
|
157 |
|
|
}
|
158 |
|
|
}
|
159 |
|
|
}
|
160 |
|
|
|
161 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server_enable']) {
|
162 |
|
|
if (!$pconfig['dns_server1'] && !$pconfig['dns_server2'] &&
|
163 |
|
|
!$pconfig['dns_server3'] && !$pconfig['dns_server4'] )
|
164 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("At least one DNS server must be specified to enable the DNS Server option.");
|
165 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server1'] && !is_ipaddr($pconfig['dns_server1']))
|
166 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'DNS Server #1' must be specified.");
|
167 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server2'] && !is_ipaddr($pconfig['dns_server2']))
|
168 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'DNS Server #2' must be specified.");
|
169 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server3'] && !is_ipaddr($pconfig['dns_server3']))
|
170 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'DNS Server #3' must be specified.");
|
171 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server4'] && !is_ipaddr($pconfig['dns_server4']))
|
172 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'DNS Server #4' must be specified.");
|
173 |
5b237745
|
Scott Ullrich
|
}
|
174 |
3462a529
|
Matthew Grooms
|
|
175 |
|
|
if ($pconfig['wins_server_enable']) {
|
176 |
|
|
if (!$pconfig['wins_server1'] && !$pconfig['wins_server2'])
|
177 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("At least one WINS server must be specified to enable the DNS Server option.");
|
178 |
3462a529
|
Matthew Grooms
|
if ($pconfig['wins_server1'] && !is_ipaddr($pconfig['wins_server1']))
|
179 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'WINS Server #1' must be specified.");
|
180 |
3462a529
|
Matthew Grooms
|
if ($pconfig['wins_server2'] && !is_ipaddr($pconfig['wins_server2']))
|
181 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid IP address for 'WINS Server #2' must be specified.");
|
182 |
5b237745
|
Scott Ullrich
|
}
|
183 |
3462a529
|
Matthew Grooms
|
|
184 |
|
|
if ($pconfig['login_banner_enable'])
|
185 |
|
|
if (!strlen($pconfig['login_banner']))
|
186 |
bfbd2610
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid value for 'Login Banner' must be specified.");
|
187 |
5b237745
|
Scott Ullrich
|
|
188 |
|
|
if (!$input_errors) {
|
189 |
3462a529
|
Matthew Grooms
|
$client = array();
|
190 |
df7bc7cb
|
Sander van Leeuwen
|
|
191 |
3462a529
|
Matthew Grooms
|
if ($pconfig['enable'])
|
192 |
|
|
$client['enable'] = true;
|
193 |
|
|
|
194 |
52c9f9fa
|
Ermal
|
if (!empty($pconfig['user_source']))
|
195 |
|
|
$client['user_source'] = implode(",", $pconfig['user_source']);
|
196 |
3462a529
|
Matthew Grooms
|
$client['group_source'] = $pconfig['group_source'];
|
197 |
|
|
|
198 |
|
|
if ($pconfig['pool_enable']) {
|
199 |
|
|
$client['pool_address'] = $pconfig['pool_address'];
|
200 |
|
|
$client['pool_netbits'] = $pconfig['pool_netbits'];
|
201 |
5b237745
|
Scott Ullrich
|
}
|
202 |
3462a529
|
Matthew Grooms
|
|
203 |
|
|
if ($pconfig['net_list_enable'])
|
204 |
|
|
$client['net_list'] = true;
|
205 |
|
|
|
206 |
4178a1dd
|
jim-p
|
if ($pconfig['save_passwd_enable'])
|
207 |
|
|
$client['save_passwd'] = true;
|
208 |
|
|
|
209 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_domain_enable'])
|
210 |
|
|
$client['dns_domain'] = $pconfig['dns_domain'];
|
211 |
|
|
|
212 |
d7402222
|
jim-p
|
if ($pconfig['dns_split_enable'])
|
213 |
|
|
$client['dns_split'] = $pconfig['dns_split'];
|
214 |
|
|
|
215 |
3462a529
|
Matthew Grooms
|
if ($pconfig['dns_server_enable']) {
|
216 |
|
|
$client['dns_server1'] = $pconfig['dns_server1'];
|
217 |
|
|
$client['dns_server2'] = $pconfig['dns_server2'];
|
218 |
|
|
$client['dns_server3'] = $pconfig['dns_server3'];
|
219 |
|
|
$client['dns_server4'] = $pconfig['dns_server4'];
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
if ($pconfig['wins_server_enable']) {
|
223 |
|
|
$client['wins_server1'] = $pconfig['wins_server1'];
|
224 |
|
|
$client['wins_server2'] = $pconfig['wins_server2'];
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
if ($pconfig['pfs_group_enable'])
|
228 |
|
|
$client['pfs_group'] = $pconfig['pfs_group'];
|
229 |
|
|
|
230 |
|
|
if ($pconfig['login_banner_enable'])
|
231 |
|
|
$client['login_banner'] = $pconfig['login_banner'];
|
232 |
|
|
|
233 |
|
|
$a_client = $client;
|
234 |
df7bc7cb
|
Sander van Leeuwen
|
|
235 |
5b237745
|
Scott Ullrich
|
write_config();
|
236 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('ipsec');
|
237 |
df7bc7cb
|
Sander van Leeuwen
|
|
238 |
5b237745
|
Scott Ullrich
|
header("Location: vpn_ipsec_mobile.php");
|
239 |
|
|
exit;
|
240 |
|
|
}
|
241 |
|
|
}
|
242 |
422f27c0
|
Scott Ullrich
|
|
243 |
bfbd2610
|
Carlos Eduardo Ramos
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Mobile"));
|
244 |
b32dd0a6
|
jim-p
|
$shortcut_section = "ipsec";
|
245 |
6deedfde
|
jim-p
|
|
246 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
247 |
|
|
?>
|
248 |
3462a529
|
Matthew Grooms
|
|
249 |
df7bc7cb
|
Sander van Leeuwen
|
<script type="text/javascript">
|
250 |
|
|
//<![CDATA[
|
251 |
3462a529
|
Matthew Grooms
|
|
252 |
df7bc7cb
|
Sander van Leeuwen
|
function pool_change() {
|
253 |
3462a529
|
Matthew Grooms
|
|
254 |
df7bc7cb
|
Sander van Leeuwen
|
if (document.iform.pool_enable.checked) {
|
255 |
|
|
document.iform.pool_address.disabled = 0;
|
256 |
|
|
document.iform.pool_netbits.disabled = 0;
|
257 |
|
|
} else {
|
258 |
|
|
document.iform.pool_address.disabled = 1;
|
259 |
|
|
document.iform.pool_netbits.disabled = 1;
|
260 |
|
|
}
|
261 |
|
|
}
|
262 |
3462a529
|
Matthew Grooms
|
|
263 |
df7bc7cb
|
Sander van Leeuwen
|
function dns_domain_change() {
|
264 |
3462a529
|
Matthew Grooms
|
|
265 |
df7bc7cb
|
Sander van Leeuwen
|
if (document.iform.dns_domain_enable.checked)
|
266 |
|
|
document.iform.dns_domain.disabled = 0;
|
267 |
|
|
else
|
268 |
|
|
document.iform.dns_domain.disabled = 1;
|
269 |
|
|
}
|
270 |
d7402222
|
jim-p
|
|
271 |
df7bc7cb
|
Sander van Leeuwen
|
function dns_split_change() {
|
272 |
d7402222
|
jim-p
|
|
273 |
df7bc7cb
|
Sander van Leeuwen
|
if (document.iform.dns_split_enable.checked)
|
274 |
|
|
document.iform.dns_split.disabled = 0;
|
275 |
|
|
else
|
276 |
|
|
document.iform.dns_split.disabled = 1;
|
277 |
|
|
}
|
278 |
3462a529
|
Matthew Grooms
|
|
279 |
df7bc7cb
|
Sander van Leeuwen
|
function dns_server_change() {
|
280 |
|
|
|
281 |
|
|
if (document.iform.dns_server_enable.checked) {
|
282 |
|
|
document.iform.dns_server1.disabled = 0;
|
283 |
|
|
document.iform.dns_server2.disabled = 0;
|
284 |
|
|
document.iform.dns_server3.disabled = 0;
|
285 |
|
|
document.iform.dns_server4.disabled = 0;
|
286 |
|
|
} else {
|
287 |
|
|
document.iform.dns_server1.disabled = 1;
|
288 |
|
|
document.iform.dns_server2.disabled = 1;
|
289 |
|
|
document.iform.dns_server3.disabled = 1;
|
290 |
|
|
document.iform.dns_server4.disabled = 1;
|
291 |
|
|
}
|
292 |
|
|
}
|
293 |
3462a529
|
Matthew Grooms
|
|
294 |
df7bc7cb
|
Sander van Leeuwen
|
function wins_server_change() {
|
295 |
3462a529
|
Matthew Grooms
|
|
296 |
df7bc7cb
|
Sander van Leeuwen
|
if (document.iform.wins_server_enable.checked) {
|
297 |
|
|
document.iform.wins_server1.disabled = 0;
|
298 |
|
|
document.iform.wins_server2.disabled = 0;
|
299 |
|
|
} else {
|
300 |
|
|
document.iform.wins_server1.disabled = 1;
|
301 |
|
|
document.iform.wins_server2.disabled = 1;
|
302 |
|
|
}
|
303 |
|
|
}
|
304 |
3462a529
|
Matthew Grooms
|
|
305 |
df7bc7cb
|
Sander van Leeuwen
|
function pfs_group_change() {
|
306 |
3462a529
|
Matthew Grooms
|
|
307 |
df7bc7cb
|
Sander van Leeuwen
|
if (document.iform.pfs_group_enable.checked)
|
308 |
|
|
document.iform.pfs_group.disabled = 0;
|
309 |
|
|
else
|
310 |
|
|
document.iform.pfs_group.disabled = 1;
|
311 |
|
|
}
|
312 |
3462a529
|
Matthew Grooms
|
|
313 |
df7bc7cb
|
Sander van Leeuwen
|
function login_banner_change() {
|
314 |
3462a529
|
Matthew Grooms
|
|
315 |
df7bc7cb
|
Sander van Leeuwen
|
if (document.iform.login_banner_enable.checked)
|
316 |
|
|
document.iform.login_banner.disabled = 0;
|
317 |
|
|
else
|
318 |
|
|
document.iform.login_banner.disabled = 1;
|
319 |
|
|
}
|
320 |
3462a529
|
Matthew Grooms
|
|
321 |
df7bc7cb
|
Sander van Leeuwen
|
//]]>
|
322 |
|
|
</script>
|
323 |
59e0b480
|
Sander van Leeuwen
|
|
324 |
323d040b
|
Scott Ullrich
|
<?php
|
325 |
df7bc7cb
|
Sander van Leeuwen
|
if ($savemsg)
|
326 |
|
|
print_info_box($savemsg);
|
327 |
|
|
if (isset($config['ipsec']['enable']) && is_subsystem_dirty('ipsec'))
|
328 |
|
|
print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
|
329 |
|
|
foreach ($a_phase1 as $ph1ent)
|
330 |
|
|
if (isset($ph1ent['mobile']))
|
331 |
|
|
$ph1found = true;
|
332 |
|
|
if ($pconfig['enable'] && !$ph1found)
|
333 |
|
|
print_info_box_np(gettext("Support for IPsec Mobile clients is enabled but a Phase1 definition was not found") . ".<br />" . gettext("Please click Create to define one."),gettext("create"),gettext("Create Phase1"));
|
334 |
|
|
if ($input_errors)
|
335 |
|
|
print_input_errors($input_errors);
|
336 |
3462a529
|
Matthew Grooms
|
|
337 |
df7bc7cb
|
Sander van Leeuwen
|
$tab_array = array();
|
338 |
|
|
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
|
339 |
|
|
$tab_array[1] = array(gettext("Mobile clients"), true, "vpn_ipsec_mobile.php");
|
340 |
|
|
$tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php");
|
341 |
|
|
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
|
342 |
748cbea6
|
Sander van Leeuwen
|
display_top_tabs($tab_array);
|
343 |
df7bc7cb
|
Sander van Leeuwen
|
|
344 |
|
|
require('classes/Form.class.php');
|
345 |
|
|
$form = new Form;
|
346 |
|
|
|
347 |
|
|
$section = new Form_Section('Enable IPsec Mobile Client Support');
|
348 |
|
|
$section->addInput(new Form_Checkbox(
|
349 |
|
|
'enable',
|
350 |
|
|
'IKE Extensions',
|
351 |
|
|
'Enable IPsec Mobile Client Support',
|
352 |
|
|
$pconfig['enable']
|
353 |
|
|
));
|
354 |
|
|
|
355 |
|
|
$form->add($section);
|
356 |
|
|
|
357 |
|
|
$section = new Form_Section('Extended Authentication (Xauth)');
|
358 |
|
|
|
359 |
|
|
$authServers = array();
|
360 |
|
|
|
361 |
|
|
foreach (auth_get_authserver_list() as $authServer)
|
362 |
|
|
$authServers[$authServer['name']] = $authServer['name']; // Value == name
|
363 |
|
|
|
364 |
|
|
$section->addInput(new Form_Select(
|
365 |
|
|
'user_source',
|
366 |
|
|
'User Authentication',
|
367 |
|
|
explode(",", $pconfig['user_source']),
|
368 |
|
|
$authServers,
|
369 |
|
|
true
|
370 |
|
|
))->setHelp('Source');
|
371 |
|
|
|
372 |
|
|
$section->addInput(new Form_Select(
|
373 |
|
|
'group_source',
|
374 |
|
|
'Group Authentication',
|
375 |
|
|
$pconfig['group_source'],
|
376 |
|
|
array(
|
377 |
|
|
'none' => 'none',
|
378 |
|
|
'system' => 'system',
|
379 |
|
|
)
|
380 |
|
|
))->setHelp('Source');
|
381 |
|
|
|
382 |
|
|
$form->add($section);
|
383 |
|
|
|
384 |
|
|
$section = new Form_Section('Client Configuration (mode-cfg)');
|
385 |
|
|
|
386 |
|
|
$section->addInput(new Form_Checkbox(
|
387 |
|
|
'pool_enable',
|
388 |
|
|
'Virtual Address Pool',
|
389 |
|
|
'Provide a virtual IP address to clients',
|
390 |
|
|
$pconfig['pool_enable']
|
391 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-pool_enable');
|
392 |
df7bc7cb
|
Sander van Leeuwen
|
|
393 |
|
|
// TODO: Refactor this manual setup
|
394 |
|
|
$group = new Form_Group('');
|
395 |
|
|
$group->addClass('toggle-pool_enable collapse');
|
396 |
|
|
|
397 |
|
|
if (!empty($pconfig['pool_enable']))
|
398 |
|
|
$group->addClass('in');
|
399 |
|
|
|
400 |
|
|
$group->add(new Form_Input(
|
401 |
|
|
'pool_address',
|
402 |
|
|
'Network',
|
403 |
|
|
'text',
|
404 |
|
|
htmlspecialchars($pconfig['pool_address'])
|
405 |
|
|
))->setWidth(4)->setHelp('Network configuration for Virtual Address Pool');
|
406 |
|
|
|
407 |
|
|
$netBits = array();
|
408 |
|
|
|
409 |
|
|
for ($i = 32; $i >= 0; $i--)
|
410 |
|
|
$netBits[$i] = $i;
|
411 |
|
|
|
412 |
|
|
$group->add(new Form_Select(
|
413 |
|
|
'pool_netbits',
|
414 |
|
|
'',
|
415 |
|
|
$pconfig['pool_netbits'],
|
416 |
|
|
$netBits
|
417 |
|
|
))->setWidth(2);
|
418 |
|
|
|
419 |
|
|
$section->add($group);
|
420 |
|
|
|
421 |
|
|
$section->addInput(new Form_Checkbox(
|
422 |
|
|
'net_list_enable',
|
423 |
|
|
'Network List',
|
424 |
|
|
'Provide a list of accessible networks to clients',
|
425 |
|
|
$pconfig['net_list_enable']
|
426 |
|
|
));
|
427 |
|
|
|
428 |
|
|
$section->addInput(new Form_Checkbox(
|
429 |
|
|
'save_passwd_enable',
|
430 |
|
|
'Save Xauth Password',
|
431 |
|
|
'Allow clients to save Xauth passwords (Cisco VPN client only).',
|
432 |
|
|
$pconfig['save_passwd_enable']
|
433 |
|
|
))->setHelp('NOTE: With iPhone clients, this does not work when deployed via the iPhone configuration utility, only by manual entry.');
|
434 |
|
|
|
435 |
|
|
$section->addInput(new Form_Checkbox(
|
436 |
|
|
'dns_domain_enable',
|
437 |
|
|
'DNS Default Domain',
|
438 |
|
|
'Provide a default domain name to clients',
|
439 |
|
|
$pconfig['dns_domain_enable']
|
440 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-dns_domain');
|
441 |
df7bc7cb
|
Sander van Leeuwen
|
|
442 |
|
|
$group = new Form_Group('');
|
443 |
|
|
$group->addClass('toggle-dns_domain collapse');
|
444 |
|
|
|
445 |
|
|
if (!empty($pconfig['dns_domain_enable']))
|
446 |
|
|
$group->addClass('in');
|
447 |
|
|
|
448 |
|
|
$group->add(new Form_Input(
|
449 |
|
|
'dns_domain',
|
450 |
|
|
'',
|
451 |
|
|
'text',
|
452 |
|
|
htmlspecialchars($pconfig['dns_domain'])
|
453 |
|
|
))->setHelp('Specify domain as DNS Default Domain');
|
454 |
|
|
|
455 |
|
|
$section->add($group);
|
456 |
|
|
|
457 |
|
|
$section->addInput(new Form_Checkbox(
|
458 |
|
|
'dns_split_enable',
|
459 |
|
|
'Split DNS',
|
460 |
46bb8a0b
|
Sjon Hortensius
|
'Provide a list of split DNS domain names to clients. Enter a space separated list.',
|
461 |
df7bc7cb
|
Sander van Leeuwen
|
$pconfig['dns_split_enable']
|
462 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-dns_split');
|
463 |
df7bc7cb
|
Sander van Leeuwen
|
|
464 |
|
|
$group = new Form_Group('');
|
465 |
|
|
$group->addClass('toggle-dns_split collapse');
|
466 |
|
|
|
467 |
|
|
if (!empty($pconfig['dns_split_enable']))
|
468 |
|
|
$group->addClass('in');
|
469 |
|
|
|
470 |
|
|
$group->add(new Form_Input(
|
471 |
|
|
'dns_split',
|
472 |
|
|
'',
|
473 |
|
|
'text',
|
474 |
|
|
htmlspecialchars($pconfig['dns_split'])
|
475 |
|
|
))->setHelp('NOTE: If left blank, and a default domain is set, it will be used for this value.');
|
476 |
|
|
|
477 |
|
|
$section->add($group);
|
478 |
|
|
|
479 |
|
|
$section->addInput(new Form_Checkbox(
|
480 |
|
|
'dns_server_enable',
|
481 |
|
|
'DNS Servers',
|
482 |
|
|
'Provide a DNS server list to clients',
|
483 |
|
|
$pconfig['dns_server_enable']
|
484 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-dns_server_enable');
|
485 |
df7bc7cb
|
Sander van Leeuwen
|
|
486 |
|
|
for ($i = 1; $i <= 4; $i++)
|
487 |
|
|
{
|
488 |
|
|
$group = new Form_Group('Server #' . $i);
|
489 |
|
|
$group->addClass('toggle-dns_server_enable collapse');
|
490 |
|
|
|
491 |
|
|
if (!empty($pconfig['dns_server_enable']))
|
492 |
|
|
$group->addClass('in');
|
493 |
|
|
|
494 |
|
|
$group->add(new Form_Input(
|
495 |
|
|
'dns_server' . $i,
|
496 |
|
|
'Server #' . $i,
|
497 |
|
|
'text',
|
498 |
|
|
htmlspecialchars($pconfig['dns_server' . $i])
|
499 |
|
|
));
|
500 |
|
|
|
501 |
|
|
$section->add($group);
|
502 |
|
|
}
|
503 |
3462a529
|
Matthew Grooms
|
|
504 |
df7bc7cb
|
Sander van Leeuwen
|
$section->addInput(new Form_Checkbox(
|
505 |
|
|
'wins_server_enable',
|
506 |
|
|
'WINS Servers',
|
507 |
|
|
'Provide a WINS server list to clients',
|
508 |
|
|
$pconfig['wins_server_enable']
|
509 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-wins_server_enable');
|
510 |
df7bc7cb
|
Sander van Leeuwen
|
|
511 |
|
|
for ($i = 1; $i <= 2; $i++)
|
512 |
|
|
{
|
513 |
|
|
$group = new Form_Group('Server #' . $i);
|
514 |
|
|
$group->addClass('toggle-wins_server_enable collapse');
|
515 |
|
|
|
516 |
|
|
if (!empty($pconfig['wins_server_enable']))
|
517 |
|
|
$group->addClass('in');
|
518 |
|
|
|
519 |
|
|
$group->add(new Form_Input(
|
520 |
|
|
'wins_server' . $i,
|
521 |
|
|
'Server #' . $i,
|
522 |
|
|
'text',
|
523 |
|
|
htmlspecialchars($pconfig['wins_server' . $i]),
|
524 |
|
|
array('size' => 20)
|
525 |
|
|
));
|
526 |
|
|
|
527 |
|
|
$section->add($group);
|
528 |
3462a529
|
Matthew Grooms
|
}
|
529 |
|
|
|
530 |
df7bc7cb
|
Sander van Leeuwen
|
$section->addInput(new Form_Checkbox(
|
531 |
|
|
'pfs_group_enable',
|
532 |
|
|
'Phase2 PFS Group',
|
533 |
|
|
'Provide the Phase2 PFS group to clients ( overrides all mobile phase2 settings )',
|
534 |
|
|
$pconfig['pfs_group_enable']
|
535 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-pfs_group');
|
536 |
df7bc7cb
|
Sander van Leeuwen
|
|
537 |
|
|
$group = new Form_Group('Group');
|
538 |
|
|
$group->addClass('toggle-pfs_group collapse');
|
539 |
|
|
|
540 |
|
|
if (!empty($pconfig['pfs_group_enable']))
|
541 |
|
|
$group->addClass('in');
|
542 |
|
|
|
543 |
|
|
$group->add(new Form_Select(
|
544 |
|
|
'pfs_group',
|
545 |
|
|
'Group',
|
546 |
|
|
$pconfig['pfs_group'],
|
547 |
|
|
$p2_pfskeygroups
|
548 |
|
|
))->setWidth(2);
|
549 |
|
|
|
550 |
|
|
$section->add($group);
|
551 |
|
|
|
552 |
|
|
$section->addInput(new Form_Checkbox(
|
553 |
|
|
'login_banner_enable',
|
554 |
|
|
'Login Banner',
|
555 |
|
|
'Provide a login banner to clients',
|
556 |
|
|
$pconfig['login_banner_enable']
|
557 |
1192840b
|
Sjon Hortensius
|
))->toggles('.toggle-login_banner');
|
558 |
df7bc7cb
|
Sander van Leeuwen
|
|
559 |
|
|
$group = new Form_Group('');
|
560 |
|
|
$group->addClass('toggle-login_banner collapse');
|
561 |
|
|
|
562 |
|
|
if (!empty($pconfig['login_banner_enable']))
|
563 |
|
|
$group->addClass('in');
|
564 |
|
|
|
565 |
|
|
// TODO: should be a textarea
|
566 |
|
|
$group->add(new Form_Input(
|
567 |
|
|
'login_banner',
|
568 |
|
|
'',
|
569 |
|
|
'text',
|
570 |
|
|
htmlspecialchars($pconfig['login_banner'])
|
571 |
|
|
));
|
572 |
|
|
|
573 |
|
|
$section->add($group);
|
574 |
|
|
|
575 |
|
|
$form->add($section);
|
576 |
|
|
|
577 |
|
|
print $form;
|
578 |
|
|
|
579 |
|
|
include("foot.inc");
|