commit
f783a3e40e
2 changed files with 19 additions and 2 deletions
2
.github/workflows/push.yml
vendored
2
.github/workflows/push.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
on: push
|
on: [push, pull_request]
|
||||||
name: ShellCheck
|
name: ShellCheck
|
||||||
jobs:
|
jobs:
|
||||||
shellcheck:
|
shellcheck:
|
||||||
|
|
|
||||||
|
|
@ -606,6 +606,22 @@ function installOpenVPN () {
|
||||||
|
|
||||||
# Get the "public" interface from the default route
|
# Get the "public" interface from the default route
|
||||||
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
|
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
|
if [[ "$OS" =~ (debian|ubuntu) ]]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
@ -897,7 +913,7 @@ verb 3" >> /etc/openvpn/server.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add iptables rules in two scripts
|
# Add iptables rules in two scripts
|
||||||
mkdir /etc/iptables
|
mkdir -p /etc/iptables
|
||||||
|
|
||||||
# Script to add rules
|
# Script to add rules
|
||||||
echo "#!/bin/sh
|
echo "#!/bin/sh
|
||||||
|
|
@ -961,6 +977,7 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables-openvpn.service
|
||||||
echo "client" > /etc/openvpn/client-template.txt
|
echo "client" > /etc/openvpn/client-template.txt
|
||||||
if [[ "$PROTOCOL" = 'udp' ]]; then
|
if [[ "$PROTOCOL" = 'udp' ]]; then
|
||||||
echo "proto udp" >> /etc/openvpn/client-template.txt
|
echo "proto udp" >> /etc/openvpn/client-template.txt
|
||||||
|
echo "explicit-exit-notify" >> /etc/openvpn/client-template.txt
|
||||||
elif [[ "$PROTOCOL" = 'tcp' ]]; then
|
elif [[ "$PROTOCOL" = 'tcp' ]]; then
|
||||||
echo "proto tcp-client" >> /etc/openvpn/client-template.txt
|
echo "proto tcp-client" >> /etc/openvpn/client-template.txt
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue