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/RaspAP/raspap-insiders into feature/wireguard
This commit is contained in:
@@ -297,6 +297,47 @@ 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"
|
||||
if [ "$OS" == "Raspbian" ]; then
|
||||
echo "Installing raspberrypi-kernel-headers"
|
||||
sudo apt-get install $apt_option raspberrypi-kernel-headers || _install_status 1 "Unable to install raspberrypi-kernel-headers"
|
||||
fi
|
||||
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"
|
||||
|
@@ -39,7 +39,15 @@ www-data ALL=(ALL) NOPASSWD:/etc/raspap/openvpn/configauth.sh
|
||||
www-data ALL=(ALL) NOPASSWD:/etc/raspap/openvpn/openvpnlog.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
|
||||
|
||||
|
Reference in New Issue
Block a user