summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-03-06 19:03:56 +0000
committerErmal Luçi <eri@pfsense.org>2008-03-06 19:03:56 +0000
commit8be2d6d3dd8c134c850aec37a58e923a68f3ef3f (patch)
tree2a4cfc856b2d5f6cf494b1123e5dddf721be3c0b /etc
parent6300a53dff5b577aff77797fd84214856b654b6a (diff)
downloadpfsense-8be2d6d3dd8c134c850aec37a58e923a68f3ef3f.zip
pfsense-8be2d6d3dd8c134c850aec37a58e923a68f3ef3f.tar.gz
Remove ugly hacks and use propper method for dispalying generated ciphers.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/openvpn.inc35
1 files changed, 24 insertions, 11 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index a8581a9..6bba755 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -40,18 +40,31 @@ require_once('util.inc');
// Return the list of ciphers OpenVPN supports
function openvpn_get_ciphers($pkg) {
- foreach ($pkg['fields']['field'] as $i => $field) {
- if ($field['fieldname'] == 'crypto') break;
- }
- $option_array = &$pkg['fields']['field'][$i]['options']['option'];
- $ciphers_out = shell_exec('openvpn --show-ciphers | grep "default key" | awk \'{print $1, "(" $2 "-" $3 ")";}\'');
- $ciphers = explode("\n", trim($ciphers_out));
- sort($ciphers);
- foreach ($ciphers as $cipher) {
- $value = explode(' ', $cipher);
- $value = $value[0];
- $option_array[] = array('value' => $value, 'name' => $cipher);
+ global $config;
+
+ foreach ($pkg['fields']['field'] as $i => $field) {
+ if ($field['fieldname'] == 'crypto') {
+ $option_array = &$pkg['fields']['field'][$i]['options']['option'];
+ $ciphers_out = shell_exec('openvpn --show-ciphers | grep "default key" | awk \'{print $1, "(" $2 "-" $3 ")";}\'');
+ $ciphers = explode("\n", trim($ciphers_out));
+ sort($ciphers);
+ foreach ($ciphers as $cipher) {
+ $value = explode(' ', $cipher);
+ $value = $value[0];
+ $option_array[] = array('value' => $value, 'name' => $cipher);
+ }
+ }
+ if ($field['fieldname'] == 'cipher') {
+ if (is_array($config['openvpn']['keys'])) {
+ if (count($config['openvpn']['keys']) > 0) {
+ $option_array = &$pkg['fields']['field'][$i]['options']['option'];
+ foreach ($config['openvpn']['keys'] as $cipher => $none) {
+ $option_array[] = array('value' => $cipher, 'name' => $cipher);
+ }
+ }
+ }
}
+ }
}
OpenPOWER on IntegriCloud