PHP interface improvements
This commit is contained in:
parent
b6392cc949
commit
fa356ca245
@ -58,14 +58,26 @@ set_serverip6route() {
|
|||||||
start_openvpn() {
|
start_openvpn() {
|
||||||
ip6_gw=$1
|
ip6_gw=$1
|
||||||
server_ip6=$2
|
server_ip6=$2
|
||||||
proto=udp
|
|
||||||
|
|
||||||
[ ! -z "${ip6_gw}" -a ! -z "${server_ip6}" ] && proto=udp6
|
if [ ! -z "${ip6_gw}" -a ! -z "${server_ip6}" ]; then
|
||||||
|
proto=udp6
|
||||||
|
[ "${ynh_server_proto}" == tcp ] && proto=tcp6-client
|
||||||
|
else
|
||||||
|
proto=udp
|
||||||
|
[ "${ynh_server_proto}" == tcp ] && proto=tcp-client
|
||||||
|
else
|
||||||
|
|
||||||
cp /etc/openvpn/client.conf{.tpl,}
|
cp /etc/openvpn/client.conf{.tpl,}
|
||||||
|
|
||||||
sed "s|<TPL:SERVER_NAME>|${ynh_server_name}|g" -i /etc/openvpn/client.conf
|
sed "s|<TPL:SERVER_NAME>|${ynh_server_name}|g" -i /etc/openvpn/client.conf
|
||||||
sed "s|<TPL:PROTO>|${proto}|" -i /etc/openvpn/client.conf
|
sed "s|<TPL:SERVER_PORT>|${ynh_server_port}|g" -i /etc/openvpn/client.conf
|
||||||
sed 's|^<TPL:UDP_COMMENT>||' -i /etc/openvpn/client.conf
|
sed "s|<TPL:PROTO>|${proto}|g" -i /etc/openvpn/client.conf
|
||||||
|
|
||||||
|
if [ "${proto}" =~ udp ]
|
||||||
|
sed 's|^<TPL:UDP_COMMENT>||' -i /etc/openvpn/client.conf
|
||||||
|
else
|
||||||
|
sed 's|^<TPL:UDP_COMMENT>|;|' -i /etc/openvpn/client.conf
|
||||||
|
fi
|
||||||
|
|
||||||
service openvpn start client
|
service openvpn start client
|
||||||
}
|
}
|
||||||
@ -120,6 +132,8 @@ moulinette_set() {
|
|||||||
echo -n "Retrieving Yunohost settings... "
|
echo -n "Retrieving Yunohost settings... "
|
||||||
|
|
||||||
ynh_server_name=$(moulinette_get server_name)
|
ynh_server_name=$(moulinette_get server_name)
|
||||||
|
ynh_server_port=$(moulinette_get server_port)
|
||||||
|
ynh_server_proto=$(moulinette_get server_proto)
|
||||||
ynh_ip6_addr=$(moulinette_get ip6_addr)
|
ynh_ip6_addr=$(moulinette_get ip6_addr)
|
||||||
|
|
||||||
old_ip6_gw=$(moulinette_get ip6_gw)
|
old_ip6_gw=$(moulinette_get ip6_gw)
|
||||||
@ -183,6 +197,7 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update dynamic settings
|
||||||
moulinette_set server_ip6 "${new_server_ip6}"
|
moulinette_set server_ip6 "${new_server_ip6}"
|
||||||
moulinette_set ip6_gw "${new_ip6_gw}"
|
moulinette_set ip6_gw "${new_ip6_gw}"
|
||||||
moulinette_set wired_device "${new_wired_device}"
|
moulinette_set wired_device "${new_wired_device}"
|
||||||
|
@ -9,6 +9,7 @@ dev tun
|
|||||||
tun-ipv6
|
tun-ipv6
|
||||||
keepalive 10 30
|
keepalive 10 30
|
||||||
comp-lzo adaptive
|
comp-lzo adaptive
|
||||||
|
port <TPL:SERVER_PORT>
|
||||||
|
|
||||||
# UDP only
|
# UDP only
|
||||||
<TPL:UDP_COMMENT>explicit-exit-notify
|
<TPL:UDP_COMMENT>explicit-exit-notify
|
||||||
|
@ -30,8 +30,10 @@ ip6_net=$(sipcalc "${ip6_net}" | grep Compressed | awk '{ print $NF; }')
|
|||||||
ip6_addr=$(echo "$(echo "${ip6_expanded_net}" | cut -d: -f1-7):1")
|
ip6_addr=$(echo "$(echo "${ip6_expanded_net}" | cut -d: -f1-7):1")
|
||||||
ip6_addr=$(sipcalc "${ip6_addr}" | grep Compressed | awk '{ print $NF; }')
|
ip6_addr=$(sipcalc "${ip6_addr}" | grep Compressed | awk '{ print $NF; }')
|
||||||
|
|
||||||
# Save arguments for future upgrades
|
# Save arguments
|
||||||
sudo yunohost app setting vpnclient server_name -v "${server_name}"
|
sudo yunohost app setting vpnclient server_name -v "${server_name}"
|
||||||
|
sudo yunohost app setting vpnclient server_port -v 1194
|
||||||
|
sudo yunohost app setting vpnclient server_proto -v udp
|
||||||
sudo yunohost app setting vpnclient ip6_addr -v "${ip6_addr}"
|
sudo yunohost app setting vpnclient ip6_addr -v "${ip6_addr}"
|
||||||
sudo yunohost app setting vpnclient ip6_net -v "${ip6_net}"
|
sudo yunohost app setting vpnclient ip6_net -v "${ip6_net}"
|
||||||
|
|
||||||
|
5
sources/public/js/custom.js
Normal file
5
sources/public/js/custom.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
$('.btn-group').button();
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
|
@ -13,6 +13,7 @@
|
|||||||
<link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/css/style.css" rel="stylesheet">
|
<link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/css/style.css" rel="stylesheet">
|
||||||
<script src="<?= PUBLIC_DIR ?>/jquery/jquery-2.1.1.min.js"></script>
|
<script src="<?= PUBLIC_DIR ?>/jquery/jquery-2.1.1.min.js"></script>
|
||||||
<script src="<?= PUBLIC_DIR ?>/bootstrap/js/bootstrap.min.js"></script>
|
<script src="<?= PUBLIC_DIR ?>/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
<script src="<?= PUBLIC_DIR ?>/js/custom.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -1,42 +1,55 @@
|
|||||||
<h2><?= T_("Configure your VPN client") ?></h2>
|
<h2><?= T_("VPN Client Configuration") ?></h2>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-offset-2 col-sm-8">
|
<div class="col-sm-offset-2 col-sm-8">
|
||||||
<form method="post" action="settings" class="form-horizontal" role="form">
|
<form method="post" action="settings" class="form-horizontal" role="form">
|
||||||
<input type="hidden" name="_method" value="put" />
|
<input type="hidden" name="_method" value="put" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="host" class="col-sm-3 control-label"><?= T_('Host') ?></label>
|
<label for="server_name" class="col-sm-3 control-label"><?= T_('Server Address') ?></label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input type="text" class="form-control" name="host" id="host" placeholder="vpn.neutrinet.be">
|
<input type="text" class="form-control" name="server_name" id="server_name" placeholder="access.ldn-fai.net">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password" class="col-sm-3 control-label"><?= T_('Password') ?></label>
|
<label for="server_port" class="col-sm-3 control-label"><?= T_('Server Port') ?></label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input type="password" class="form-control" name="password" id="password" placeholder="Password">
|
<input type="text" data-toggle="tooltip" data-title="<?= T_('With restricted access, you should use 443 (TCP) or 53 (UDP)') ?>" class="form-control" name="server_port" id="server_port" placeholder="1194">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="privatekey" class="col-sm-3 control-label"><?= T_('Private key') ?></label>
|
<label for="server_port" class="col-sm-3 control-label"><?= T_('Protocol') ?></label>
|
||||||
<div class="col-sm-9">
|
<div class="btn-group col-sm-9" data-toggle="buttons">
|
||||||
<textarea rows="7" class="form-control" name="privatekey" id="privatekey">
|
<label class="btn btn-default active">
|
||||||
-----BEGIN PRIVATE KEY-----
|
<input type="radio" name="server_proto" value="udp"> <?= T_('UDP') ?>
|
||||||
-----END PRIVATE KEY-----
|
</label>
|
||||||
</textarea>
|
|
||||||
</div>
|
<label class="btn btn-default" data-toggle="tooltip" data-title="<?= T_('UDP is more efficient than TCP (but more filtered in case of restrictive access)') ?>">
|
||||||
|
<input type="radio" name="server_proto" value="tcp"> <?= T_('TCP') ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-xs-offset-3 col-sm-10">
|
<label for="crt_client" class="col-sm-3 control-label"><?= T_('Client Certificate') ?></label>
|
||||||
<div class="checkbox">
|
<div class="btn-group col-sm-9">
|
||||||
<label>
|
<textarea class="form-control" name="crt_client" id="crt_client" placeholder="-----BEGIN CERTIFICATE-----"></textarea>
|
||||||
<input type="checkbox" name="usetcp" value="yes"> <?= T_('Use TCP') ?>
|
</div>
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="crt_client_key" class="col-sm-3 control-label"><?= T_('Client Certificate Key') ?></label>
|
||||||
|
<div class="btn-group col-sm-9">
|
||||||
|
<textarea class="form-control" name="crt_client_key" id="crt_client_key" placeholder="-----BEGIN PRIVATE KEY-----"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="crt_server_ca" class="col-sm-3 control-label"><?= T_('Server Certificate Authority') ?></label>
|
||||||
|
<div class="btn-group col-sm-9">
|
||||||
|
<textarea class="form-control" name="crt_server_ca" id="crt_server_ca" placeholder="-----BEGIN CERTIFICATE-----"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-xs-offset-3 col-sm-9">
|
<div class="col-xs-offset-3 col-sm-9">
|
||||||
<button type="submit" class="btn btn-default"><?= T_('Save settings') ?></button>
|
<button type="submit" class="btn btn-default"><?= T_('Save and reload') ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user