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
5dc95bac
Commit
5dc95bac
authored
Oct 12, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ipsec shared secrets) fix spacing, add type. closes
https://github.com/opnsense/core/issues/1214
parent
029393ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
41 deletions
+44
-41
ipsec.inc
src/etc/inc/ipsec.inc
+2
-1
vpn_ipsec_keys.php
src/www/vpn_ipsec_keys.php
+30
-40
vpn_ipsec_keys_edit.php
src/www/vpn_ipsec_keys_edit.php
+12
-0
No files found.
src/etc/inc/ipsec.inc
View file @
5dc95bac
...
...
@@ -807,7 +807,8 @@ EOD;
}
else
{
$ident
=
$key
[
'ident'
];
}
$pskconf
.=
"
{
$ident
}
: PSK 0s"
.
base64_encode
(
$key
[
'pre-shared-key'
])
.
"
\n
"
;
$identType
=
!
empty
(
$key
[
'type'
])
?
$key
[
'type'
]
:
"PSK"
;
$pskconf
.=
"
{
$ident
}
:
{
$identType
}
0s"
.
base64_encode
(
$key
[
'pre-shared-key'
])
.
"
\n
"
;
}
unset
(
$key
);
}
...
...
src/www/vpn_ipsec_keys.php
View file @
5dc95bac
...
...
@@ -60,7 +60,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$savemsg
=
get_std_save_message
();
clear_subsystem_dirty
(
'ipsec'
);
}
else
{
// nothing to post, redirect
// nothing to post, redirect
header
(
url_safe
(
'Location: /vpn_ipsec_keys.php'
));
exit
;
}
...
...
@@ -122,53 +122,43 @@ if (is_subsystem_dirty('ipsec')) {
<tr>
<td>
<?=
gettext
(
"Identifier"
);
?>
</td>
<td>
<?=
gettext
(
"Pre-Shared Key"
);
?>
</td>
<td>
<?=
gettext
(
"Type"
);
?>
</td>
<td>
<a
href=
"vpn_ipsec_keys_edit.php"
class=
"btn btn-default btn-xs"
><span
class=
"glyphicon glyphicon-plus"
></span></a>
</td>
</tr>
<?php
$i
=
0
;
$userkeys
=
array
();
foreach
(
$config
[
'system'
][
'user'
]
as
$id
=>
$user
)
{
if
(
!
empty
(
$user
[
'ipsecpsk'
]))
{
$userkeys
[]
=
array
(
'ident'
=>
$user
[
'name'
],
'pre-shared-key'
=>
$user
[
'ipsecpsk'
],
'id'
=>
$id
);
}
}
foreach
(
$userkeys
as
$secretent
)
:
?>
<tr>
<td>
<?=
htmlspecialchars
(
$secretent
[
'ident'
])
;
?>
</td>
<td>
<?=
htmlspecialchars
(
$secretent
[
'pre-shared-key'
]);
?>
</td>
<td>
<a
href=
"system_usermanager.php?userid=
<?=
$secretent
[
'id'
];
?>
&act=edit"
title=
"
<?=
gettext
(
"edit"
);
?>
"
class=
"btn btn-default btn-xs"
><span
class=
"glyphicon glyphicon-pencil"
></span></a>
</td>
</tr>
<?php
$i
++
;
endforeach
;
?>
foreach
(
$config
[
'system'
][
'user'
]
as
$id
=>
$user
)
{
if
(
!
empty
(
$user
[
'ipsecpsk'
]))
{
$userkeys
[]
=
array
(
'ident'
=>
$user
[
'name'
],
'pre-shared-key'
=>
$user
[
'ipsecpsk'
],
'id'
=>
$id
);
}
}
foreach
(
$userkeys
as
$secretent
)
:?>
<
tr
>
<
td
><?=
htmlspecialchars
(
$secretent
[
'ident'
])
;
?>
</td>
<td>
<?=
htmlspecialchars
(
$secretent
[
'pre-shared-key'
]);
?>
</td>
<td>
PSK
</td>
<td>
<a
href=
"system_usermanager.php?userid=
<?=
$secretent
[
'id'
];
?>
&act=edit"
title=
"
<?=
gettext
(
"edit"
);
?>
"
class=
"btn btn-default btn-xs"
><span
class=
"glyphicon glyphicon-pencil"
></span></a>
</td>
</tr>
<?php
$i
++
;
endforeach
;
$i
=
0
;
foreach
(
$config
[
'ipsec'
][
'mobilekey'
]
as
$secretent
)
:
?>
<tr>
<td>
<?=
htmlspecialchars
(
$secretent
[
'ident'
]);
?>
</td>
<td>
<?=
htmlspecialchars
(
$secretent
[
'pre-shared-key'
]);
?>
</td>
<td>
<a
href=
"vpn_ipsec_keys_edit.php?id=
<?=
$i
;
?>
"
title=
"
<?=
gettext
(
"edit key"
);
?>
"
class=
"btn btn-default btn-xs"
><span
class=
"glyphicon glyphicon-pencil"
></span></a>
<a
id=
"del_
<?=
$i
;
?>
"
title=
"
<?=
gettext
(
"delete key"
);
?>
"
class=
"act_delete btn btn-default btn-xs"
><span
class=
"fa fa-trash text-muted"
></span></a>
</td>
</tr>
<?php
$i
++
;
endforeach
;
?>
foreach
(
$config
[
'ipsec'
][
'mobilekey'
]
as
$secretent
)
:?>
<
tr
>
<
td
><?=
htmlspecialchars
(
$secretent
[
'ident'
]);
?>
</td>
<td>
<?=
htmlspecialchars
(
$secretent
[
'pre-shared-key'
]);
?>
</td>
<td>
<?=
!
empty
(
$secretent
[
'type'
])
?
htmlspecialchars
(
$secretent
[
'type'
])
:
"PSK"
?>
</td>
<td><a
href=
"vpn_ipsec_keys_edit.php?id=
<?=
$i
;
?>
"
title=
"
<?=
gettext
(
"edit key"
);
?>
"
class=
"btn btn-default btn-xs"
><span
class=
"glyphicon glyphicon-pencil"
></span></a>
<a
id=
"del_
<?=
$i
;
?>
"
title=
"
<?=
gettext
(
"delete key"
);
?>
"
class=
"act_delete btn btn-default btn-xs"
><span
class=
"fa fa-trash text-muted"
></span></a>
</td>
</tr>
<?php
$i
++
;
endforeach
;
?>
<tr>
<td
colspan=
"2"
>
<?=
gettext
(
"PSK for any user can be set by using an identifier of any/ANY"
)
?>
...
...
src/www/vpn_ipsec_keys_edit.php
View file @
5dc95bac
...
...
@@ -49,10 +49,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$id
=
$_GET
[
'id'
];
$pconfig
[
'ident'
]
=
$config
[
'ipsec'
][
'mobilekey'
][
$id
][
'ident'
];
$pconfig
[
'psk'
]
=
$config
[
'ipsec'
][
'mobilekey'
][
$id
][
'pre-shared-key'
];
$pconfig
[
'type'
]
=
$config
[
'ipsec'
][
'mobilekey'
][
$id
][
'type'
];
}
else
{
// init new
$pconfig
[
'ident'
]
=
''
;
$pconfig
[
'psk'
]
=
''
;
$pconfig
[
'type'
]
=
'PSK'
;
}
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$input_errors
=
array
();
...
...
@@ -97,6 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$secretent
=
array
();
$secretent
[
'ident'
]
=
$pconfig
[
'ident'
];
$secretent
[
'pre-shared-key'
]
=
$pconfig
[
'psk'
];
$secretent
[
'type'
]
=
$pconfig
[
'type'
];
if
(
$id
!==
null
)
{
// edit existing key
...
...
@@ -153,6 +156,15 @@ include("head.inc");
<input
name=
"psk"
type=
"text"
class=
"formfld unknown"
id=
"psk"
size=
"40"
value=
"
<?=
$pconfig
[
'psk'
];
?>
"
/>
</td>
</tr>
<tr>
<td><i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
"Type"
);
?>
</td>
<td>
<select
name=
"type"
class=
"selectpicker"
>
<option
value=
"PSK"
<?=
empty
(
$pconfig
[
'type'
])
||
$pconfig
[
'type'
]
==
'PSK'
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"PSK"
);
?>
</option>
<option
value=
"EAP"
<?=
$pconfig
[
'type'
]
==
"EAP"
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"EAP"
);
?>
</option>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
...
...
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