Fix #24
This commit is contained in:
@@ -64,6 +64,33 @@ function ipv6_compressed($ip) {
|
|||||||
return $output[0];
|
return $output[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readAutoConf($file) {
|
||||||
|
$json = file_get_contents($file);
|
||||||
|
$config = json_decode($json, true);
|
||||||
|
|
||||||
|
if(!empty($config['crt_server_ca'])) {
|
||||||
|
$config['crt_server_ca'] = str_replace('|', "\n", $config['crt_server_ca']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($config['crt_client'])) {
|
||||||
|
$config['crt_client'] = str_replace('|', "\n", $config['crt_client']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($config['crt_client_key'])) {
|
||||||
|
$config['crt_client_key'] = str_replace('|', "\n", $config['crt_client_key']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($config['crt_client_ta'])) {
|
||||||
|
$config['crt_client_ta'] = str_replace('|', "\n", $config['crt_client_ta']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($config['openvpn_add'])) {
|
||||||
|
$config['openvpn_add'] = str_replace('|', "\n", $config['openvpn_add']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch('/', function() {
|
dispatch('/', function() {
|
||||||
$ip6_net = ynh_setting_get('ip6_net');
|
$ip6_net = ynh_setting_get('ip6_net');
|
||||||
$ip6_net = ($ip6_net == 'none') ? '' : $ip6_net;
|
$ip6_net = ($ip6_net == 'none') ? '' : $ip6_net;
|
||||||
@@ -89,47 +116,56 @@ dispatch('/', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dispatch_put('/settings', function() {
|
dispatch_put('/settings', function() {
|
||||||
$crt_client_exists = file_exists('/etc/openvpn/keys/user.crt');
|
|
||||||
$crt_client_key_exists = file_exists('/etc/openvpn/keys/user.key');
|
|
||||||
$crt_server_ca_exists = file_exists('/etc/openvpn/keys/ca-server.crt');
|
|
||||||
|
|
||||||
$service_enabled = isset($_POST['service_enabled']) ? 1 : 0;
|
$service_enabled = isset($_POST['service_enabled']) ? 1 : 0;
|
||||||
$ip6_net = empty($_POST['ip6_net']) ? 'none' : $_POST['ip6_net'];
|
|
||||||
$ip6_addr = 'none';
|
|
||||||
|
|
||||||
if($service_enabled == 1) {
|
if($service_enabled == 1) {
|
||||||
|
$crt_client_exists = file_exists('/etc/openvpn/keys/user.crt');
|
||||||
|
$crt_client_key_exists = file_exists('/etc/openvpn/keys/user.key');
|
||||||
|
$crt_server_ca_exists = file_exists('/etc/openvpn/keys/ca-server.crt');
|
||||||
|
|
||||||
|
$config = $_POST;
|
||||||
|
$autoconf = false;
|
||||||
|
|
||||||
|
if($_FILES['cubefile']['error'] == UPLOAD_ERR_OK) {
|
||||||
|
$config = readAutoConf($_FILES['cubefile']['tmp_name']);
|
||||||
|
$autoconf = true;
|
||||||
|
}
|
||||||
|
$ip6_net = empty($config['ip6_net']) ? 'none' : $config['ip6_net'];
|
||||||
|
$ip6_addr = 'none';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(empty($_POST['server_name']) || empty($_POST['server_port']) || empty($_POST['server_proto'])) {
|
if(empty($config['server_name']) || empty($config['server_port']) || empty($config['server_proto'])) {
|
||||||
throw new Exception(_('The Server Address, the Server Port and the Protocol cannot be empty'));
|
throw new Exception(_('The Server Address, the Server Port and the Protocol cannot be empty'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!preg_match('/^\d+$/', $_POST['server_port'])) {
|
if(!preg_match('/^\d+$/', $config['server_port'])) {
|
||||||
throw new Exception(_('The Server Port must be only composed of digits'));
|
throw new Exception(_('The Server Port must be only composed of digits'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['server_proto'] != 'udp' && $_POST['server_proto'] != 'tcp') {
|
if($config['server_proto'] != 'udp' && $config['server_proto'] != 'tcp') {
|
||||||
throw new Exception(_('The Protocol must be "udp" or "tcp"'));
|
throw new Exception(_('The Protocol must be "udp" or "tcp"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($_POST['dns0']) || empty($_POST['dns1'])) {
|
if(empty($config['dns0']) || empty($config['dns1'])) {
|
||||||
throw new Exception(_('You need to define two DNS resolver addresses'));
|
throw new Exception(_('You need to define two DNS resolver addresses'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($_FILES['crt_client']['error'] == UPLOAD_ERR_OK && $_FILES['crt_client_key']['error'] != UPLOAD_ERR_OK && (!$crt_client_key_exists || $_POST['crt_client_key_delete'] == 1))
|
if(empty($config['login_user']) xor empty($config['login_passphrase'])) {
|
||||||
|| ($_FILES['crt_client_key']['error'] == UPLOAD_ERR_OK && $_FILES['crt_client']['error'] != UPLOAD_ERR_OK && (!$crt_client_exists || $_POST['crt_client_delete'] == 1))) {
|
throw new Exception(_('A Password is needed when you suggest a Username, or vice versa'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if((!$autoconf && (($_FILES['crt_client']['error'] == UPLOAD_ERR_OK && $_FILES['crt_client_key']['error'] != UPLOAD_ERR_OK && (!$crt_client_key_exists || $_POST['crt_client_key_delete'] == 1))
|
||||||
|
|| ($_FILES['crt_client_key']['error'] == UPLOAD_ERR_OK && $_FILES['crt_client']['error'] != UPLOAD_ERR_OK && (!$crt_client_exists || $_POST['crt_client_delete'] == 1))))
|
||||||
|
|| ($autoconf && (empty($config['crt_client']) xor empty($config['crt_client_key'])))) {
|
||||||
|
|
||||||
throw new Exception(_('A Client Certificate is needed when you suggest a Key, or vice versa'));
|
throw new Exception(_('A Client Certificate is needed when you suggest a Key, or vice versa'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($_POST['login_user']) xor empty($_POST['login_passphrase'])) {
|
if((!$autoconf && $_FILES['crt_server_ca']['error'] != UPLOAD_ERR_OK && !$crt_server_ca_exists) || ($autoconf && empty($config['crt_server_ca']))) {
|
||||||
throw new Exception(_('A Password is needed when you suggest a Username, or vice versa'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_FILES['crt_server_ca']['error'] != UPLOAD_ERR_OK && !$crt_server_ca_exists) {
|
|
||||||
throw new Exception(_('You need a Server CA.'));
|
throw new Exception(_('You need a Server CA.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($_FILES['crt_client_key']['error'] != UPLOAD_ERR_OK && (!$crt_client_key_exists || $_POST['crt_client_key_delete'] == 1)) && empty($_POST['login_user'])) {
|
if(((!$autoconf && $_FILES['crt_client_key']['error'] != UPLOAD_ERR_OK && (!$crt_client_key_exists || $_POST['crt_client_key_delete'] == 1)) || ($autoconf && empty($config['crt_client_key']))) && empty($config['login_user'])) {
|
||||||
throw new Exception(_('You need either a Client Certificate, either a Username, or both'));
|
throw new Exception(_('You need either a Client Certificate, either a Username, or both'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,42 +194,87 @@ dispatch_put('/settings', function() {
|
|||||||
ynh_setting_set('service_enabled', $service_enabled);
|
ynh_setting_set('service_enabled', $service_enabled);
|
||||||
|
|
||||||
if($service_enabled == 1) {
|
if($service_enabled == 1) {
|
||||||
ynh_setting_set('server_name', $_POST['server_name']);
|
ynh_setting_set('server_name', $config['server_name']);
|
||||||
ynh_setting_set('server_port', $_POST['server_port']);
|
ynh_setting_set('server_port', $config['server_port']);
|
||||||
ynh_setting_set('server_proto', $_POST['server_proto']);
|
ynh_setting_set('server_proto', $config['server_proto']);
|
||||||
ynh_setting_set('dns0', $_POST['dns0']);
|
ynh_setting_set('dns0', $config['dns0']);
|
||||||
ynh_setting_set('dns1', $_POST['dns1']);
|
ynh_setting_set('dns1', $config['dns1']);
|
||||||
ynh_setting_set('login_user', $_POST['login_user']);
|
ynh_setting_set('login_user', $config['login_user']);
|
||||||
ynh_setting_set('login_passphrase', $_POST['login_passphrase']);
|
ynh_setting_set('login_passphrase', $config['login_passphrase']);
|
||||||
ynh_setting_set('ip6_net', $ip6_net);
|
ynh_setting_set('ip6_net', $ip6_net);
|
||||||
ynh_setting_set('ip6_addr', $ip6_addr);
|
ynh_setting_set('ip6_addr', $ip6_addr);
|
||||||
|
|
||||||
file_put_contents('/etc/openvpn/client.conf.tpl', $_POST['raw_openvpn']);
|
if($autoconf) {
|
||||||
|
if(!empty($config['openvpn_add'])) {
|
||||||
|
copy('/etc/openvpn/client.conf.tpl.restore', '/etc/openvpn/client.conf.tpl');
|
||||||
|
|
||||||
if($_FILES['crt_client']['error'] == UPLOAD_ERR_OK) {
|
$raw_openvpn = file_get_contents('/etc/openvpn/client.conf.tpl');
|
||||||
move_uploaded_file($_FILES['crt_client']['tmp_name'], '/etc/openvpn/keys/user.crt');
|
$raw_openvpn .= "\n# Custom\n".$config['openvpn_add'];
|
||||||
} elseif($_POST['crt_client_delete'] == 1) {
|
|
||||||
unlink('/etc/openvpn/keys/user.crt');
|
file_put_contents('/etc/openvpn/client.conf.tpl', $raw_openvpn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($config['crt_client'])) {
|
||||||
|
if(file_exists('/etc/openvpn/keys/user.crt')) {
|
||||||
|
unlink('/etc/openvpn/keys/user.crt');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file_put_contents('/etc/openvpn/keys/user.crt', $config['crt_client']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($config['crt_client_key'])) {
|
||||||
|
if(file_exists('/etc/openvpn/keys/user.key')) {
|
||||||
|
unlink('/etc/openvpn/keys/user.key');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file_put_contents('/etc/openvpn/keys/user.key', $config['crt_client_key']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($config['crt_client_ta'])) {
|
||||||
|
if(file_exists('/etc/openvpn/keys/user_ta.key')) {
|
||||||
|
unlink('/etc/openvpn/keys/user_ta.key');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file_put_contents('/etc/openvpn/keys/user_ta.key', $config['crt_client_ta']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($config['crt_server_ca'])) {
|
||||||
|
if(file_exists('/etc/openvpn/keys/ca-server.crt')) {
|
||||||
|
unlink('/etc/openvpn/keys/ca-server.crt');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file_put_contents('/etc/openvpn/keys/ca-server.crt', $config['crt_server_ca']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
file_put_contents('/etc/openvpn/client.conf.tpl', $_POST['raw_openvpn']);
|
||||||
|
|
||||||
|
if($_FILES['crt_client']['error'] == UPLOAD_ERR_OK) {
|
||||||
|
move_uploaded_file($_FILES['crt_client']['tmp_name'], '/etc/openvpn/keys/user.crt');
|
||||||
|
} elseif($_POST['crt_client_delete'] == 1) {
|
||||||
|
unlink('/etc/openvpn/keys/user.crt');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_FILES['crt_client_key']['error'] == UPLOAD_ERR_OK) {
|
||||||
|
move_uploaded_file($_FILES['crt_client_key']['tmp_name'], '/etc/openvpn/keys/user.key');
|
||||||
|
} elseif($_POST['crt_client_key_delete'] == 1) {
|
||||||
|
unlink('/etc/openvpn/keys/user.key');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_FILES['crt_client_ta']['error'] == UPLOAD_ERR_OK) {
|
||||||
|
move_uploaded_file($_FILES['crt_client_ta']['tmp_name'], '/etc/openvpn/keys/user_ta.key');
|
||||||
|
} elseif($_POST['crt_client_ta_delete'] == 1) {
|
||||||
|
unlink('/etc/openvpn/keys/user_ta.key');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_FILES['crt_server_ca']['error'] == UPLOAD_ERR_OK) {
|
||||||
|
move_uploaded_file($_FILES['crt_server_ca']['tmp_name'], '/etc/openvpn/keys/ca-server.crt');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_FILES['crt_client_key']['error'] == UPLOAD_ERR_OK) {
|
if(!empty($config['login_user'])) {
|
||||||
move_uploaded_file($_FILES['crt_client_key']['tmp_name'], '/etc/openvpn/keys/user.key');
|
file_put_contents('/etc/openvpn/keys/credentials', "${config['login_user']}\n${config['login_passphrase']}");
|
||||||
} elseif($_POST['crt_client_key_delete'] == 1) {
|
|
||||||
unlink('/etc/openvpn/keys/user.key');
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_FILES['crt_client_ta']['error'] == UPLOAD_ERR_OK) {
|
|
||||||
move_uploaded_file($_FILES['crt_client_ta']['tmp_name'], '/etc/openvpn/keys/user_ta.key');
|
|
||||||
} elseif($_POST['crt_client_ta_delete'] == 1) {
|
|
||||||
unlink('/etc/openvpn/keys/user_ta.key');
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_FILES['crt_server_ca']['error'] == UPLOAD_ERR_OK) {
|
|
||||||
move_uploaded_file($_FILES['crt_server_ca']['tmp_name'], '/etc/openvpn/keys/ca-server.crt');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($_POST['login_user'])) {
|
|
||||||
file_put_contents('/etc/openvpn/keys/credentials', "${_POST['login_user']}\n${_POST['login_passphrase']}");
|
|
||||||
} else {
|
} else {
|
||||||
file_put_contents('/etc/openvpn/keys/credentials', '');
|
file_put_contents('/etc/openvpn/keys/credentials', '');
|
||||||
}
|
}
|
||||||
|
@@ -96,3 +96,12 @@ textarea#raw_openvpn {
|
|||||||
height: 300px;
|
height: 300px;
|
||||||
border: 1px solid #D9534F;
|
border: 1px solid #D9534F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.nav {
|
||||||
|
margin-top: 30px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.nav a {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
@@ -16,11 +16,24 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function tabsClick() {
|
||||||
|
var tab = $(this).parent().attr('data-tab');
|
||||||
|
|
||||||
|
$('.nav').find('li.active').removeClass('active');
|
||||||
|
$(this).parent().addClass('active');
|
||||||
|
|
||||||
|
$('.tabs').hide();
|
||||||
|
$('.tab' + tab).show();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.btn-group').button();
|
$('.btn-group').button();
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
||||||
$('.switch').bootstrapToggle();
|
$('.switch').bootstrapToggle();
|
||||||
|
$('.nav-tabs a').click(tabsClick);
|
||||||
|
|
||||||
$('.fileinput').click(function() {
|
$('.fileinput').click(function() {
|
||||||
if(!$(this).hasClass('btn-danger')) {
|
if(!$(this).hasClass('btn-danger')) {
|
||||||
|
@@ -55,167 +55,193 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-default enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
|
<ul class="nav nav-tabs nav-justified enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
|
||||||
<div class="panel-heading">
|
<li role="presentation" data-tab="manualconfig" class="active"><a href="#"><?= _("Manual") ?></a></li>
|
||||||
<h3 class="panel-title"><?= _("VPN") ?></h3>
|
<li role="presentation" data-tab="autoconfig"><a href="#"><?= _("Automatic") ?></a></li>
|
||||||
</div>
|
</ul>
|
||||||
|
|
||||||
<div style="padding: 14px 14px 0 10px">
|
<div class="tabs tabmanualconfig enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
|
||||||
<div class="form-group">
|
<div class="panel panel-default">
|
||||||
<label for="server_name" class="col-sm-3 control-label"><?= _('Server Address') ?></label>
|
<div class="panel-heading">
|
||||||
<div class="col-sm-9">
|
<h3 class="panel-title"><?= _("VPN") ?></h3>
|
||||||
<input type="text" class="form-control" name="server_name" id="server_name" placeholder="access.ldn-fai.net" value="<?= $server_name ?>" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div style="padding: 14px 14px 0 10px">
|
||||||
<label for="server_port" class="col-sm-3 control-label"><?= _('Server Port') ?></label>
|
<div class="form-group">
|
||||||
<div class="col-sm-9">
|
<label for="server_name" class="col-sm-3 control-label"><?= _('Server Address') ?></label>
|
||||||
<input type="text" data-toggle="tooltip" data-title="<?= _('With restricted access, you should use 443 (TCP) or 53 (UDP)') ?>" class="form-control" name="server_port" id="server_port" placeholder="1194" value="<?= $server_port ?>" />
|
<div class="col-sm-9">
|
||||||
</div>
|
<input type="text" class="form-control" name="server_name" id="server_name" placeholder="access.ldn-fai.net" value="<?= $server_name ?>" />
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="server_proto" class="col-sm-3 control-label"><?= _('Protocol') ?></label>
|
|
||||||
<div class="btn-group col-sm-9" data-toggle="buttons">
|
|
||||||
<label class="btn btn-default <?= $server_proto == 'udp' ? 'active' : '' ?>">
|
|
||||||
<input type="radio" name="server_proto" value="udp" <?= $server_proto == 'udp' ? 'checked="cheked"' : '' ?> /> <?= _('UDP') ?>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label class="btn btn-default <?= $server_proto == 'tcp' ? 'active' : '' ?>" data-toggle="tooltip" data-title="<?= _('UDP is more efficient than TCP (but more filtered in case of restrictive access)') ?>">
|
|
||||||
<input type="radio" name="server_proto" value="tcp" <?= $server_proto == 'tcp' ? 'checked="cheked"' : '' ?> /> <?= _('TCP') ?>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="ip6_net" class="col-sm-3 control-label"><?= _('Delegated prefix (IPv6)') ?></label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input type="text" data-toggle="tooltip" data-title="<?= _('Leave empty if your Internet Service Provider does not give you a delegated prefix') ?>" class="form-control" name="ip6_net" id="ip6_net" placeholder="2001:db8:42::" value="<?= $ip6_net ?>" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group" id="raw_openvpn_btnpanel">
|
|
||||||
<label class="col-sm-3 control-label"></label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<span class="glyphicon glyphicon-cog"></span> <a href="#" id="raw_openvpn_btn" data-toggle="tooltip" data-title="<?= _('Edit the raw configuration only if you know what you do!') ?>"><?= _('Advanced') ?></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group" id="raw_openvpn_panel">
|
|
||||||
<label for="raw_openvpn" class="col-sm-3 control-label"><?= _('Advanced') ?></label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<pre><textarea class="form-control" name="raw_openvpn" id="raw_openvpn"><?= $raw_openvpn ?></textarea></pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if(!$crt_client_key_exists && empty($login_user)): ?>
|
|
||||||
<div class="alert alert-dismissible alert-warning fade in enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?> style="margin: 2px 0px 17px" role="alert">
|
|
||||||
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
|
||||||
<strong><?= _('Notice') ?>:</strong> <?= _("You need to upload a Client Certificate, or define a Username (or both) for starting your VPN Client.") ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="panel panel-default enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title"><?= _("Authentication") ?></h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="padding: 14px 14px 0 10px">
|
|
||||||
<div class="form-group">
|
|
||||||
<?php if(!$crt_server_ca_exists): ?>
|
|
||||||
<div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 16px 17px" role="alert">
|
|
||||||
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
|
||||||
<strong><?= _('Notice') ?>:</strong> <?= _("You need to upload a Server CA for starting your VPN Client.") ?>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
|
|
||||||
<label for="crt_server_ca" class="col-sm-3 control-label"><?= $crt_server_ca_exists ? _('Update Server CA') : _('Upload Server CA') ?></label>
|
<div class="form-group">
|
||||||
<div class="input-group col-sm-9" style="padding: 0 15px">
|
<label for="server_port" class="col-sm-3 control-label"><?= _('Server Port') ?></label>
|
||||||
<?php if($crt_server_ca_exists): ?>
|
<div class="col-sm-9">
|
||||||
<a class="btn btn-danger not-allowed btn-disabled input-group-addon" id="crt_server_ca_deletebtn" data-toggle="tooltip" data-title="<?= _('You cannot have no server CA') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
<input type="text" data-toggle="tooltip" data-title="<?= _('With restricted access, you should use 443 (TCP) or 53 (UDP)') ?>" class="form-control" name="server_port" id="server_port" placeholder="1194" value="<?= $server_port ?>" />
|
||||||
<input id="crt_server_ca_delete" name="crt_server_ca_delete" type="checkbox" value="1" style="display: none" />
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="server_proto" class="col-sm-3 control-label"><?= _('Protocol') ?></label>
|
||||||
|
<div class="btn-group col-sm-9" data-toggle="buttons">
|
||||||
|
<label class="btn btn-default <?= $server_proto == 'udp' ? 'active' : '' ?>">
|
||||||
|
<input type="radio" name="server_proto" value="udp" <?= $server_proto == 'udp' ? 'checked="cheked"' : '' ?> /> <?= _('UDP') ?>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-default <?= $server_proto == 'tcp' ? 'active' : '' ?>" data-toggle="tooltip" data-title="<?= _('UDP is more efficient than TCP (but more filtered in case of restrictive access)') ?>">
|
||||||
|
<input type="radio" name="server_proto" value="tcp" <?= $server_proto == 'tcp' ? 'checked="cheked"' : '' ?> /> <?= _('TCP') ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="ip6_net" class="col-sm-3 control-label"><?= _('Delegated prefix (IPv6)') ?></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" data-toggle="tooltip" data-title="<?= _('Leave empty if your Internet Service Provider does not give you a delegated prefix') ?>" class="form-control" name="ip6_net" id="ip6_net" placeholder="2001:db8:42::" value="<?= $ip6_net ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" id="raw_openvpn_btnpanel">
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<span class="glyphicon glyphicon-cog"></span> <a href="javascript:" id="raw_openvpn_btn" data-toggle="tooltip" data-title="<?= _('Edit the raw configuration only if you know what you do!') ?>"><?= _('Advanced') ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" id="raw_openvpn_panel">
|
||||||
|
<label for="raw_openvpn" class="col-sm-3 control-label"><?= _('Advanced') ?></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<pre><textarea class="form-control" name="raw_openvpn" id="raw_openvpn"><?= $raw_openvpn ?></textarea></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if(!$crt_client_key_exists && empty($login_user)): ?>
|
||||||
|
<div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 0px 17px" role="alert">
|
||||||
|
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||||
|
<strong><?= _('Notice') ?>:</strong> <?= _("You need to upload a Client Certificate, or define a Username (or both) for starting your VPN Client.") ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title"><?= _("Authentication") ?></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="padding: 14px 14px 0 10px">
|
||||||
|
<div class="form-group">
|
||||||
|
<?php if(!$crt_server_ca_exists): ?>
|
||||||
|
<div class="alert alert-dismissible alert-warning fade in" style="margin: 2px 16px 17px" role="alert">
|
||||||
|
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||||
|
<strong><?= _('Notice') ?>:</strong> <?= _("You need to upload a Server CA for starting your VPN Client.") ?>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<input type="text" class="form-control fileinput" id="crt_server_ca_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
|
|
||||||
<input id="crt_server_ca" name="crt_server_ca" type="file" style="display: none" />
|
<label for="crt_server_ca" class="col-sm-3 control-label"><?= $crt_server_ca_exists ? _('Update Server CA') : _('Upload Server CA') ?></label>
|
||||||
<a class="btn input-group-addon fileinput" id="crt_server_ca_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
|
<div class="input-group col-sm-9" style="padding: 0 15px">
|
||||||
|
<?php if($crt_server_ca_exists): ?>
|
||||||
|
<a class="btn btn-danger not-allowed btn-disabled input-group-addon" id="crt_server_ca_deletebtn" data-toggle="tooltip" data-title="<?= _('You cannot have no server CA') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
||||||
|
<input id="crt_server_ca_delete" name="crt_server_ca_delete" type="checkbox" value="1" style="display: none" />
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="text" class="form-control fileinput" id="crt_server_ca_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
|
||||||
|
<input id="crt_server_ca" name="crt_server_ca" type="file" style="display: none" />
|
||||||
|
<a class="btn input-group-addon fileinput" id="crt_server_ca_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="crt_client" class="col-sm-3 control-label"><?= $crt_client_exists ? _('Update Client Cert.') : _('Upload Client Cert.') ?></label>
|
||||||
|
<div class="input-group col-sm-9" style="padding: 0 15px">
|
||||||
|
<?php if($crt_client_exists): ?>
|
||||||
|
<a class="btn btn-danger input-group-addon deletefile" id="crt_client_deletebtn" data-toggle="tooltip" data-title="<?= _('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
||||||
|
<input id="crt_client_delete" name="crt_client_delete" type="checkbox" value="1" style="display: none" />
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="text" class="form-control fileinput" id="crt_client_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
|
||||||
|
<input id="crt_client" name="crt_client" type="file" style="display: none" />
|
||||||
|
<a class="btn input-group-addon fileinput" id="crt_client_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="crt_client_key" class="col-sm-3 control-label"><?= $crt_client_key_exists ? _('Update Client Key') : _('Upload Client Key') ?></label>
|
||||||
|
<div class="input-group col-sm-9" style="padding: 0 15px">
|
||||||
|
<?php if($crt_client_key_exists): ?>
|
||||||
|
<a class="btn btn-danger input-group-addon deletefile" id="crt_client_key_deletebtn" data-toggle="tooltip" data-title="<?= _('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
||||||
|
<input id="crt_client_key_delete" name="crt_client_key_delete" type="checkbox" value="1" style="display: none" />
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="text" class="form-control fileinput" id="crt_client_key_choosertxt" data-toggle="tooltip" data-title="<?= _('Make sure your browser is able to read the key file before uploading') ?>" placeholder="-----BEGIN PRIVATE KEY-----" readonly="readonly" />
|
||||||
|
<input id="crt_client_key" name="crt_client_key" type="file" style="display: none" />
|
||||||
|
<a class="btn input-group-addon fileinput" id="crt_client_key_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?> (<?= _('make sure your browser is able to read the key file before uploading') ?>)"><span class="glyphicon glyphicon-search"></span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="crt_client_ta" class="col-sm-3 control-label"><?= $crt_client_ta_exists ? _('Update Shared-Secret') : _('Upload Shared-Secret') ?></label>
|
||||||
|
<div class="input-group col-sm-9" style="padding: 0 15px">
|
||||||
|
<?php if($crt_client_ta_exists): ?>
|
||||||
|
<a class="btn btn-danger input-group-addon deletefile" id="crt_client_ta_deletebtn" data-toggle="tooltip" data-title="<?= _('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
||||||
|
<input id="crt_client_ta_delete" name="crt_client_ta_delete" type="checkbox" value="1" style="display: none" />
|
||||||
|
<?php endif; ?>
|
||||||
|
<input type="text" class="form-control fileinput" id="crt_client_ta_choosertxt" data-toggle="tooltip" data-title="<?= _('Make sure your browser is able to read the key file before uploading') ?>" placeholder="ta.key" readonly="readonly" />
|
||||||
|
<input id="crt_client_ta" name="crt_client_ta" type="file" style="display: none" />
|
||||||
|
<a class="btn input-group-addon fileinput" id="crt_client_ta_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?> (<?= _('make sure your browser is able to read the key file before uploading') ?>)"><span class="glyphicon glyphicon-search"></span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="login_user" class="col-sm-3 control-label"><?= _('Username') ?></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" data-toggle="tooltip" data-title="<?= _('Leave empty if not necessary') ?>" class="form-control" name="login_user" id="login_user" placeholder="michu" value="<?= $login_user ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="login_passphrase" class="col-sm-3 control-label"><?= _('Password') ?></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" data-toggle="tooltip" data-title="<?= _('Leave empty if not necessary') ?>" class="form-control" name="login_passphrase" id="login_passphrase" placeholder="XVCwSbDkxnqQ" value="<?= $login_passphrase ?>" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="panel panel-default">
|
||||||
<label for="crt_client" class="col-sm-3 control-label"><?= $crt_client_exists ? _('Update Client Cert.') : _('Upload Client Cert.') ?></label>
|
<div class="panel-heading">
|
||||||
<div class="input-group col-sm-9" style="padding: 0 15px">
|
<h3 class="panel-title"><?= _("DNS") ?></h3>
|
||||||
<?php if($crt_client_exists): ?>
|
|
||||||
<a class="btn btn-danger input-group-addon deletefile" id="crt_client_deletebtn" data-toggle="tooltip" data-title="<?= _('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
|
||||||
<input id="crt_client_delete" name="crt_client_delete" type="checkbox" value="1" style="display: none" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<input type="text" class="form-control fileinput" id="crt_client_choosertxt" placeholder="-----BEGIN CERTIFICATE-----" readonly="readonly" />
|
|
||||||
<input id="crt_client" name="crt_client" type="file" style="display: none" />
|
|
||||||
<a class="btn input-group-addon fileinput" id="crt_client_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div style="padding: 14px 14px 0 10px">
|
||||||
<label for="crt_client_key" class="col-sm-3 control-label"><?= $crt_client_key_exists ? _('Update Client Key') : _('Upload Client Key') ?></label>
|
<div class="form-group">
|
||||||
<div class="input-group col-sm-9" style="padding: 0 15px">
|
<label for="dns0" class="col-sm-3 control-label"><?= _('First resolver') ?></label>
|
||||||
<?php if($crt_client_key_exists): ?>
|
<div class="col-sm-9">
|
||||||
<a class="btn btn-danger input-group-addon deletefile" id="crt_client_key_deletebtn" data-toggle="tooltip" data-title="<?= _('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
<input type="text" data-toggle="tooltip" data-title="<?= _('IPv6 or IPv4') ?>" class="form-control" name="dns0" id="dns0" placeholder="89.234.141.66" value="<?= $dns0 ?>" />
|
||||||
<input id="crt_client_key_delete" name="crt_client_key_delete" type="checkbox" value="1" style="display: none" />
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
<input type="text" class="form-control fileinput" id="crt_client_key_choosertxt" data-toggle="tooltip" data-title="<?= _('Make sure your browser is able to read the key file before uploading') ?>" placeholder="-----BEGIN PRIVATE KEY-----" readonly="readonly" />
|
|
||||||
<input id="crt_client_key" name="crt_client_key" type="file" style="display: none" />
|
|
||||||
<a class="btn input-group-addon fileinput" id="crt_client_key_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?> (<?= _('make sure your browser is able to read the key file before uploading') ?>)"><span class="glyphicon glyphicon-search"></span></a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="crt_client_ta" class="col-sm-3 control-label" data-toggle="tooltip" data-title="<?= _('ta.key') ?>"><?= $crt_client_ta_exists ? _('Update Shared-Secret') : _('Upload Shared-Secret') ?></label>
|
<label for="dns1" class="col-sm-3 control-label"><?= _('Second resolver') ?></label>
|
||||||
<div class="input-group col-sm-9" style="padding: 0 15px">
|
<div class="col-sm-9">
|
||||||
<?php if($crt_client_ta_exists): ?>
|
<input type="text" data-toggle="tooltip" data-title="<?= _('IPv6 or IPv4') ?>" class="form-control" name="dns1" id="dns1" placeholder="2001:913::8" value="<?= $dns1 ?>" />
|
||||||
<a class="btn btn-danger input-group-addon deletefile" id="crt_client_ta_deletebtn" data-toggle="tooltip" data-title="<?= _('Delete this certificate') ?>"><span class="glyphicon glyphicon-remove"></span></a>
|
</div>
|
||||||
<input id="crt_client_ta_delete" name="crt_client_ta_delete" type="checkbox" value="1" style="display: none" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<input type="text" class="form-control fileinput" id="crt_client_ta_choosertxt" data-toggle="tooltip" data-title="<?= _('Make sure your browser is able to read the key file before uploading') ?>" placeholder="-----BEGIN PRIVATE KEY-----" readonly="readonly" />
|
|
||||||
<input id="crt_client_ta" name="crt_client_ta" type="file" style="display: none" />
|
|
||||||
<a class="btn input-group-addon fileinput" id="crt_client_ta_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?> (<?= _('make sure your browser is able to read the key file before uploading') ?>)"><span class="glyphicon glyphicon-search"></span></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="login_user" class="col-sm-3 control-label"><?= _('Username') ?></label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input type="text" data-toggle="tooltip" data-title="<?= _('Leave empty if not necessary') ?>" class="form-control" name="login_user" id="login_user" placeholder="michu" value="<?= $login_user ?>" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="login_passphrase" class="col-sm-3 control-label"><?= _('Password') ?></label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input type="text" data-toggle="tooltip" data-title="<?= _('Leave empty if not necessary') ?>" class="form-control" name="login_passphrase" id="login_passphrase" placeholder="XVCwSbDkxnqQ" value="<?= $login_passphrase ?>" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-default enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
|
<div class="tabs tabautoconfig enabled" <?= $service_enabled == 0 ? 'style="display: none"' : '' ?>>
|
||||||
<div class="panel-heading">
|
<div class="panel panel-default">
|
||||||
<h3 class="panel-title"><?= _("DNS") ?></h3>
|
<div class="panel-heading">
|
||||||
</div>
|
<h3 class="panel-title"><?= _("Auto Configuration") ?></h3>
|
||||||
|
|
||||||
<div style="padding: 14px 14px 0 10px">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="dns0" class="col-sm-3 control-label"><?= _('First resolver') ?></label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input type="text" data-toggle="tooltip" data-title="<?= _('IPv6 or IPv4') ?>" class="form-control" name="dns0" id="dns0" placeholder="89.234.141.66" value="<?= $dns0 ?>" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div style="padding: 14px 14px 0 10px">
|
||||||
<label for="dns1" class="col-sm-3 control-label"><?= _('Second resolver') ?></label>
|
<div class="form-group">
|
||||||
<div class="col-sm-9">
|
<label for="cubefile" class="col-sm-3 control-label"><?= _('Upload Config') ?></label>
|
||||||
<input type="text" data-toggle="tooltip" data-title="<?= _('IPv6 or IPv4') ?>" class="form-control" name="dns1" id="dns1" placeholder="2001:913::8" value="<?= $dns1 ?>" />
|
<div class="input-group col-sm-9" style="padding: 0 15px">
|
||||||
|
<input type="text" class="form-control fileinput" id="cubefile_choosertxt" placeholder="config.cube" readonly="readonly" />
|
||||||
|
<input id="cubefile" name="cubefile" type="file" style="display: none" />
|
||||||
|
<a class="btn input-group-addon fileinput" id="cubefile_chooserbtn" data-toggle="tooltip" data-title="<?= _('Browse') ?>"><span class="glyphicon glyphicon-search"></span></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user