Revision a033a446
Added by Jim Pingle almost 6 years ago
src/usr/local/www/wizard.php | ||
---|---|---|
804 | 804 |
|
805 | 805 |
$section->addInput($tmpselect); |
806 | 806 |
|
807 |
break; |
|
808 |
case "select_source": |
|
809 |
if ($field['displayname']) { |
|
810 |
$etitle = $field['displayname']; |
|
811 |
} else if (!$field['dontdisplayname']) { |
|
812 |
$etitle = fixup_string($name); |
|
813 |
} |
|
814 |
|
|
815 |
if ($field['size']) { |
|
816 |
$size = " size='" . $field['size'] . "' "; |
|
817 |
} |
|
818 |
|
|
819 |
if (isset($field['multiple'])) { |
|
820 |
$items = explode(',', $value); |
|
821 |
$name .= "[]"; |
|
822 |
} else { |
|
823 |
$items = array($value); |
|
824 |
} |
|
825 |
|
|
826 |
$onchange = (isset($field['onchange']) ? "{$field['onchange']}" : ''); |
|
827 |
|
|
828 |
$source = $field['source']; |
|
829 |
try{ |
|
830 |
@eval("\$wizard_source_txt = &$source;"); |
|
831 |
} catch (\Throwable | \Error | \Exception $e) { |
|
832 |
//do nothing |
|
833 |
} |
|
834 |
#check if show disable option is present on xml |
|
835 |
if (!is_array($wizard_source_txt)) { |
|
836 |
$wizard_source_txt = array(); |
|
837 |
} |
|
838 |
if (isset($field['show_disable_value'])) { |
|
839 |
array_push($wizard_source_txt, |
|
840 |
array( |
|
841 |
($field['source_name'] ? $field['source_name'] : $name) => $field['show_disable_value'], |
|
842 |
($field['source_value'] ? $field['source_value'] : $value) => $field['show_disable_value'] |
|
843 |
)); |
|
844 |
} |
|
845 |
|
|
846 |
$srcoptions = array(); |
|
847 |
$srcselected = array(); |
|
848 |
|
|
849 |
foreach ($wizard_source_txt as $opt) { |
|
850 |
$source_name = ($field['source_name'] ? $opt[$field['source_name']] : $opt[$name]); |
|
851 |
$source_value = ($field['source_value'] ? $opt[$field['source_value']] : $opt[$value]); |
|
852 |
$srcoptions[$source_value] = $source_name; |
|
853 |
|
|
854 |
if (in_array($source_value, $items)) { |
|
855 |
array_push($srcselected, $source_value); |
|
856 |
} |
|
857 |
} |
|
858 |
|
|
859 |
$descr = (isset($field['description'])) ? $field['description'] : ""; |
|
860 |
|
|
861 |
$section->addInput(new Form_Select( |
|
862 |
$name, |
|
863 |
$etitle, |
|
864 |
isset($field['multiple']) ? $srcselected : $srcselected[0], |
|
865 |
$srcoptions, |
|
866 |
isset($field['multiple']) |
|
867 |
))->setHelp($descr)->setOnchange($onchange); |
|
868 |
|
|
807 | 869 |
break; |
808 | 870 |
case "textarea": |
809 | 871 |
if ($field['displayname']) { |
src/usr/local/www/wizards/openvpn_wizard.inc | ||
---|---|---|
28 | 28 |
// Load valid country codes |
29 | 29 |
$dn_cc = get_cert_country_codes(); |
30 | 30 |
|
31 |
function openvpn_wizard_get_dhparams() { |
|
32 |
global $openvpn_dh_lengths; |
|
33 |
$dhparams = array(); |
|
34 |
foreach ($openvpn_dh_lengths as $value => $name) { |
|
35 |
$dhparams[] = array( |
|
36 |
"value" => $value, |
|
37 |
"name" => $name |
|
38 |
); |
|
39 |
} |
|
40 |
return $dhparams; |
|
41 |
} |
|
42 |
|
|
31 | 43 |
function step1_stepsubmitbeforesave() { |
32 | 44 |
global $stepid, $config; |
33 | 45 |
if (($_POST['authtype'] != NULL) && ($_POST['authtype'] != $config['ovpnserver']['step1']['type'])) { |
src/usr/local/www/wizards/openvpn_wizard.xml | ||
---|---|---|
779 | 779 |
<field> |
780 | 780 |
<displayname>DH Parameters Length</displayname> |
781 | 781 |
<name>dhparameters</name> |
782 |
<type>select</type> |
|
782 |
<type>select_source</type> |
|
783 |
<source><![CDATA[openvpn_wizard_get_dhparams()]]></source> |
|
784 |
<source_name>name</source_name> |
|
785 |
<source_value>value</source_value> |
|
783 | 786 |
<value>2048</value> |
784 | 787 |
<bindstofield>ovpnserver->step10->dhkey</bindstofield> |
785 |
<options> |
|
786 |
<option> |
|
787 |
<name>1024 bit</name> |
|
788 |
<value>1024</value> |
|
789 |
</option> |
|
790 |
<option> |
|
791 |
<name>2048 bit</name> |
|
792 |
<value>2048</value> |
|
793 |
</option> |
|
794 |
<option> |
|
795 |
<name>3072 bit</name> |
|
796 |
<value>3072</value> |
|
797 |
</option> |
|
798 |
<option> |
|
799 |
<name>4096 bit</name> |
|
800 |
<value>4096</value> |
|
801 |
</option> |
|
802 |
<option> |
|
803 |
<name>6144 bit</name> |
|
804 |
<value>6144</value> |
|
805 |
</option> |
|
806 |
<option> |
|
807 |
<name>7680 bit</name> |
|
808 |
<value>7680</value> |
|
809 |
</option> |
|
810 |
<option> |
|
811 |
<name>8192 bit</name> |
|
812 |
<value>8192</value> |
|
813 |
</option> |
|
814 |
<option> |
|
815 |
<name>15360 bit</name> |
|
816 |
<value>15360</value> |
|
817 |
</option> |
|
818 |
<option> |
|
819 |
<name>16384 bit</name> |
|
820 |
<value>16384</value> |
|
821 |
</option> |
|
822 |
</options> |
|
823 | 788 |
<description><br/>Length of Diffie-Hellman (DH) key exchange parameters, used for establishing a secure communications channel. The DH parameters are different from key sizes, but as with other such settings, the larger the key, the more security it offers, but larger keys take considerably more time to generate. As of 2016, 2048 bit is a common and typical selection.</description> |
824 | 789 |
</field> |
825 | 790 |
<field> |
Also available in: Unified diff
Add wizard select_source & use for OpenVPN DH. Fixes #9748
(cherry picked from commit 52f686a97f77cfd00ddb69088bef7164676d4117)