From 75ee366fae01dba72fc5314b199c9c4283bc4a55 Mon Sep 17 00:00:00 2001 From: Filip Strajnar Date: Sat, 27 Jan 2024 01:56:28 +0100 Subject: [PATCH 1/3] Added option to open the port on firewalld. --- openvpn-install.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index 06ad608a..3d6d7f20 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -310,6 +310,18 @@ function installQuestions() { PROTOCOL="tcp" ;; esac + if command -v "firewall-cmd" &> /dev/null + then + SUGGESTION=y + echo "Command \"firewall-cmd\" has been detected." + until [[ $ADDPORT =~ (y|n) ]]; do + read -rp "Would you like to open port ${PORT} on firewalld? [y/n]: " -e -i $SUGGESTION ADDPORT + done + if [[ $ADDPORT == "y" ]]; then + firewall-cmd --add-port "${PORT}"/"${PROTOCOL}" + firewall-cmd --permanent --add-port "${PORT}"/"${PROTOCOL}" + fi + fi echo "" echo "What DNS resolvers do you want to use with the VPN?" echo " 1) Current system resolvers (from /etc/resolv.conf)" From 37fba62c29060b46cd9ac3a62cac19d6a55d5aad Mon Sep 17 00:00:00 2001 From: Filip Strajnar Date: Fri, 21 Jun 2024 17:22:50 +0200 Subject: [PATCH 2/3] Added client-to-client option. --- openvpn-install.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index 3d6d7f20..458a95eb 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -322,6 +322,15 @@ function installQuestions() { firewall-cmd --permanent --add-port "${PORT}"/"${PROTOCOL}" fi fi + + echo "" + echo "Option client-to-client allows clients to \"see\" eachother." + echo "Would you like to enable this option?" + SUGGESTION=y + until [[ $CLIENT_TO_CLIENT_OPTION =~ (y|n) ]]; do + read -rp "Enable client-to-client? [y/n]: " -e -i $SUGGESTION CLIENT_TO_CLIENT_OPTION + done + echo "" echo "What DNS resolvers do you want to use with the VPN?" echo " 1) Current system resolvers (from /etc/resolv.conf)" @@ -787,6 +796,10 @@ function installOpenVPN() { echo "proto ${PROTOCOL}6" >>/etc/openvpn/server.conf fi + if [[ $CLIENT_TO_CLIENT_OPTION == "y" ]]; then + echo "client-to-client" >>/etc/openvpn/server.conf + fi + echo "dev tun user nobody group $NOGROUP From 2b73d5e1a442cb74c55fc8c0f7d873918b208bcd Mon Sep 17 00:00:00 2001 From: Filip Strajnar Date: Fri, 21 Jun 2024 17:26:29 +0200 Subject: [PATCH 3/3] Added default values for headless install. --- openvpn-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index 458a95eb..cd97b87a 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -645,6 +645,8 @@ function installOpenVPN() { CLIENT=${CLIENT:-client} PASS=${PASS:-1} CONTINUE=${CONTINUE:-y} + CLIENT_TO_CLIENT_OPTION="y" + ADDPORT="y" # Behind NAT, we'll default to the publicly reachable IPv4/IPv6. if [[ $IPV6_SUPPORT == "y" ]]; then