From dba3e6ad3e1da74a56ea8914f4e089df7d7d519a Mon Sep 17 00:00:00 2001 From: Orazio Date: Mon, 20 Jan 2020 09:56:07 +0100 Subject: [PATCH] - Prepend 'pivpn-' to unstable repo files to limit naming conflicts - Update variables inside unattended examples - Remove openvpn logging setting when uninstalling the package - Run 'apt-get update' after removing the WireGuard PPA --- auto_install/install.sh | 6 +++--- scripts/uninstall.sh | 11 ++++++++--- unattended_openvpn_example.conf | 6 +++--- unattended_wireguard_example.conf | 6 +++--- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 4f0b15f..4236a21 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -990,7 +990,7 @@ installWireGuard(){ installDependentPackages PIVPN_DEPS[@] # Do not upgrade packages from the unstable repository except for wireguard echo "::: Adding Debian repository... " - echo "deb https://deb.debian.org/debian/ unstable main" | $SUDO tee /etc/apt/sources.list.d/unstable.list > /dev/null + echo "deb https://deb.debian.org/debian/ unstable main" | $SUDO tee /etc/apt/sources.list.d/pivpn-unstable.list > /dev/null printf 'Package: *\nPin: release a=unstable\nPin-Priority: 1\n\nPackage: wireguard wireguard-dkms wireguard-tools\nPin: release a=unstable\nPin-Priority: 500\n' | $SUDO tee /etc/apt/preferences.d/limit-unstable > /dev/null $SUDO apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138 @@ -1093,8 +1093,8 @@ installWireGuard(){ echo "::: Installing WireGuard from Debian package... " echo "::: Adding Debian repository... " - echo "deb https://deb.debian.org/debian/ unstable main" | $SUDO tee /etc/apt/sources.list.d/unstable.list > /dev/null - printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' | $SUDO tee /etc/apt/preferences.d/limit-unstable > /dev/null + echo "deb https://deb.debian.org/debian/ unstable main" | $SUDO tee /etc/apt/sources.list.d/pivpn-unstable.list > /dev/null + printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' | $SUDO tee /etc/apt/preferences.d/pivpn-limit-unstable > /dev/null # shellcheck disable=SC2086 $SUDO ${UPDATE_PKG_CACHE} &> /dev/null PIVPN_DEPS=(linux-headers-amd64 qrencode wireguard wireguard-tools wireguard-dkms) diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 203aaa0..766f78d 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -111,11 +111,12 @@ removeAll(){ # there is no wireguard package). On Ubuntu, remove the PPA. ### FIXME: unconditionally rm'ing unstable.list isn't a good idea, it appears. What if someone else put it there manually? if [ "$PLAT" = "Debian" ] || { [ "$PLAT" = "Raspbian" ] && [ "$(uname -m)" = "armv7l" ]; }; then - rm /etc/apt/sources.list.d/unstable.list - rm /etc/apt/preferences.d/limit-unstable + rm -f /etc/apt/sources.list.d/pivpn-unstable.list + rm -f /etc/apt/preferences.d/pivpn-limit-unstable $PKG_MANAGER update &> /dev/null elif [ "$PLAT" = "Ubuntu" ]; then add-apt-repository ppa:wireguard/wireguard -r -y + $PKG_MANAGER update &> /dev/null fi elif [ "${i}" = "wireguard-dkms" ]; then @@ -148,7 +149,11 @@ removeAll(){ rm -rf /etc/apt/apt.conf.d/*unattended-upgrades elif [ "${i}" = "openvpn" ]; then - deluser openvpn + + deluser openvpn + rm -f /etc/rsyslog.d/30-openvpn.conf + rm -f /etc/logrotate.d/openvpn + fi printf ":::\\tRemoving %s..." "$i"; $PKG_MANAGER -y remove --purge "$i" &> /dev/null & spinner $!; printf "done!\\n"; break diff --git a/unattended_openvpn_example.conf b/unattended_openvpn_example.conf index 92a6e40..ae9d9b7 100644 --- a/unattended_openvpn_example.conf +++ b/unattended_openvpn_example.conf @@ -1,11 +1,11 @@ IPv4dev=eth0 -staticReserv=0 +dhcpReserv=0 install_user=pi VPN=openvpn pivpnPROTO=udp pivpnPORT=1194 -pivpnDNS1=8.8.8.8 -pivpnDNS2=8.8.4.4 +pivpnDNS1=9.9.9.9 +pivpnDNS2=149.112.112.112 pivpnHOST=pivpn.example.com pivpnENCRYPT=2048 pivpnSEARCHDOMAIN=searchdomain.example.com diff --git a/unattended_wireguard_example.conf b/unattended_wireguard_example.conf index 8040e0e..196d4d5 100644 --- a/unattended_wireguard_example.conf +++ b/unattended_wireguard_example.conf @@ -1,9 +1,9 @@ IPv4dev=eth0 -staticReserv=0 +dhcpReserv=0 install_user=pi VPN=wireguard pivpnPORT=51820 -pivpnDNS1=8.8.8.8 -pivpnDNS2=8.8.4.4 +pivpnDNS1=9.9.9.9 +pivpnDNS2=149.112.112.112 pivpnHOST=pivpn.example.com UNATTUPG=1