conf: Remove un-needed headers
This commit is contained in:
@@ -1,30 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: ynh-vpnclient
|
|
||||||
# Required-Start: $network $remote_fs $syslog yunohost-api
|
|
||||||
# Required-Stop: $network $remote_fs $syslog
|
|
||||||
# Should-Start: ynh-hotspot
|
|
||||||
# Should-Stop: ynh-hotspot
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: Start VPN client.
|
|
||||||
# Description: Start VPN client.
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
# VPN Client app for YunoHost
|
# VPN Client app for YunoHost
|
||||||
# Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
# Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
|
||||||
# Contribute at https://github.com/jvaubourg/vpnclient_ynh
|
# Contribute at https://github.com/jvaubourg/vpnclient_ynh
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Affero General Public License for more details.
|
# GNU Affero General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
@@ -162,7 +151,7 @@ moulinette_get() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${value}"
|
echo "${value}"
|
||||||
}
|
}
|
||||||
|
|
||||||
moulinette_set() {
|
moulinette_set() {
|
||||||
var=${1}
|
var=${1}
|
||||||
@@ -183,49 +172,49 @@ if [ "$1" != restart ]; then
|
|||||||
touch /tmp/.ynh-vpnclient-boot
|
touch /tmp/.ynh-vpnclient-boot
|
||||||
systemctl restart php5-fpm --quiet
|
systemctl restart php5-fpm --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check configuration consistency
|
# Check configuration consistency
|
||||||
|
|
||||||
if [[ ! "${1}" =~ stop ]]; then
|
if [[ ! "${1}" =~ stop ]]; then
|
||||||
exitcode=0
|
exitcode=0
|
||||||
|
|
||||||
if [ ! -e /etc/openvpn/keys/ca-server.crt ]; then
|
if [ ! -e /etc/openvpn/keys/ca-server.crt ]; then
|
||||||
echo "[WARN] You need a CA server (you can add it through the web admin)"
|
echo "[WARN] You need a CA server (you can add it through the web admin)"
|
||||||
exitcode=1
|
exitcode=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
empty=$(find /etc/openvpn/keys/ -empty -name credentials &> /dev/null | wc -l)
|
empty=$(find /etc/openvpn/keys/ -empty -name credentials &> /dev/null | wc -l)
|
||||||
if [ "${empty}" -gt 0 -a ! -e /etc/openvpn/keys/user.key ]; then
|
if [ "${empty}" -gt 0 -a ! -e /etc/openvpn/keys/user.key ]; then
|
||||||
echo "[WARN] You need either a client certificate, either a username, or both (you can add one through the web admin)"
|
echo "[WARN] You need either a client certificate, either a username, or both (you can add one through the web admin)"
|
||||||
exitcode=1
|
exitcode=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "${exitcode}" -ne 0 ] && exit ${exitcode}
|
[ "${exitcode}" -ne 0 ] && exit ${exitcode}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
|
||||||
echo -n "Retrieving Yunohost settings... "
|
echo -n "Retrieving Yunohost settings... "
|
||||||
|
|
||||||
ynh_service_enabled=$(moulinette_get service_enabled)
|
ynh_service_enabled=$(moulinette_get service_enabled)
|
||||||
ynh_server_name=$(moulinette_get server_name)
|
ynh_server_name=$(moulinette_get server_name)
|
||||||
ynh_server_port=$(moulinette_get server_port)
|
ynh_server_port=$(moulinette_get server_port)
|
||||||
ynh_server_proto=$(moulinette_get server_proto)
|
ynh_server_proto=$(moulinette_get server_proto)
|
||||||
ynh_ip6_addr=$(moulinette_get ip6_addr)
|
ynh_ip6_addr=$(moulinette_get ip6_addr)
|
||||||
ynh_login_user=$(moulinette_get login_user)
|
ynh_login_user=$(moulinette_get login_user)
|
||||||
|
|
||||||
old_ip6_gw=$(moulinette_get ip6_gw)
|
old_ip6_gw=$(moulinette_get ip6_gw)
|
||||||
old_wired_device=$(moulinette_get wired_device)
|
old_wired_device=$(moulinette_get wired_device)
|
||||||
old_server_ip6=$(moulinette_get server_ip6)
|
old_server_ip6=$(moulinette_get server_ip6)
|
||||||
|
|
||||||
new_ip6_gw=$(ip -6 route | grep default\ via | awk '{ print $3 }')
|
new_ip6_gw=$(ip -6 route | grep default\ via | awk '{ print $3 }')
|
||||||
new_wired_device=$(ip route | awk '/default via/ { print $NF; }')
|
new_wired_device=$(ip route | awk '/default via/ { print $NF; }')
|
||||||
new_server_ip6=$(host "${ynh_server_name}" | awk '/IPv6/ { print $NF; }')
|
new_server_ip6=$(host "${ynh_server_name}" | awk '/IPv6/ { print $NF; }')
|
||||||
|
|
||||||
if [ -z "${new_server_ip6}" ]; then
|
if [ -z "${new_server_ip6}" ]; then
|
||||||
new_server_ip6=$(host "${ynh_server_name}" 80.67.188.188 | awk '/IPv6/ { print $NF; }')
|
new_server_ip6=$(host "${ynh_server_name}" 80.67.188.188 | awk '/IPv6/ { print $NF; }')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -309,7 +298,7 @@ case "${1}" in
|
|||||||
echo "Unset IPv6 server route"
|
echo "Unset IPv6 server route"
|
||||||
unset_serverip6route "${old_server_ip6}" "${old_ip6_gw}" "${old_wired_device}"
|
unset_serverip6route "${old_server_ip6}" "${old_ip6_gw}" "${old_wired_device}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_openvpn_running; then
|
if is_openvpn_running; then
|
||||||
echo "Stop openvpn"
|
echo "Stop openvpn"
|
||||||
stop_openvpn
|
stop_openvpn
|
||||||
|
@@ -22,6 +22,7 @@ domain=$(sudo yunohost app setting vpnclient domain)
|
|||||||
|
|
||||||
# The End
|
# The End
|
||||||
sudo systemctl stop ynh-vpnclient --quiet
|
sudo systemctl stop ynh-vpnclient --quiet
|
||||||
|
sudo systemctl disable ynh-vpnclient --quiet
|
||||||
sudo yunohost service remove ynh-vpnclient
|
sudo yunohost service remove ynh-vpnclient
|
||||||
sudo rm -f /lib/systemd/system/ynh-vpnclient.service /usr/local/bin/ynh-vpnclient
|
sudo rm -f /lib/systemd/system/ynh-vpnclient.service /usr/local/bin/ynh-vpnclient
|
||||||
sudo rm -f /tmp/.ynh-vpnclient-*
|
sudo rm -f /tmp/.ynh-vpnclient-*
|
||||||
|
Reference in New Issue
Block a user