Merge pull request #2 from angristan/master

Merge back to Master
This commit is contained in:
psgoundar 2020-03-28 01:34:49 -07:00 committed by GitHub
commit f783a3e40e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -1,4 +1,4 @@
on: push
on: [push, pull_request]
name: ShellCheck
jobs:
shellcheck:

View file

@ -606,6 +606,22 @@ function installOpenVPN () {
# Get the "public" interface from the default route
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
if [[ -z "$NIC" ]] && [[ "$IPV6_SUPPORT" = 'y' ]]; then
NIC=$(ip -6 route show default | sed -ne 's/^default .* dev \([^ ]*\) .*$/\1/p')
fi
# $NIC can not be empty for script rm-openvpn-rules.sh
if [[ -z "$NIC" ]]; then
echo
echo "Can not detect public interface."
echo "This needs for setup MASQUERADE."
until [[ $CONTINUE =~ (y|n) ]]; do
read -rp "Continue? [y/n]: " -e CONTINUE
done
if [[ "$CONTINUE" = "n" ]]; then
exit 1
fi
fi
if [[ "$OS" =~ (debian|ubuntu) ]]; then
apt-get update
@ -897,7 +913,7 @@ verb 3" >> /etc/openvpn/server.conf
fi
# Add iptables rules in two scripts
mkdir /etc/iptables
mkdir -p /etc/iptables
# Script to add rules
echo "#!/bin/sh
@ -961,6 +977,7 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables-openvpn.service
echo "client" > /etc/openvpn/client-template.txt
if [[ "$PROTOCOL" = 'udp' ]]; then
echo "proto udp" >> /etc/openvpn/client-template.txt
echo "explicit-exit-notify" >> /etc/openvpn/client-template.txt
elif [[ "$PROTOCOL" = 'tcp' ]]; then
echo "proto tcp-client" >> /etc/openvpn/client-template.txt
fi