Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c00ff92ef | ||
|
|
8f2ba6cdcd | ||
|
|
2e0fbfddff | ||
|
|
4aa7062213 | ||
|
|
033abdcb69 | ||
|
|
84a4e1a319 | ||
|
|
8b3a04fb90 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
# Created from https://github.com/YunoHost/example_ynh/blob/master/.gitignore
|
||||
*~
|
||||
*.sw[op]
|
||||
13
.travis.yml
13
.travis.yml
@@ -1,13 +0,0 @@
|
||||
language: php
|
||||
before_script:
|
||||
- git clone --depth 1 git://github.com/YunoHost/package_linter ../package_linter && cd ../package_linter
|
||||
- mv ../vpnclient_ynh vpnclient_ynh
|
||||
script:
|
||||
- ./package_linter.py vpnclient_ynh
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
on_success: always
|
||||
on_failure: always
|
||||
channels:
|
||||
- "irc.geeknode.org#labriqueinter.net-dev"
|
||||
@@ -1,5 +1,6 @@
|
||||
# VPN Client
|
||||
[](https://travis-ci.org/labriqueinternet/vpnclient_ynh)
|
||||
# VPN Client [](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [](https://ci-apps.yunohost.org/jenkins/job/vpnclient%20%28Community%29/lastBuild/consoleFull)
|
||||
[](https://install-app.yunohost.org/?app=vpnclient)
|
||||
|
||||
## Overview
|
||||
|
||||
VPN Client app for [YunoHost](http://yunohost.org/).
|
||||
|
||||
@@ -129,6 +129,10 @@ start_openvpn() {
|
||||
[ "${ynh_server_proto}" == tcp ] && proto=tcp-client
|
||||
fi
|
||||
|
||||
# Unset firewall to let DNS and NTP resolution works
|
||||
# Firewall is reset after vpn is mounted (more details on #1016)
|
||||
unset_firewall
|
||||
|
||||
sync_time
|
||||
|
||||
cp /etc/openvpn/client.conf{.tpl,}
|
||||
@@ -200,6 +204,20 @@ stop_openvpn() {
|
||||
sync_time() {
|
||||
systemctl stop ntp
|
||||
timeout 20 ntpd -qg &> /dev/null
|
||||
|
||||
# Some networks drop ntp port (udp 123).
|
||||
# Try to get the date with an http request on the internetcube web site
|
||||
if [ $? -ne 0 ]; then
|
||||
http_date=`curl -sD - labriqueinter.net | grep '^Date:' | cut -d' ' -f3-6`
|
||||
http_date_seconds=`date -d "${http_date}" +%s`
|
||||
curr_date_seconds=`date +%s`
|
||||
|
||||
# Set the new date if it's greater than the current date
|
||||
# So it does if 1970 year or if old fake-hwclock date is used
|
||||
if [ $http_date_seconds -ge $curr_date_seconds ]; then
|
||||
date -s "${http_date}"
|
||||
fi
|
||||
fi
|
||||
systemctl start ntp
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +1,34 @@
|
||||
{
|
||||
"name": "VPN Client",
|
||||
"id": "vpnclient",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "VPN Client",
|
||||
"fr": "Client VPN"
|
||||
},
|
||||
"license": "AGPL-3",
|
||||
"url": "https://github.com/labriqueinternet/vpnclient_ynh",
|
||||
"version": "1.0.1",
|
||||
"license": "AGPL-3.0",
|
||||
"version": "1.1.1",
|
||||
"maintainer": {
|
||||
"name": "Julien Vaubourg",
|
||||
"email": "julien@vaubourg.com",
|
||||
"url": "http://julien.vaubourg.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.2.0",
|
||||
"moulinette": ">= 2.4.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php5-fpm",
|
||||
"ynh-vpnclient"
|
||||
],
|
||||
"multi_instance": "false",
|
||||
"arguments": {
|
||||
"install": [
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for the web administration",
|
||||
"fr": "Choisissez un domaine pour l'administration web"
|
||||
"en": "Choose a domain for the web administration",
|
||||
"fr": "Choisissez un domaine pour l'administration web"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for the web administration",
|
||||
"fr": "Choisissez un chemin pour l'administration web"
|
||||
"en": "Choose a path for the web administration",
|
||||
"fr": "Choisissez un chemin pour l'administration web"
|
||||
},
|
||||
"example": "/vpnadmin",
|
||||
"default": "/vpnadmin"
|
||||
|
||||
@@ -6,3 +6,4 @@ mkdir -p "${backup_dir}/"
|
||||
sudo cp -a /etc/openvpn/keys/ "${backup_dir}/"
|
||||
sudo cp -a /etc/openvpn/client.conf.tpl "${backup_dir}/"
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -26,10 +26,11 @@ url_path=${2}
|
||||
|
||||
if ! $upgrade; then
|
||||
source ./helpers
|
||||
source ./prerequisites
|
||||
fi
|
||||
|
||||
# Check domain/path availability
|
||||
ynh_webpath_register vpnclient $domain $url_path || ynh_die "problem on domain/path availability" 1
|
||||
ynh_webpath_register vpnclient $domain $url_path || exit 1
|
||||
|
||||
# Install packages
|
||||
packages='php5-fpm sipcalc dnsutils openvpn curl fake-hwclock'
|
||||
@@ -149,3 +150,4 @@ fi
|
||||
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
exit 0
|
||||
|
||||
8
scripts/prerequisites
Normal file
8
scripts/prerequisites
Normal file
@@ -0,0 +1,8 @@
|
||||
# Source me
|
||||
|
||||
# Check YunoHost version (firewall hook in Moulinette)
|
||||
ynh_version=$(sudo dpkg -l yunohost | grep ii | awk '{ print $3 }' | sed 's/\.//g')
|
||||
|
||||
if [ "${ynh_version}" -lt 240 ]; then
|
||||
echo "WARN: You need a YunoHost's version equals or greater than 2.4.0 for activating the firewalling" >&2
|
||||
fi
|
||||
@@ -50,3 +50,4 @@ sudo systemctl reload nginx
|
||||
# Remove sources
|
||||
sudo rm -rf /var/www/vpnadmin/
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -18,3 +18,4 @@ bash ./upgrade
|
||||
|
||||
sudo rm -r "${tmpdir}/"
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
ynh_setting() {
|
||||
app=${1}
|
||||
setting=${2}
|
||||
ynh_app_setting_get $app $setting
|
||||
|
||||
sudo grep "^${setting}:" "/etc/yunohost/apps/${app}/settings.yml" | sed s/^[^:]\\+:\\s*[\"\']\\?// | sed s/\\s*[\"\']\$//
|
||||
}
|
||||
|
||||
source ./helpers
|
||||
source ./prerequisites
|
||||
|
||||
domain=$(ynh_setting vpnclient domain)
|
||||
path=$(ynh_setting vpnclient path)
|
||||
@@ -42,3 +44,4 @@ fi
|
||||
|
||||
ynh_systemctl start ynh-vpnclient
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user