Commit be9b4a37 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor/cleanup vpn_openvpn_client.php

parent f1f331b9
......@@ -32,10 +32,6 @@ require_once("openvpn.inc");
require_once("services.inc");
require_once("interfaces.inc");
error_reporting(E_ALL);
$pgtitle = array(gettext("OpenVPN"), gettext("Client"));
$shortcut_section = "openvpn";
......@@ -46,28 +42,6 @@ if (!isset($config['openvpn']['openvpn-client'])) {
$a_client = &$config['openvpn']['openvpn-client'];
if (!is_array($config['ca'])) {
$config['ca'] = array();
}
$a_ca =& $config['ca'];
if (!is_array($config['cert'])) {
$config['cert'] = array();
}
$a_cert =& $config['cert'];
if (!isset($config['crl']) || !is_array($config['crl'])) {
$config['crl'] = array();
}
$a_crl =& $config['crl'];
$vpnid = 0;
$act = null;
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
......@@ -153,6 +127,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if ($act == "del") {
// remove client
if (!isset($id) || !isset($a_client[$id])) {
redirectHeader("vpn_openvpn_client.php");
exit;
......@@ -164,6 +139,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config();
$savemsg = gettext("Client successfully deleted")."<br />";
} else {
// update client (after validation)
$pconfig = $_POST;
$input_errors = array();
......@@ -300,7 +276,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} else {
$client['vpnid'] = openvpn_vpnid_next();
}
if ($_POST['disable'] == "yes") {
if (isset($pconfig['disable']) && $pconfig['disable'] == "yes") {
$client['disable'] = true;
}
......@@ -312,8 +288,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($tls_mode) {
$client['caref'] = $pconfig['caref'];
$client['certref'] = $pconfig['certref'];
if ($pconfig['tlsauth_enable']) {
if ($pconfig['autotls_enable']) {
if (!empty($pconfig['tlsauth_enable'])) {
if (!empty($pconfig['autotls_enable'])) {
$pconfig['tls'] = openvpn_create_key();
}
$client['tls'] = base64_encode($pconfig['tls']);
......@@ -353,6 +329,7 @@ $main_buttons = array(
<script type="text/javascript">
//<![CDATA[
$( document ).ready(function() {
// init form (old stuff)
if (document.iform != undefined) {
mode_change();
autokey_change();
......@@ -418,7 +395,7 @@ function dev_mode_change() {
}
function autokey_change() {
if (document.iform.autokey_enable.checked)
if (document.iform.autokey_enable != undefined && document.iform.autokey_enable.checked)
document.getElementById("autokey_opts").style.display="none";
else
document.getElementById("autokey_opts").style.display="";
......@@ -467,9 +444,6 @@ endif; ?>
//]]>
</script>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
......@@ -501,13 +475,13 @@ endif; ?>
?>
<form action="vpn_openvpn_client.php" method="post" name="iform" id="iform">
<div class="table-responsive">
<table class="table table-striped table-sort">
<table class="table table-striped">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
<td colspan="2"><?=gettext("General information"); ?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><a id="help_for_disable" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a><?=gettext("Disabled"); ?></td>
<td width="78%" class="vtable">
<td width="22%"><a id="help_for_disable" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a><?=gettext("Disabled"); ?></td>
<td width="78%">
<input name="disable" type="checkbox" value="yes" <?= !empty($pconfig['disable']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" for="help_for_disable">
<small><?=gettext("Set this option to disable this client without removing it from the list"); ?>.</small>
......@@ -515,8 +489,8 @@ endif; ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server Mode");?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server Mode");?></td>
<td>
<select name="mode" id="mode" class="form-control" onchange="mode_change()">
<?php
$openvpn_client_modes = array(
......@@ -535,8 +509,8 @@ endif; ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Protocol");?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Protocol");?></td>
<td>
<select name='protocol' class="form-control">
<?php
foreach (array("UDP", "UDP6", "TCP", "TCP6") as $prot) :
......@@ -546,35 +520,33 @@ endif; ?>
}
?>
<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
<?php
<?php
endforeach; ?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Device mode");?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Device mode");?></td>
<td>
<select name='dev_mode' class="form-control" onchange="dev_mode_change()">
<?php
foreach ($openvpn_dev_mode as $mode) :
foreach (array("tun", "tap") as $mode) :
$selected = "";
if ($pconfig['dev_mode'] == $mode) {
$selected = "selected=\"selected\"";
}
?>
<option value="<?=$mode;
?>" <?=$selected;
?>><?=$mode;?></option>
<?php
?>
<option value="<?=$mode;?>" <?=$selected;?>><?=$mode;?></option>
<?php
endforeach; ?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Interface"); ?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Interface"); ?></td>
<td>
<select name="interface" class="form-control">
<?php
<?php
$interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) {
......@@ -604,308 +576,205 @@ endif; ?>
$selected = "selected=\"selected\"";
}
?>
<option value="<?=$iface;
?>" <?=$selected;?>>
<?=htmlspecialchars($ifacename);?>
</option>
<?php
<option value="<?=$iface;?>" <?=$selected;?>><?=htmlspecialchars($ifacename);?></option>
<?php
endforeach; ?>
</select> <br />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Local port");?></td>
<td width="78%" class="vtable">
<input name="local_port" type="text" class="form-control unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>" />
<p class="text-muted"><em><small><?=gettext("Set this option if you would like to bind to a specific port. Leave this blank or enter 0 for a random dynamic port."); ?></small></em></p>
<td class="vncell"><a id="help_for_local_port" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Local port");?></td>
<td>
<input name="local_port" type="text" class="form-control unknown" size="5" value="<?=$pconfig['local_port'];?>" />
<div class="hidden" for="help_for_local_port">
<em><small><?=gettext("Set this option if you would like to bind to a specific port. Leave this blank or enter 0 for a random dynamic port."); ?></small></em>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server host or address");?></td>
<td width="78%" class="vtable">
<input name="server_addr" type="text" class="form-control unknown" size="30" value="<?=htmlspecialchars($pconfig['server_addr']);?>" />
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server host or address");?></td>
<td>
<input name="server_addr" type="text" class="form-control unknown" size="30" value="<?=$pconfig['server_addr'];?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server port");?></td>
<td width="78%" class="vtable">
<input name="server_port" type="text" class="form-control unknown" size="5" value="<?=htmlspecialchars($pconfig['server_port']);?>" />
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server port");?></td>
<td>
<input name="server_port" type="text" class="form-control unknown" size="5" value="<?=$pconfig['server_port'];?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Proxy host or address");?></td>
<td width="78%" class="vtable">
<input name="proxy_addr" type="text" class="form-control unknown" size="30" value="<?=htmlspecialchars($pconfig['proxy_addr']);?>" />
<td class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Proxy host or address");?></td>
<td>
<input name="proxy_addr" type="text" class="form-control unknown" size="30" value="<?=$pconfig['proxy_addr'];?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Proxy port");?></td>
<td width="78%" class="vtable">
<input name="proxy_port" type="text" class="form-control unknown" size="5" value="<?=htmlspecialchars($pconfig['proxy_port']);?>" />
<td class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Proxy port");?></td>
<td>
<input name="proxy_port" type="text" class="form-control unknown" size="5" value="<?=$pconfig['proxy_port'];?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Proxy authentication extra options");?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="proxy authentication">
<tr>
<td align="right" width="25%">
<span class="vexpl">
&nbsp;<?=gettext("Authentication method"); ?> :&nbsp;
</span>
</td>
<td>
<select name="proxy_authtype" id="proxy_authtype" class="form-control select" onchange="useproxy_changed()">
<option value="none" <?php if ($pconfig['proxy_authtype'] == "none") {
echo "selected=\"selected\"";
} ?>><?=gettext("none"); ?></option>
<option value="basic" <?php if ($pconfig['proxy_authtype'] == "basic") {
echo "selected=\"selected\"";
} ?>><?=gettext("basic"); ?></option>
<option value="ntlm" <?php if ($pconfig['proxy_authtype'] == "ntlm") {
echo "selected=\"selected\"";
} ?>><?=gettext("ntlm"); ?></option>
</select>
</td>
</tr>
</table>
<br />
<table border="0" cellpadding="2" cellspacing="0" id="proxy_authtype_opts" style="display:none" summary="proxy authentication options">
<tr>
<td align="right" width="25%">
<span class="vexpl">
&nbsp;<?=gettext("Username"); ?> :&nbsp;
</span>
</td>
<td>
<input name="proxy_user" id="proxy_user" class="form-control unknown" size="20" value="<?=htmlspecialchars($pconfig['proxy_user']);?>" />
</td>
</tr>
<tr>
<td align="right" width="25%">
<span class="vexpl">
&nbsp;<?=gettext("Password"); ?> :&nbsp;
</span>
</td>
<td>
<input name="proxy_passwd" id="proxy_passwd" type="password" class="form-control pwd" size="20" value="<?=htmlspecialchars($pconfig['proxy_passwd']);?>" />
</td>
</tr>
</table>
<td class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Proxy authentication extra options");?></td>
<td>
<?=gettext("Authentication method"); ?>
<select name="proxy_authtype" id="proxy_authtype" class="form-control select" onchange="useproxy_changed()">
<option value="none" <?=$pconfig['proxy_authtype'] == "none" ? "selected=\"selected\"" : "" ?> > <?=gettext("none"); ?></option>
<option value="basic" <?=$pconfig['proxy_authtype'] == "basic" ? "selected=\"selected\"" : "" ?> > <?=gettext("basic"); ?></option>
<option value="basic" <?=$pconfig['proxy_authtype'] == "ntlm" ? "selected=\"selected\"" : "" ?> > <?=gettext("ntlm"); ?></option>
</select>
<div style="display:none" id="proxy_authtype_opts">
<div><?=gettext("Username"); ?> <br/></div
<div><input name="proxy_user" id="proxy_user" class="form-control unknown" size="20" value="<?=$pconfig['proxy_user'];?>" /></div>
<div><?=gettext("Password"); ?> </div>
<div><input name="proxy_passwd" id="proxy_passwd" type="password" class="form-control pwd" size="20" value="<?=$pconfig['proxy_passwd'];?>" /></div>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Server host name resolution"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="server host name resolution">
<tr>
<td>
<?php set_checked($pconfig['resolve_retry'], $chk); ?>
<input name="resolve_retry" type="checkbox" value="yes" <?=$chk;?> />
</td>
<td>
<span class="vexpl">
<?=gettext("Infinitely resolve server"); ?>
</span>
</td>
</tr>
</table>
<p class="text-muted"><em><small><?=gettext("Continuously attempt to resolve the server host " .
"name. Useful when communicating with a server " .
"that is not permanently connected to the Internet"); ?>.</small></em></p>
<td class="vncell"><a id="help_for_resolve_retry" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Server host name resolution"); ?></td>
<td>
<input name="resolve_retry" type="checkbox" value="yes" <?= !empty($pconfig['resolve_retry']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" for="help_for_resolve_retry">
<div><?=gettext("Infinitely resolve server"); ?></div>
<div><small><?=gettext("Continuously attempt to resolve the server host name. Useful when communicating with a server that is not permanently connected to the Internet"); ?></small></div>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Description"); ?></td>
<td width="78%" class="vtable">
<input name="description" type="text" class="form-control unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>" />
<p class="text-muted"><em><small><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</small></em></p>
<td class="vncell"><a id="help_for_description" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Description"); ?></td>
<td>
<input name="description" type="text" class="form-control unknown" size="30" value="<?=$pconfig['description'];?>" />
<div class="hidden" for="help_for_description">
<small><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</small>
</div>
</td>
</tr>
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("User Authentication Settings"); ?></td>
<td colspan="2"><?=gettext("User Authentication Settings"); ?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("User name/pass"); ?></td>
<td width="78%" class="vtable">
<?=gettext("Leave empty when no user name and password are needed."); ?>
<td class="vncell"><a id="help_for_auth_user_pass" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("User name/pass"); ?></td>
<td>
<div><?=gettext("Username"); ?></div>
<div><input name="auth_user" id="auth_user" class="form-control unknown" size="20" value="<?=htmlspecialchars($pconfig['auth_user']);?>" /></div>
<div><?=gettext("Password"); ?></div>
<div><input name="auth_pass" id="auth_pass" type="password" class="form-control pwd" size="20" value="<?=htmlspecialchars($pconfig['auth_pass']);?>" /></div>
<div class="hidden" for="help_for_auth_user_pass">
<?=gettext("Leave empty when no user name and password are needed."); ?>
</div>
<br/>
<table border="0" cellpadding="2" cellspacing="0" summary="user name password">
<tr>
<td align="right" width="25%">
<span class="vexpl">
&nbsp;<?=gettext("Username"); ?> :&nbsp;
</span>
</td>
<td>
<input name="auth_user" id="auth_user" class="form-control unknown" size="20" value="<?=htmlspecialchars($pconfig['auth_user']);?>" />
</td>
</tr>
<tr>
<td align="right" width="25%">
<span class="vexpl">
&nbsp;<?=gettext("Password"); ?> :&nbsp;
</span>
</td>
<td>
<input name="auth_pass" id="auth_pass" type="password" class="form-control pwd" size="20" value="<?=htmlspecialchars($pconfig['auth_pass']);?>" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Cryptographic Settings"); ?></td>
<td colspan="2"><?=gettext("Cryptographic Settings"); ?></td>
</tr>
<tr id="tls">
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("TLS Authentication"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="tls authentication">
<tr>
<td>
<?php set_checked($pconfig['tlsauth_enable'], $chk); ?>
<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onclick="tlsauth_change()" />
</td>
<td>
<span class="vexpl">
<?=gettext("Enable authentication of TLS packets"); ?>.
</span>
</td>
</tr>
</table>
<?php if (!$pconfig['tls']) :
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("TLS Authentication"); ?></td>
<td>
<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?= !empty($pconfig['tlsauth_enable']) ? "checked=\"checked\"" : "";?> onclick="tlsauth_change()" />
<?=gettext("Enable authentication of TLS packets"); ?>.
<?php if (empty($pconfig['tls'])) :
?>
<table border="0" cellpadding="2" cellspacing="0" id="tlsauth_opts" summary="tls authentication options">
<tr>
<td>
<?php set_checked($pconfig['autotls_enable'], $chk); ?>
<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onclick="autotls_change()" />
</td>
<td>
<span class="vexpl">
<?=gettext("Automatically generate a shared TLS authentication key"); ?>.
</span>
</td>
</tr>
</table>
<div id="tlsauth_opts">
<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes"<?= !empty($pconfig['autotls_enable']) ? "checked=\"checked\"" : "";?> onclick="autotls_change()" />
<?=gettext("Automatically generate a shared TLS authentication key"); ?>.
</div>
<?php
endif; ?>
<table border="0" cellpadding="2" cellspacing="0" id="autotls_opts" summary="tls authentication options">
<tr>
<td>
<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
<div id="autotls_opts">
<textarea name="tls" cols="65" rows="7" class="formpre"><?=isset($pconfig['tls'])?$pconfig['tls']:"";?></textarea>
<p class="text-muted"><em><small><?=gettext("Paste your shared key here"); ?>.</small></em></p>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr id="tls_ca">
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Peer Certificate Authority"); ?></td>
<td width="78%" class="vtable">
<?php if (count($a_ca)) :
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Peer Certificate Authority"); ?></td>
<td>
<?php if (isset($config['ca'])) :
?>
<select name='caref' class="form-control">
<?php
foreach ($a_ca as $ca) :
<?php
foreach ($config['ca'] as $ca) :
$selected = "";
if ($pconfig['caref'] == $ca['refid']) {
if (isset($pconfig['caref']) && $pconfig['caref'] == $ca['refid']) {
$selected = "selected=\"selected\"";
}
?>
<option value="<?=$ca['refid'];
?>" <?=$selected;
?>><?=$ca['descr'];?></option>
<?php
<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
<?php
endforeach; ?>
</select>
<?php
else :
?>
<b>No Certificate Authorities defined.</b> <br />Create one under <a href="system_camanager.php">System: Certificates</a>.
<b><?=gettext("No Certificate Authorities defined.");?></b> <br /><?=gettext("Create one under");?> <a href="system_camanager.php"><?=gettext("System: Certificates");?></a>.
<?php
endif; ?>
</td>
</tr>
<tr id="tls_cert">
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Client Certificate"); ?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Client Certificate"); ?></td>
<td>
<select name='certref' class="form-control">
<?php
foreach ($a_cert as $cert) :
foreach (isset($config['cert']) ? $config['cert'] : array() as $cert) :
$selected = "";
$caname = "";
$inuse = "";
$revoked = "";
$ca = lookup_ca($cert['caref']);
if ($ca) {
$caname = " (CA: {$ca['descr']})";
}
if ($pconfig['certref'] == $cert['refid']) {
if (isset($cert['caref'])) {
$ca = lookup_ca($cert['caref']);
if (!empty($ca)) {
$caname = " (CA: {$ca['descr']})";
}
}
if (isset($pconfig['certref']) && $pconfig['certref'] == $cert['refid']) {
$selected = "selected=\"selected\"";
}
if (cert_in_use($cert['refid'])) {
if (isset($cert['refid']) && cert_in_use($cert['refid'])) {
$inuse = " *In Use";
}
if (is_cert_revoked($cert)) {
$revoked = " *Revoked";
}
?>
<option value="<?=$cert['refid'];
?>" <?=$selected;
?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option>
<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option>
<?php
endforeach; ?>
<option value="" <?PHP if (empty($pconfig['certref'])) {
echo "selected=\"selected\"";
} ?>>None (Username and Password required)</option>
<option value="" <?=empty($pconfig['certref'])? "selected=\"selected\"" : "";?>> <?=gettext("None");?> <?=gettext("(Username and Password required)");?></option>
</select>
<?php if (!count($a_cert)) :
<?php if (!isset($config['cert']) || count($config['cert']) == 0) :
?>
<b>No Certificates defined.</b> <br />Create one under <a href="system_certmanager.php">System: Certificates</a> if one is required for this connection.
<?php
<b><?=gettext("No Certificates defined.");?></b> <br /><?=gettext("Create one under");?> <a href="system_certmanager.php"><?=gettext("System: Certificates");?></a> <?=gettext("if one is required for this connection.");?>
<?php
endif; ?>
</td>
</tr>
<tr id="psk">
<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Key"); ?></td>
<td width="78%" class="vtable">
<?php if (!$pconfig['shared_key']) :
<td><?=gettext("Shared Key"); ?></td>
<td>
<?php if (empty($pconfig['shared_key'])) :
?>
<table border="0" cellpadding="2" cellspacing="0" summary="shared key">
<tr>
<td>
<?php set_checked($pconfig['autokey_enable'], $chk); ?>
<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onclick="autokey_change()" />
</td>
<td>
<span class="vexpl">
<?=gettext("Automatically generate a shared key"); ?>.
</span>
</td>
</tr>
</table>
<input name="autokey_enable" id="autokey_enable" type="checkbox" value="yes" <?= !empty($pconfig['autokey_enable']) ? "checked=\"checked\"" : "";?> onclick="autokey_change()" />
<?=gettext("Automatically generate a shared key"); ?>.
<?php
endif; ?>
<table border="0" cellpadding="2" cellspacing="0" id="autokey_opts" summary="shared key options">
<tr>
<td>
<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
<p class="text-muted"><em><small><?=gettext("Paste your shared key here"); ?>.</small></em></p>
</td>
</tr>
</table>
<div id="autokey_opts">
<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=isset($pconfig['shared_key']) ? $pconfig['shared_key'] : "";?></textarea>
<em><small><?=gettext("Paste your shared key here"); ?>.</small></em>
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Encryption algorithm"); ?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Encryption algorithm"); ?></td>
<td>
<select name="crypto" class="form-control">
<?php
$cipherlist = openvpn_get_cipherlist();
......@@ -915,50 +784,46 @@ endif; ?>
$selected = " selected=\"selected\"";
}
?>
<option value="<?=$name;?>"<?=$selected?>>
<?=htmlspecialchars($desc);?>
</option>
<option value="<?=$name;?>"<?=$selected?>><?=htmlspecialchars($desc);?></option>
<?php
endforeach; ?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Auth Digest Algorithm"); ?></td>
<td width="78%" class="vtable">
<td><a id="help_for_digest" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Auth Digest Algorithm"); ?></td>
<td>
<select name="digest" class="form-control">
<?php
$digestlist = openvpn_get_digestlist();
$digestlist = openvpn_get_digestlist();
foreach ($digestlist as $name => $desc) :
$selected = "";
if ($name == $pconfig['digest']) {
$selected = " selected=\"selected\"";
}
?>
<option value="<?=$name;?>"<?=$selected?>>
<?=htmlspecialchars($desc);?>
</option>
<option value="<?=$name;?>"<?=$selected?>><?=htmlspecialchars($desc);?></option>
<?php
endforeach; ?>
</select>
<p class="text-muted"><em><small><?PHP echo gettext("NOTE: Leave this set to SHA1 unless the server is set to match. SHA1 is the default for OpenVPN."); ?></small></em></p>
<div class="hidden" for="help_for_digest">
<?=gettext("NOTE: Leave this set to SHA1 unless the server is set to match. SHA1 is the default for OpenVPN."); ?>
</div>
</td>
</tr>
<tr id="engine">
<td width="22%" valign="top" class="vncellreq"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Hardware Crypto"); ?></td>
<td width="78%" class="vtable">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Hardware Crypto"); ?></td>
<td>
<select name="engine" class="form-control">
<?php
$engines = openvpn_get_engines();
$engines = openvpn_get_engines();
foreach ($engines as $name => $desc) :
$selected = "";
if ($name == $pconfig['engine']) {
$selected = " selected=\"selected\"";
}
?>
<option value="<?=$name;?>"<?=$selected?>>
<?=htmlspecialchars($desc);?>
</option>
<option value="<?=$name;?>"<?=$selected?>><?=htmlspecialchars($desc);?></option>
<?php
endforeach; ?>
</select>
......@@ -968,73 +833,83 @@ endif; ?>
<td colspan="2" class="list" height="12"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
<td colspan="2"><?=gettext("Tunnel Settings"); ?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("IPv4 Tunnel Network"); ?></td>
<td width="78%" class="vtable">
<input name="tunnel_network" type="text" class="form-control unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>" />
<p class="text-muted"><em><small><?=gettext("This is the virtual network used for private " .
"communications between this client and the " .
"server expressed using CIDR (eg. 10.0.8.0/24). " .
"The first network address is assumed to be the " .
"server address and the second network address " .
"will be assigned to the client virtual " .
"interface"); ?>.</small></em></p>
<td class="vncell"><a id="help_for_tunnel_network" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IPv4 Tunnel Network"); ?></td>
<td>
<input name="tunnel_network" type="text" class="form-control unknown" size="20" value="<?=$pconfig['tunnel_network'];?>" />
<div class="hidden" for="help_for_tunnel_network">
<?=gettext("This is the virtual network used for private " .
"communications between this client and the " .
"server expressed using CIDR (eg. 10.0.8.0/24). " .
"The first network address is assumed to be the " .
"server address and the second network address " .
"will be assigned to the client virtual " .
"interface"); ?>.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("IPv6 Tunnel Network"); ?></td>
<td width="78%" class="vtable">
<input name="tunnel_networkv6" type="text" class="form-control unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_networkv6']);?>" />
<p class="text-muted"><em><small><?=gettext("This is the IPv6 virtual network used for private " .
"communications between this client and the " .
"server expressed using CIDR (eg. fe80::/64). " .
"The first network address is assumed to be the " .
"server address and the second network address " .
"will be assigned to the client virtual " .
"interface"); ?>.</small></em></p>
<td class="vncell"><a id="help_for_tunnel_networkv6" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IPv6 Tunnel Network"); ?></td>
<td>
<input name="tunnel_networkv6" type="text" class="form-control unknown" size="20" value="<?=$pconfig['tunnel_networkv6'];?>" />
<div class="hidden" for="help_for_tunnel_networkv6">
<?=gettext("This is the IPv6 virtual network used for private " .
"communications between this client and the " .
"server expressed using CIDR (eg. fe80::/64). " .
"The first network address is assumed to be the " .
"server address and the second network address " .
"will be assigned to the client virtual " .
"interface"); ?>.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("IPv4 Remote Network/s"); ?></td>
<td width="78%" class="vtable">
<input name="remote_network" type="text" class="form-control unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>" />
<p class="text-muted"><em><small><?=gettext("These are the IPv4 networks that will be routed through " .
<td class="vncell"><a id="help_for_remote_network" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IPv4 Remote Network/s"); ?></td>
<td>
<input name="remote_network" type="text" class="form-control unknown" size="40" value="<?=$pconfig['remote_network'];?>" />
<div class="hidden" for="help_for_remote_network">
<?=gettext("These are the IPv4 networks that will be routed through " .
"the tunnel, so that a site-to-site VPN can be " .
"established without manually changing the routing tables. " .
"Expressed as a comma-separated list of one or more CIDR ranges. " .
"If this is a site-to-site VPN, enter the " .
"remote LAN/s here. You may leave this blank to " .
"only communicate with other clients"); ?>.</small></em></p>
"only communicate with other clients"); ?>.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("IPv6 Remote Network/s"); ?></td>
<td width="78%" class="vtable">
<input name="remote_networkv6" type="text" class="form-control unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>" />
<p class="text-muted"><em><small><?=gettext("These are the IPv6 networks that will be routed through " .
<td class="vncell"><a id="help_for_remote_networkv6" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IPv6 Remote Network/s"); ?></td>
<td>
<input name="remote_networkv6" type="text" class="form-control unknown" size="40" value="<?=$pconfig['remote_networkv6'];?>" />
<div class="hidden" for="help_for_remote_networkv6">
<?=gettext("These are the IPv6 networks that will be routed through " .
"the tunnel, so that a site-to-site VPN can be " .
"established without manually changing the routing tables. " .
"Expressed as a comma-separated list of one or more IP/PREFIX. " .
"If this is a site-to-site VPN, enter the " .
"remote LAN/s here. You may leave this blank to " .
"only communicate with other clients"); ?>.</small></em></p>
"only communicate with other clients"); ?>.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Limit outgoing bandwidth");?></td>
<td width="78%" class="vtable">
<input name="use_shaper" type="text" class="form-control unknown" size="5" value="<?=htmlspecialchars($pconfig['use_shaper']);?>" />
<p class="text-muted"><em><small><?=gettext("Maximum outgoing bandwidth for this tunnel. " .
<td class="vncell"><a id="help_for_use_shaper" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Limit outgoing bandwidth");?></td>
<td>
<input name="use_shaper" type="text" class="form-control unknown" size="5" value="<?=$pconfig['use_shaper'];?>" />
<div class="hidden" for="help_for_use_shaper">
<?=gettext("Maximum outgoing bandwidth for this tunnel. " .
"Leave empty for no limit. The input value has " .
"to be something between 100 bytes/sec and 100 " .
"Mbytes/sec (entered as bytes per second)"); ?>.</small></em></p>
"Mbytes/sec (entered as bytes per second)"); ?>.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Compression"); ?></td>
<td width="78%" class="vtable">
<td class="vncell"><a id="help_for_compression" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Compression"); ?></td>
<td>
<select name="compression" class="form-control">
<?php
foreach ($openvpn_compression_modes as $cmode => $cmodedesc) :
......@@ -1047,112 +922,67 @@ endif; ?>
<?php
endforeach; ?>
</select>
<p class="text-muted"><em><small><?=gettext("Compress tunnel packets using the LZO algorithm. Adaptive compression will dynamically disable compression for a period of time if OpenVPN detects that the data in the packets is not being compressed efficiently."); ?>.</small></em></p>
<div class="hidden" for="help_for_compression">
<?=gettext("Compress tunnel packets using the LZO algorithm. Adaptive compression will dynamically disable compression for a period of time if OpenVPN detects that the data in the packets is not being compressed efficiently."); ?>.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Type-of-Service"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="type-of-service">
<tr>
<td>
<?php set_checked($pconfig['passtos'], $chk); ?>
<input name="passtos" type="checkbox" value="yes" <?=$chk;?> />
</td>
<td>
<span class="vexpl">
<?=gettext("Set the TOS IP header value of tunnel packets to match the encapsulated packet value"); ?>.
</span>
</td>
</tr>
</table>
<td class="vncell"><a id="help_for_passtos" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Type-of-Service"); ?></td>
<td>
<input name="passtos" type="checkbox" value="yes" <?=!empty($pconfig['passtos']) ? "checked=\"checked\"" : "" ;?> />
<div class="hidden" for="help_for_passtos">
<?=gettext("Set the TOS IP header value of tunnel packets to match the encapsulated packet value"); ?>.
</div>
</td>
</tr>
<tr id="chkboxNoTunIPv6">
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Disable IPv6"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="disable-ipv6">
<tr>
<td>
<?php set_checked($pconfig['no_tun_ipv6'], $chk); ?>
<input name="no_tun_ipv6" type="checkbox" value="yes" <?=$chk;?> />
</td>
<td>
<span class="vexpl">
<?=gettext("Don't forward IPv6 traffic"); ?>.
</span>
</td>
</tr>
</table>
<td class="vncell"><a id="help_for_no_tun_ipv6" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable IPv6"); ?></td>
<td>
<input name="no_tun_ipv6" type="checkbox" value="yes" <?=!empty($pconfig['no_tun_ipv6']) ? "checked=\"checked\"" : "" ;?> />
<div class="hidden" for="help_for_no_tun_ipv6">
<?=gettext("Don't forward IPv6 traffic"); ?>.
</div>
</td>
</tr>
<tr id="chkboxRouteNoPull">
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Don't pull routes"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="dont-pull-routes">
<tr>
<td>
<?php set_checked($pconfig['route_no_pull'], $chk); ?>
<input name="route_no_pull" type="checkbox" value="yes" <?=$chk;?> />
</td>
<td>
<span class="vexpl">
<?=gettext("Don't add or remove routes automatically. Instead pass routes to ");
?> <strong>--route-up</strong> <?=gettext("script using environmental variables"); ?>.
</span>
</td>
</tr>
</table>
<td class="vncell"><a id="help_for_route_no_pull" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Don't pull routes"); ?></td>
<td>
<input name="route_no_pull" type="checkbox" value="yes" <?=!empty($pconfig['route_no_pull']) ? "checked=\"checked\"" : "" ;?> />
<div class="hidden" for="help_for_route_no_pull">
<?=gettext("Don't add or remove routes automatically. Instead pass routes to ");?>
<strong>--route-up</strong> <?=gettext("script using environmental variables"); ?>.
</div>
</td>
</tr>
<tr id="chkboxRouteNoExec">
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Don't add/remove routes"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="dont-exec-routes">
<tr>
<td>
<?php set_checked($pconfig['route_no_exec'], $chk); ?>
<input name="route_no_exec" type="checkbox" value="yes" <?=$chk;?> />
</td>
<td>
<span class="vexpl">
<?=gettext("This option effectively bars the server from adding routes to the client's routing table, however note that this option still allows the server to set the TCP/IP properties of the client's TUN/TAP interface"); ?>.
</span>
</td>
</tr>
</table>
<td class="vncell"><a id="help_for_route_no_exec" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Don't add/remove routes"); ?></td>
<td>
<input name="route_no_exec" type="checkbox" value="yes" <?=!empty($pconfig['route_no_exec']) ? "checked=\"checked\"" : "" ;?> />
<div class="hidden" for="help_for_route_no_exec">
<?=gettext("This option effectively bars the server from adding routes to the client's routing table, however note that this option still allows the server to set the TCP/IP properties of the client's TUN/TAP interface"); ?>.
</div>
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts" summary="advance configuration">
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced configuration"); ?></td>
<td colspan="2"><?=gettext("Advanced configuration"); ?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Advanced"); ?></td>
<td width="78%" class="vtable">
<table border="0" cellpadding="2" cellspacing="0" summary="advance configuration">
<tr>
<td>
<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br />
<p class="text-muted"><em><small><?=gettext("Enter any additional options you would like to add to the OpenVPN client configuration here, separated by a semicolon"); ?><br />
<?=gettext("EXAMPLE:"); ?> <strong>remote server.mysite.com 1194;</strong> or <strong>remote 1.2.3.4 1194;</strong></small></em></p>
</td>
</tr>
</table>
<td class="vncell"><a id="help_for_custom_options" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Advanced"); ?></td>
<td>
<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br />
<div class="hidden" for="help_for_custom_options">
<?=gettext("Enter any additional options you would like to add to the OpenVPN client configuration here, separated by a semicolon"); ?><br />
<?=gettext("EXAMPLE:"); ?> <strong>remote server.mysite.com 1194;</strong> or <strong>remote 1.2.3.4 1194;</strong>
</div>
</td>
</tr>
<tr id="comboboxVerbosityLevel">
<td width="22%" valign="top" class="vncell"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Verbosity level");?></td>
<td width="78%" class="vtable">
<td class="vncell"><a id="help_for_verbosity_level" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Verbosity level");?></td>
<td>
<select name="verbosity_level" class="form-control">
<?php
foreach ($openvpn_verbosity_level as $verb_value => $verb_desc) :
......@@ -1167,11 +997,13 @@ endif; ?>
<?php
endforeach; ?>
</select>
<p class="text-muted"><em><small><?=gettext("Each level shows all info from the previous levels. Level 3 is recommended if you want a good summary of what's happening without being swamped by output"); ?>.<br /> <br />
<strong>none</strong> -- <?=gettext("No output except fatal errors"); ?>. <br />
<strong>default</strong>-<strong>4</strong> -- <?=gettext("Normal usage range"); ?>. <br />
<strong>5</strong> -- <?=gettext("Output R and W characters to the console for each packet read and write, uppercase is used for TCP/UDP packets and lowercase is used for TUN/TAP packets"); ?>. <br />
<strong>6</strong>-<strong>11</strong> -- <?=gettext("Debug info range"); ?>.</small></em></p>
<div class="hidden" for="help_for_verbosity_level">
<?=gettext("Each level shows all info from the previous levels. Level 3 is recommended if you want a good summary of what's happening without being swamped by output"); ?>.<br /> <br />
<strong>none</strong> -- <?=gettext("No output except fatal errors"); ?>. <br />
<strong>default</strong>-<strong>4</strong> -- <?=gettext("Normal usage range"); ?>. <br />
<strong>5</strong> -- <?=gettext("Output R and W characters to the console for each packet read and write, uppercase is used for TCP/UDP packets and lowercase is used for TUN/TAP packets"); ?>. <br />
<strong>6</strong>-<strong>11</strong> -- <?=gettext("Debug info range"); ?>.
</div>
</td>
</tr>
......@@ -1180,7 +1012,7 @@ endif; ?>
<br />
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="icons">
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td>&nbsp;</td>
<td width="78%">
<input name="save" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input name="act" type="hidden" value="<?=$act;?>" />
......@@ -1254,24 +1086,4 @@ endif; ?>
</div>
</div>
</section>
<?php include("foot.inc"); ?>
<?php
/* local utility functions */
function set_checked($var, & $chk)
{
if ($var) {
$chk = "checked=\"checked\"";
} else {
$chk = "";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment