Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
3cc02b09
Commit
3cc02b09
authored
Jun 27, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup js in vpn_ipsec_phase1.php for
https://github.com/opnsense/core/issues/1005
parent
5f27b92c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
157 deletions
+91
-157
vpn_ipsec_phase1.php
src/www/vpn_ipsec_phase1.php
+91
-157
No files found.
src/www/vpn_ipsec_phase1.php
View file @
3cc02b09
...
@@ -417,157 +417,87 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -417,157 +417,87 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$service_hook
=
'ipsec'
;
$service_hook
=
'ipsec'
;
legacy_html_escape_form_data
(
$pconfig
);
legacy_html_escape_form_data
(
$pconfig
);
include
(
"head.inc"
);
include
(
"head.inc"
);
?>
?>
<body>
<body>
<?php
include
(
"fbegin.inc"
);
?>
<?php
include
(
"fbegin.inc"
);
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
$
(
document
).
ready
(
function
()
{
$
(
"
#myid_type
"
).
change
(
function
(){
<?php
if
(
$
(
"
#myid_type
"
).
val
()
==
'
myaddress
'
)
{
/* determine if we should init the key length */
$
(
"
#myid_data
"
).
removeClass
(
'
show
'
);
$keyset
=
''
;
$
(
"
#myid_data
"
).
addClass
(
'
hidden
'
);
if
(
isset
(
$pconfig
[
'encryption-algorithm'
][
'keylen'
]))
{
}
else
{
if
(
is_numeric
(
$pconfig
[
'encryption-algorithm'
][
'keylen'
]))
{
$
(
"
#myid_data
"
).
removeClass
(
'
hidden
'
);
$keyset
=
$pconfig
[
'encryption-algorithm'
][
'keylen'
];
$
(
"
#myid_data
"
).
addClass
(
'
show
'
);
}
}
}
});
?>
$
(
"
#myid_type
"
).
change
();
$
(
document
).
ready
(
function
()
{
// old js code..
$
(
"
#peerid_type
"
).
change
(
function
(){
myidsel_change
();
if
(
$
(
"
#peerid_type
"
).
val
()
==
'
peeraddress
'
)
{
peeridsel_change
();
$
(
"
#peerid_data
"
).
removeClass
(
'
show
'
);
methodsel_change
();
$
(
"
#peerid_data
"
).
addClass
(
'
hidden
'
);
ealgosel_change
(
<?=
$keyset
;
?>
);
}
else
{
dpdchkbox_change
();
$
(
"
#peerid_data
"
).
removeClass
(
'
hidden
'
);
});
$
(
"
#peerid_data
"
).
addClass
(
'
show
'
);
}
});
function
myidsel_change
()
{
$
(
"
#peerid_type
"
).
change
();
if
(
$
(
"
#myid_type
"
).
val
()
==
'
myaddress
'
)
{
$
(
"
#myid_data
"
).
removeClass
(
'
show
'
);
$
(
"
#authentication_method
"
).
change
(
function
(){
$
(
"
#myid_data
"
).
addClass
(
'
hidden
'
);
$
(
"
.auth_opt
"
).
hide
();
}
else
{
switch
(
$
(
"
#authentication_method
"
).
val
())
{
$
(
"
#myid_data
"
).
removeClass
(
'
hidden
'
);
case
'
eap-tls
'
:
$
(
"
#myid_data
"
).
addClass
(
'
show
'
);
case
'
hybrid_rsa_server
'
:
}
case
'
xauth_rsa_server
'
:
}
case
'
rsasig
'
:
$
(
"
.auth_eap_tls
"
).
show
();
function
peeridsel_change
()
{
break
;
if
(
$
(
"
#peerid_type
"
).
val
()
==
'
peeraddress
'
)
{
case
'
pre_shared_key
'
:
$
(
"
#peerid_data
"
).
removeClass
(
'
show
'
);
if
(
$
(
"
#mobile
"
)
==
undefined
)
{
$
(
"
#peerid_data
"
).
addClass
(
'
hidden
'
);
$
(
"
.auth_psk
"
).
show
();
}
else
{
}
$
(
"
#peerid_data
"
).
removeClass
(
'
hidden
'
);
break
;
$
(
"
#peerid_data
"
).
addClass
(
'
show
'
);
default
:
/* psk modes*/
}
$
(
"
.auth_psk
"
).
show
();
}
break
;
}
function
methodsel_change
()
{
});
index
=
document
.
iform
.
authentication_method
.
selectedIndex
;
$
(
"
#authentication_method
"
).
change
();
value
=
document
.
iform
.
authentication_method
.
options
[
index
].
value
;
$
(
"
#ealgo
"
).
change
(
function
(){
switch
(
value
)
{
if
(
$
(
"
#ealgo option:selected
"
).
data
(
'
lo
'
)
!=
""
)
{
case
'
eap-tls
'
:
$
(
"
#ealgo_keylen
"
).
show
();
document
.
getElementById
(
'
opt_psk
'
).
style
.
display
=
'
none
'
;
$
(
"
#ealgo_keylen
"
).
prop
(
'
disabled
'
,
false
);
document
.
getElementById
(
'
opt_peerid
'
).
style
.
display
=
''
;
$
(
"
#ealgo_keylen option
"
).
remove
();
document
.
getElementById
(
'
opt_cert
'
).
style
.
display
=
''
;
for
(
var
i
=
$
(
"
#ealgo option:selected
"
).
data
(
'
lo
'
);
i
<=
$
(
"
#ealgo option:selected
"
).
data
(
'
hi
'
);
i
+=
$
(
"
#ealgo option:selected
"
).
data
(
'
step
'
))
{
document
.
getElementById
(
'
opt_ca
'
).
style
.
display
=
''
;
$
(
"
#ealgo_keylen
"
).
append
(
$
(
"
<option/>
"
).
attr
(
'
value
'
,
i
).
text
(
i
));
document
.
getElementById
(
'
opt_cert
'
).
disabled
=
false
;
}
document
.
getElementById
(
'
opt_ca
'
).
disabled
=
false
;
$
(
"
#ealgo_keylen
"
).
val
(
$
(
"
#ealgo
"
).
data
(
"
default-keylen
"
));
break
;
}
else
{
case
'
hybrid_rsa_server
'
:
$
(
"
#ealgo_keylen
"
).
hide
();
document
.
getElementById
(
'
opt_psk
'
).
style
.
display
=
'
none
'
;
$
(
"
#ealgo_keylen
"
).
prop
(
'
disabled
'
,
true
);
document
.
getElementById
(
'
opt_peerid
'
).
style
.
display
=
''
;
}
document
.
getElementById
(
'
opt_cert
'
).
style
.
display
=
''
;
});
document
.
getElementById
(
'
opt_ca
'
).
style
.
display
=
''
;
$
(
"
#ealgo
"
).
change
();
document
.
getElementById
(
'
opt_cert
'
).
disabled
=
false
;
document
.
getElementById
(
'
opt_ca
'
).
disabled
=
false
;
$
(
"
#dpd_enable
"
).
change
(
function
(){
break
;
if
(
$
(
this
).
prop
(
'
checked
'
))
{
case
'
xauth_rsa_server
'
:
$
(
"
#opt_dpd
"
).
show
();
case
'
rsasig
'
:
if
(
$
(
"
#dpd_delay
"
).
val
()
==
""
)
{
document
.
getElementById
(
'
opt_psk
'
).
style
.
display
=
'
none
'
;
$
(
"
#dpd_delay
"
).
val
(
"
10
"
);
document
.
getElementById
(
'
opt_peerid
'
).
style
.
display
=
''
;
}
document
.
getElementById
(
'
opt_cert
'
).
style
.
display
=
''
;
if
(
$
(
"
#dpd_maxfail
"
).
val
()
==
""
)
{
document
.
getElementById
(
'
opt_ca
'
).
style
.
display
=
''
;
$
(
"
#dpd_maxfail
"
).
val
(
"
5
"
);
document
.
getElementById
(
'
opt_cert
'
).
disabled
=
false
;
}
document
.
getElementById
(
'
opt_ca
'
).
disabled
=
false
;
}
else
{
break
;
$
(
"
#opt_dpd
"
).
hide
();
<?php
if
(
!
empty
(
$pconfig
[
'mobile'
]))
{
}
?>
});
case
'
pre_shared_key
'
:
$
(
"
#dpd_enable
"
).
change
();
document
.
getElementById
(
'
opt_psk
'
).
style
.
display
=
'
none
'
;
});
document
.
getElementById
(
'
opt_peerid
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
opt_cert
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
opt_ca
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
opt_cert
'
).
disabled
=
true
;
document
.
getElementById
(
'
opt_ca
'
).
disabled
=
true
;
break
;
<?php
}
?>
default
:
/* psk modes*/
document
.
getElementById
(
'
opt_psk
'
).
style
.
display
=
''
;
document
.
getElementById
(
'
opt_peerid
'
).
style
.
display
=
''
;
document
.
getElementById
(
'
opt_cert
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
opt_ca
'
).
style
.
display
=
'
none
'
;
document
.
getElementById
(
'
opt_cert
'
).
disabled
=
true
;
document
.
getElementById
(
'
opt_ca
'
).
disabled
=
true
;
break
;
}
}
/* PHP generated java script for variable length keys */
function
ealgosel_change
(
bits
)
{
switch
(
document
.
iform
.
ealgo
.
selectedIndex
)
{
<?php
$i
=
0
;
foreach
(
$p1_ealgos
as
$algo
=>
$algodata
)
{
if
(
isset
(
$algodata
[
'keysel'
])
&&
is_array
(
$algodata
[
'keysel'
]))
{
echo
" case
{
$i
}
:
\n
"
;
echo
" document.iform.ealgo_keylen.style.visibility = 'visible';
\n
"
;
echo
" document.iform.ealgo_keylen.options.length = 0;
\n
"
;
// echo " document.iform.ealgo_keylen.options[document.iform.ealgo_keylen.options.length] = new Option( 'auto', 'auto' );\n";
$key_hi
=
$algodata
[
'keysel'
][
'hi'
];
$key_lo
=
$algodata
[
'keysel'
][
'lo'
];
$key_step
=
$algodata
[
'keysel'
][
'step'
];
for
(
$keylen
=
$key_hi
;
$keylen
>=
$key_lo
;
$keylen
-=
$key_step
)
{
echo
" document.iform.ealgo_keylen.options[document.iform.ealgo_keylen.options.length] = new Option( '
{
$keylen
}
bits', '
{
$keylen
}
' );
\n
"
;
}
echo
" break;
\n
"
;
}
else
{
echo
" case
{
$i
}
:
\n
"
;
echo
" document.iform.ealgo_keylen.style.visibility = 'hidden';
\n
"
;
echo
" document.iform.ealgo_keylen.options.length = 0;
\n
"
;
echo
" break;
\n
"
;
}
$i
++
;
}
?>
}
if
(
bits
)
document
.
iform
.
ealgo_keylen
.
value
=
bits
;
}
function
dpdchkbox_change
()
{
if
(
document
.
iform
.
dpd_enable
.
checked
)
document
.
getElementById
(
'
opt_dpd
'
).
style
.
display
=
''
;
else
document
.
getElementById
(
'
opt_dpd
'
).
style
.
display
=
'
none
'
;
if
(
!
document
.
iform
.
dpd_delay
.
value
)
document
.
iform
.
dpd_delay
.
value
=
"
10
"
;
if
(
!
document
.
iform
.
dpd_maxfail
.
value
)
document
.
iform
.
dpd_maxfail
.
value
=
"
5
"
;
}
//]]>
</script>
</script>
<section
class=
"page-content-main"
>
<section
class=
"page-content-main"
>
...
@@ -729,7 +659,7 @@ function dpdchkbox_change() {
...
@@ -729,7 +659,7 @@ function dpdchkbox_change() {
<tr>
<tr>
<td><a
id=
"help_for_authmethod"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Authentication method"
);
?>
</td>
<td><a
id=
"help_for_authmethod"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Authentication method"
);
?>
</td>
<td>
<td>
<select
name=
"authentication_method"
class=
"formselect"
onchange=
"methodsel_change()
"
>
<select
name=
"authentication_method"
id=
"authentication_method"
class=
"formselect
"
>
<?php
<?php
$p1_authentication_methods
=
array
(
$p1_authentication_methods
=
array
(
'hybrid_rsa_server'
=>
array
(
'name'
=>
'Hybrid RSA + Xauth'
,
'mobile'
=>
true
),
'hybrid_rsa_server'
=>
array
(
'name'
=>
'Hybrid RSA + Xauth'
,
'mobile'
=>
true
),
...
@@ -776,7 +706,7 @@ function dpdchkbox_change() {
...
@@ -776,7 +706,7 @@ function dpdchkbox_change() {
<tr>
<tr>
<td
><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"My identifier"
);
?>
</td>
<td
><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"My identifier"
);
?>
</td>
<td>
<td>
<select
name=
"myid_type"
id=
"myid_type"
class=
"formselect"
onchange=
"myidsel_change()"
>
<select
name=
"myid_type"
id=
"myid_type"
class=
"formselect"
>
<?php
<?php
$my_identifier_list
=
array
(
$my_identifier_list
=
array
(
'myaddress'
=>
array
(
'desc'
=>
gettext
(
'My IP address'
),
'mobile'
=>
true
),
'myaddress'
=>
array
(
'desc'
=>
gettext
(
'My IP address'
),
'mobile'
=>
true
),
...
@@ -801,10 +731,10 @@ endforeach; ?>
...
@@ -801,10 +731,10 @@ endforeach; ?>
</div>
</div>
</td>
</td>
</tr>
</tr>
<tr
id=
"opt_peerid
"
>
<tr
class=
"auth_opt auth_eap_tls auth_psk
"
>
<td
><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Peer identifier"
);
?>
</td>
<td
><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Peer identifier"
);
?>
</td>
<td>
<td>
<select
name=
"peerid_type"
id=
"peerid_type"
class=
"formselect"
onchange=
"peeridsel_change()"
>
<select
name=
"peerid_type"
id=
"peerid_type"
class=
"formselect"
>
<?php
<?php
$peer_identifier_list
=
array
(
$peer_identifier_list
=
array
(
'peeraddress'
=>
array
(
'desc'
=>
gettext
(
'Peer IP address'
),
'mobile'
=>
false
),
'peeraddress'
=>
array
(
'desc'
=>
gettext
(
'Peer IP address'
),
'mobile'
=>
false
),
...
@@ -832,7 +762,7 @@ endforeach; ?>
...
@@ -832,7 +762,7 @@ endforeach; ?>
}
?>
}
?>
</td>
</td>
</tr>
</tr>
<tr
id=
"opt
_psk"
>
<tr
class=
"auth_opt auth
_psk"
>
<td
><a
id=
"help_for_psk"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Pre-Shared Key"
);
?>
</td>
<td
><a
id=
"help_for_psk"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Pre-Shared Key"
);
?>
</td>
<td>
<td>
<input
name=
"pre-shared-key"
type=
"text"
class=
"formfld unknown"
id=
"pskey"
size=
"40"
<input
name=
"pre-shared-key"
type=
"text"
class=
"formfld unknown"
id=
"pskey"
size=
"40"
...
@@ -842,7 +772,7 @@ endforeach; ?>
...
@@ -842,7 +772,7 @@ endforeach; ?>
</div>
</div>
</td>
</td>
</tr>
</tr>
<tr
id=
"opt_cert
"
>
<tr
class=
"auth_opt auth_eap_tls
"
>
<td
><a
id=
"help_for_certref"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"My Certificate"
);
?>
</td>
<td
><a
id=
"help_for_certref"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"My Certificate"
);
?>
</td>
<td>
<td>
<select
name=
"certref"
class=
"formselect"
>
<select
name=
"certref"
class=
"formselect"
>
...
@@ -862,7 +792,7 @@ endforeach; ?>
...
@@ -862,7 +792,7 @@ endforeach; ?>
</div>
</div>
</td>
</td>
</tr>
</tr>
<tr
id=
"opt_ca
"
>
<tr
class=
"auth_opt auth_eap_tls
"
>
<td><a
id=
"help_for_caref"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"My Certificate Authority"
);
?>
</td>
<td><a
id=
"help_for_caref"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"My Certificate Authority"
);
?>
</td>
<td>
<td>
<select
name=
"caref"
class=
"formselect"
>
<select
name=
"caref"
class=
"formselect"
>
...
@@ -891,11 +821,15 @@ endforeach; ?>
...
@@ -891,11 +821,15 @@ endforeach; ?>
<tr>
<tr>
<td><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Encryption algorithm"
);
?>
</td>
<td><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Encryption algorithm"
);
?>
</td>
<td>
<td>
<select
name=
"ealgo"
id=
"ealgo"
class=
"formselect"
onchange=
"ealgosel_change()
"
>
<select
name=
"ealgo"
id=
"ealgo"
data-default-keylen=
"
<?=
$pconfig
[
'encryption-algorithm'
][
'keylen'
];
?>
"
>
<?php
<?php
foreach
(
$p1_ealgos
as
$algo
=>
$algodata
)
:
foreach
(
$p1_ealgos
as
$algo
=>
$algodata
)
:
?>
?>
<option
value=
"
<?=
$algo
;
?>
"
<?=
$algo
==
$pconfig
[
'encryption-algorithm'
][
'name'
]
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<option
value=
"
<?=
$algo
;
?>
"
<?=
$algo
==
$pconfig
[
'encryption-algorithm'
][
'name'
]
?
"selected=
\"
selected
\"
"
:
""
;
?>
data-hi=
"
<?=
$algodata
[
'keysel'
][
'hi'
];
?>
"
data-lo=
"
<?=
$algodata
[
'keysel'
][
'lo'
];
?>
"
data-step=
"
<?=
$algodata
[
'keysel'
][
'step'
];
?>
"
>
<?=
$algodata
[
'name'
];
?>
<?=
$algodata
[
'name'
];
?>
</option>
</option>
<?php
<?php
...
@@ -903,7 +837,7 @@ endforeach; ?>
...
@@ -903,7 +837,7 @@ endforeach; ?>
?>
?>
</select>
</select>
<select
name=
"ealgo_keylen"
width=
"30"
class=
"formselect"
>
<select
name=
"ealgo_keylen"
id=
"ealgo_keylen"
width=
"30"
class=
"formselect"
>
</select>
</select>
</td>
</td>
</tr>
</tr>
...
@@ -1017,7 +951,7 @@ endforeach; ?>
...
@@ -1017,7 +951,7 @@ endforeach; ?>
<tr>
<tr>
<td><a
id=
"help_for_dpd_enable"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Dead Peer Detection"
);
?>
</td>
<td><a
id=
"help_for_dpd_enable"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Dead Peer Detection"
);
?>
</td>
<td>
<td>
<input
name=
"dpd_enable"
type=
"checkbox"
id=
"dpd_enable"
value=
"yes"
<?=
!
empty
(
$pconfig
[
'dpd_delay'
])
&&
!
empty
(
$pconfig
[
'dpd_maxfail'
])
?
"checked=
\"
checked
\"
"
:
""
;
?>
onclick=
"dpdchkbox_change()"
/>
<input
name=
"dpd_enable"
type=
"checkbox"
id=
"dpd_enable"
value=
"yes"
<?=
!
empty
(
$pconfig
[
'dpd_delay'
])
&&
!
empty
(
$pconfig
[
'dpd_maxfail'
])
?
"checked=
\"
checked
\"
"
:
""
;
?>
/>
<div
class=
"hidden"
for=
"help_for_dpd_enable"
>
<div
class=
"hidden"
for=
"help_for_dpd_enable"
>
<?=
gettext
(
"Enable DPD"
);
?>
<?=
gettext
(
"Enable DPD"
);
?>
</div>
</div>
...
@@ -1047,7 +981,7 @@ endforeach; ?>
...
@@ -1047,7 +981,7 @@ endforeach; ?>
endif
;
?>
endif
;
?>
<?php
if
(
!
empty
(
$pconfig
[
'mobile'
]))
:
<?php
if
(
!
empty
(
$pconfig
[
'mobile'
]))
:
?>
?>
<input
name=
"mobile"
type=
"hidden"
value=
"true"
/>
<input
id=
"mobile"
name=
"mobile"
type=
"hidden"
value=
"true"
/>
<?php
<?php
endif
;
?>
endif
;
?>
<input
name=
"ikeid"
type=
"hidden"
value=
"
<?=
$pconfig
[
'ikeid'
];
?>
"
/>
<input
name=
"ikeid"
type=
"hidden"
value=
"
<?=
$pconfig
[
'ikeid'
];
?>
"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment