mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge branch 'feature/wireguard' of https://github.com/billz/raspap-webgui into feature/wireguard
This commit is contained in:
@@ -262,6 +262,43 @@ function _prompt_install_openvpn() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompt to install WireGuard
|
||||
function _prompt_install_wireguard() {
|
||||
_install_log "Configure WireGuard support"
|
||||
echo -n "Install WireGuard and enable VPN tunnel configuration? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
echo -e
|
||||
else
|
||||
_install_wireguard
|
||||
fi
|
||||
elif [ "$wg_option" == 1 ]; then
|
||||
_install_wireguard
|
||||
else
|
||||
echo "(Skipped)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Install Wireguard from the Debian unstable distro
|
||||
function _install_wireguard() {
|
||||
_install_log "Configure WireGuard support"
|
||||
echo "Installing WireGuard from Debian unstable distro"
|
||||
echo "Adding Debian distro"
|
||||
echo "deb http://deb.debian.org/debian/ unstable main" | sudo tee --append /etc/apt/sources.list.d/unstable.list || _install_status 1 "Unable to append to sources.list"
|
||||
sudo apt-get install dirmngr || _install_status 1 "Unable to install dirmngr"
|
||||
echo "Adding Debian distro keys"
|
||||
sudo wget -q -O - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr).asc | sudo apt-key add - || _install_status 1 "Unable to add keys"
|
||||
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' | sudo tee --append /etc/apt/preferences.d/limit-unstable || _install_status 1 "Unable to append to preferences.d"
|
||||
echo "Installing WireGuard"
|
||||
sudo apt-get update && sudo apt-get install $apt_option wireguard || _install_status 1 "Unable to install wireguard"
|
||||
echo "Enabling wg-quick@wg0"
|
||||
sudo systemctl enable wg-quick@wg0 || _install_status 1 "Failed to enable wg-quick service"
|
||||
echo "Enabling WireGuard management option"
|
||||
sudo sed -i "s/\('RASPI_WIREGUARD_ENABLED', \)false/\1true/g" "$webroot_dir/includes/config.php" || _install_status 1 "Unable to modify config.php"
|
||||
_install_status 0
|
||||
}
|
||||
|
||||
# Install openvpn and enable client configuration option
|
||||
function _install_openvpn() {
|
||||
_install_log "Installing OpenVPN and enabling client configuration"
|
||||
@@ -568,6 +605,7 @@ function _install_raspap() {
|
||||
_configure_networking
|
||||
_prompt_install_adblock
|
||||
_prompt_install_openvpn
|
||||
_prompt_install_wireguard
|
||||
_patch_system_files
|
||||
_install_complete
|
||||
}
|
||||
|
@@ -35,7 +35,15 @@ www-data ALL=(ALL) NOPASSWD:/etc/raspap/lighttpd/configport.sh
|
||||
www-data ALL=(ALL) NOPASSWD:/etc/raspap/openvpn/configauth.sh
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/hostapd.log
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/dnsmasq.log
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/wireguard.log
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/dnsmasqdata /etc/dnsmasq.d/090_adblock.conf
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/dnsmasq_custom /etc/raspap/adblock/custom.txt
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/wgdata /etc/wireguard/wg0.conf
|
||||
www-data ALL=(ALL) NOPASSWD:/etc/raspap/adblock/update_blocklist.sh
|
||||
www-data ALL=(ALL) NOPASSWD:/usr/bin/tee /tmp/wireguard.log
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/systemctl status wg-quick@wg0
|
||||
www-data ALL=(ALL) NOPASSWD:/usr/bin/wg-quick up wg0
|
||||
www-data ALL=(ALL) NOPASSWD:/usr/bin/wg-quick down wg0
|
||||
www-data ALL=(ALL) NOPASSWD:/usr/bin/wg
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/cat /etc/wireguard/wg0.conf
|
||||
|
||||
|
@@ -14,6 +14,8 @@
|
||||
# Used with -y, --yes, sets OpenVPN install option (0=no install)
|
||||
# -a, --adblock <flag>
|
||||
# Used with -y, --yes, sets Adblock install option (0=no install)
|
||||
# -w, --wireguard <flag>
|
||||
# Used with -y, --yes, sets WireGuard install option (0=no install)
|
||||
# -r, --repo, --repository <name>
|
||||
# Overrides the default GitHub repo (billz/raspap-webgui)
|
||||
# -b, --branch <name>
|
||||
@@ -42,6 +44,7 @@ assume_yes=0
|
||||
upgrade=0
|
||||
ovpn_option=1
|
||||
adblock_option=1
|
||||
wg_option=1
|
||||
|
||||
# Define colors
|
||||
readonly ANSI_RED="\033[0;31m"
|
||||
@@ -61,6 +64,7 @@ Usage: raspbian.sh [OPTION]\n
|
||||
-c, --cert, --certificate\n\tInstalls an SSL certificate for lighttpd
|
||||
-o, --openvpn <flag>\n\tUsed with -y, --yes, sets OpenVPN install option (0=no install)
|
||||
-a, --adblock <flag>\n\tUsed with -y, --yes, sets Adblock install option (0=no install)
|
||||
-w, --wireguard <flag>\n\tUsed with -y, --yes, sets WireGuard install option (0=no install)
|
||||
-r, --repo, --repository <name>\n\tOverrides the default GitHub repo (billz/raspap-webgui)
|
||||
-b, --branch <name>\n\tOverrides the default git branch (master)
|
||||
-h, --help\n\tOutputs usage notes and exits
|
||||
@@ -84,6 +88,10 @@ while :; do
|
||||
adblock_option="$2"
|
||||
shift
|
||||
;;
|
||||
-w|--wireguard)
|
||||
wg_option="$2"
|
||||
shift
|
||||
;;
|
||||
-c|--cert|--certificate)
|
||||
install_cert=1
|
||||
;;
|
||||
|
Reference in New Issue
Block a user