Add firewalling

This commit is contained in:
Julien Vaubourg
2015-09-27 16:03:01 +02:00
parent 67d17653fb
commit 7b05614b3c
6 changed files with 119 additions and 3 deletions

View File

@@ -26,6 +26,8 @@ url_path=${2}
server_name=${3}
if ! $upgrade; then
source ./prerequisites
# Check arguments
if [ -z "${server_name}" ]; then
@@ -42,7 +44,7 @@ if ! $upgrade; then
fi
# Install packages
packages='php5-fpm sipcalc openvpn'
packages='php5-fpm sipcalc dnsutils openvpn'
export DEBIAN_FRONTEND=noninteractive
sudo apt-get --assume-yes --force-yes install ${packages}
@@ -78,11 +80,13 @@ sudo install -o root -g root -m 0755 ../conf/ipv6_compressed /usr/local/bin/
sudo mkdir -pm 0755 /var/log/nginx/
sudo chown root:admins /etc/openvpn/
sudo chmod 775 /etc/openvpn/
sudo mkdir -pm 0755 /etc/yunohost/hooks.d/post_iptable_rules/
sudo install -b -o root -g admins -m 0664 ../conf/openvpn_client.conf.tpl /etc/openvpn/client.conf.tpl
sudo install -o root -g root -m 0644 ../conf/openvpn_client.conf.tpl /etc/openvpn/client.conf.tpl.restore
sudo install -b -o root -g root -m 0644 ../conf/nginx_vpnadmin.conf "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
sudo install -b -o root -g root -m 0644 ../conf/phpfpm_vpnadmin.conf /etc/php5/fpm/pool.d/vpnadmin.conf
sudo install -b -o root -g root -m 0755 ../conf/hook_post-iptable-rules /etc/yunohost/hooks.d/90-vpnclient.tpl
# Copy web sources
sudo mkdir -pm 0755 /var/www/vpnadmin/

9
scripts/prerequisites Normal file
View File

@@ -0,0 +1,9 @@
# Source me
# Check Moulinette version (firewall hook)
ynh_moulinette_version=$(sudo dpkg -l moulinette-yunohost | grep ii | awk '{ print $3 }' | sed 's/\.//g')
if [ "${ynh_moulinette_version}" -lt 240 ]; then
echo "ERROR: You need a YunoHost-Moulinette version equals or greater than 2.4.0" >&2
exit 1
fi

View File

@@ -31,6 +31,7 @@ sudo rm -f /tmp/.ynh-vpnclient-*
sudo rm -f /etc/openvpn/client.conf{.tpl,.tpl.restore,}
sudo rm -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
sudo rm -f /etc/php5/fpm/pool.d/vpnadmin.conf
sudo rm -f /etc/yunohost/hooks.d/90-vpnclient.tpl
# Remove certificates
sudo rm -rf /etc/openvpn/keys/

View File

@@ -7,6 +7,8 @@ ynh_setting() {
sudo grep "^${setting}:" "/etc/yunohost/apps/${app}/settings.yml" | sed s/^[^:]\\+:\\s*[\"\']\\?// | sed s/\\s*[\"\']\$//
}
source ./prerequisites
domain=$(ynh_setting vpnclient domain)
path=$(ynh_setting vpnclient path)
server_name=$(ynh_setting vpnclient server_name)