Revision 97d5b59b
Added by Jim Pingle over 11 years ago
etc/inc/openvpn.inc | ||
---|---|---|
202 | 202 |
return $ciphers; |
203 | 203 |
} |
204 | 204 |
|
205 |
function openvpn_get_digestlist() { |
|
206 |
|
|
207 |
$digests = array(); |
|
208 |
$digest_out = shell_exec('/usr/local/sbin/openvpn --show-digests | /usr/bin/grep "digest size" | /usr/bin/awk \'{print $1, "(" $2 "-" $3 ")";}\''); |
|
209 |
$digest_lines = explode("\n", trim($digest_out)); |
|
210 |
sort($digest_lines); |
|
211 |
foreach ($digest_lines as $line) { |
|
212 |
$words = explode(' ', $line); |
|
213 |
$digests[$words[0]] = "{$words[0]} {$words[1]}"; |
|
214 |
} |
|
215 |
$digests["none"] = gettext("None (No Authentication)"); |
|
216 |
return $digests; |
|
217 |
} |
|
218 |
|
|
205 | 219 |
function openvpn_get_engines() { |
206 | 220 |
$openssl_engines = array('none' => 'No Hardware Crypto Acceleration'); |
207 | 221 |
exec("/usr/local/bin/openssl engine -t -c", $openssl_engine_output); |
... | ... | |
414 | 428 |
$proto = "{$proto}-{$mode}"; |
415 | 429 |
$dev_mode = $settings['dev_mode']; |
416 | 430 |
$cipher = $settings['crypto']; |
431 |
// OpenVPN defaults to SHA1, so use it when unset to maintain compatibility. |
|
432 |
$digest = !empty($settings['digest']) ? $settings['digest'] : "SHA1"; |
|
417 | 433 |
|
418 | 434 |
$interface = get_failover_interface($settings['interface']); |
419 | 435 |
$ipaddr = $settings['ipaddr']; |
... | ... | |
456 | 472 |
$conf .= "persist-key\n"; |
457 | 473 |
$conf .= "proto {$proto}\n"; |
458 | 474 |
$conf .= "cipher {$cipher}\n"; |
475 |
$conf .= "auth {$digest}\n"; |
|
459 | 476 |
$conf .= "up /usr/local/sbin/ovpn-linkup\n"; |
460 | 477 |
$conf .= "down /usr/local/sbin/ovpn-linkdown\n"; |
461 | 478 |
if (file_exists("/usr/local/sbin/openvpn.attributes.sh")) { |
usr/local/www/vpn_openvpn_client.php | ||
---|---|---|
92 | 92 |
$pconfig['autotls_enable'] = "yes"; |
93 | 93 |
$pconfig['interface'] = "wan"; |
94 | 94 |
$pconfig['server_port'] = 1194; |
95 |
// OpenVPN Defaults to SHA1 |
|
96 |
$pconfig['digest'] = "SHA1"; |
|
95 | 97 |
} |
96 | 98 |
|
97 | 99 |
if($_GET['act']=="edit"){ |
... | ... | |
129 | 131 |
} else |
130 | 132 |
$pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']); |
131 | 133 |
$pconfig['crypto'] = $a_client[$id]['crypto']; |
134 |
// OpenVPN Defaults to SHA1 if unset |
|
135 |
$pconfig['digest'] = !empty($a_client[$id]['digest']) ? $a_client[$id]['digest'] : "SHA1"; |
|
132 | 136 |
$pconfig['engine'] = $a_client[$id]['engine']; |
133 | 137 |
|
134 | 138 |
$pconfig['tunnel_network'] = $a_client[$id]['tunnel_network']; |
... | ... | |
283 | 287 |
$client['shared_key'] = base64_encode($pconfig['shared_key']); |
284 | 288 |
} |
285 | 289 |
$client['crypto'] = $pconfig['crypto']; |
290 |
$client['digest'] = $pconfig['digest']; |
|
286 | 291 |
$client['engine'] = $pconfig['engine']; |
287 | 292 |
|
288 | 293 |
$client['tunnel_network'] = $pconfig['tunnel_network']; |
... | ... | |
762 | 767 |
</select> |
763 | 768 |
</td> |
764 | 769 |
</tr> |
770 |
<tr> |
|
771 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Auth Digest Algorithm"); ?></td> |
|
772 |
<td width="78%" class="vtable"> |
|
773 |
<select name="digest" class="formselect"> |
|
774 |
<?php |
|
775 |
$digestlist = openvpn_get_digestlist(); |
|
776 |
foreach ($digestlist as $name => $desc): |
|
777 |
$selected = ''; |
|
778 |
if ($name == $pconfig['digest']) |
|
779 |
$selected = ' selected'; |
|
780 |
?> |
|
781 |
<option value="<?=$name;?>"<?=$selected?>> |
|
782 |
<?=htmlspecialchars($desc);?> |
|
783 |
</option> |
|
784 |
<?php endforeach; ?> |
|
785 |
</select> |
|
786 |
</td> |
|
787 |
</tr> |
|
765 | 788 |
<tr id="engine"> |
766 | 789 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td> |
767 | 790 |
<td width="78%" class="vtable"> |
usr/local/www/vpn_openvpn_server.php | ||
---|---|---|
97 | 97 |
$pconfig['local_port'] = openvpn_port_next('UDP'); |
98 | 98 |
$pconfig['pool_enable'] = "yes"; |
99 | 99 |
$pconfig['cert_depth'] = 1; |
100 |
// OpenVPN Defaults to SHA1 |
|
101 |
$pconfig['digest'] = "SHA1"; |
|
100 | 102 |
} |
101 | 103 |
|
102 | 104 |
if($_GET['act']=="edit"){ |
... | ... | |
133 | 135 |
} else |
134 | 136 |
$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']); |
135 | 137 |
$pconfig['crypto'] = $a_server[$id]['crypto']; |
138 |
// OpenVPN Defaults to SHA1 if unset |
|
139 |
$pconfig['digest'] = !empty($a_server[$id]['digest']) ? $a_server[$id]['digest'] : "SHA1"; |
|
136 | 140 |
$pconfig['engine'] = $a_server[$id]['engine']; |
137 | 141 |
|
138 | 142 |
$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network']; |
... | ... | |
381 | 385 |
$server['shared_key'] = base64_encode($pconfig['shared_key']); |
382 | 386 |
} |
383 | 387 |
$server['crypto'] = $pconfig['crypto']; |
388 |
$server['digest'] = $pconfig['digest']; |
|
384 | 389 |
$server['engine'] = $pconfig['engine']; |
385 | 390 |
|
386 | 391 |
$server['tunnel_network'] = $pconfig['tunnel_network']; |
... | ... | |
1060 | 1065 |
</select> |
1061 | 1066 |
</td> |
1062 | 1067 |
</tr> |
1068 |
<tr> |
|
1069 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Auth Digest Algorithm"); ?></td> |
|
1070 |
<td width="78%" class="vtable"> |
|
1071 |
<select name="digest" class="formselect"> |
|
1072 |
<?php |
|
1073 |
$digestlist = openvpn_get_digestlist(); |
|
1074 |
foreach ($digestlist as $name => $desc): |
|
1075 |
$selected = ''; |
|
1076 |
if ($name == $pconfig['digest']) |
|
1077 |
$selected = ' selected'; |
|
1078 |
?> |
|
1079 |
<option value="<?=$name;?>"<?=$selected?>> |
|
1080 |
<?=htmlspecialchars($desc);?> |
|
1081 |
</option> |
|
1082 |
<?php endforeach; ?> |
|
1083 |
</select> |
|
1084 |
</td> |
|
1085 |
</tr> |
|
1063 | 1086 |
<tr id="engine"> |
1064 | 1087 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td> |
1065 | 1088 |
<td width="78%" class="vtable"> |
Also available in: Unified diff
Add an Authentication Digest Algorithm drop-down to OpenVPN server/client (SHA1 is the default since that is OpenVPN's default)