From 871d5353a5a26c21be880f90745f5acad764bbae Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 21 Feb 2021 10:28:55 +0000 Subject: [PATCH 01/16] Update br0 dhcpcd sequence, thx @lifros --- includes/hostapd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 9aeb59e2..43e04bd1 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -306,8 +306,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) if ($bridgedEnable == 1) { $config = array_keys(getDefaultNetOpts('dhcp')); $config[] = PHP_EOL.'# RaspAP br0 configuration'; - $config[] = 'interface br0'; $config[] = 'denyinterfaces eth0 wlan0'; + $config[] = 'interface br0'; $config[] = PHP_EOL; } elseif ($wifiAPEnable == 1) { $config = array_keys(getDefaultNetOpts('dhcp')); From effed561699289fe8d66e8b96e17cb96f9463b3b Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 09:41:37 +0000 Subject: [PATCH 02/16] Bugfix: update br0 dhcpcd sequence --- includes/hostapd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 9aeb59e2..43e04bd1 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -306,8 +306,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) if ($bridgedEnable == 1) { $config = array_keys(getDefaultNetOpts('dhcp')); $config[] = PHP_EOL.'# RaspAP br0 configuration'; - $config[] = 'interface br0'; $config[] = 'denyinterfaces eth0 wlan0'; + $config[] = 'interface br0'; $config[] = PHP_EOL; } elseif ($wifiAPEnable == 1) { $config = array_keys(getDefaultNetOpts('dhcp')); From 1eec097b804054f84bf05709420d1e7a15e2b590 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 09:47:25 +0000 Subject: [PATCH 03/16] Bugfix: Parse dhcp-host entries --- includes/dhcp.php | 7 +++++-- templates/dhcp/static_leases.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/dhcp.php b/includes/dhcp.php index 0ebf641b..bc323200 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -45,12 +45,15 @@ function DisplayDHCPConfig() } } getWifiInterface(); + $ap_iface = $_SESSION['ap_interface']; $serviceStatus = $dnsmasq_state ? "up" : "down"; exec('cat '. RASPI_DNSMASQ_PREFIX.'raspap.conf', $return); $conf = ParseConfig($return); + exec('cat '. RASPI_DNSMASQ_PREFIX.$ap_iface.'.conf', $return); + $conf = array_merge(ParseConfig($return)); + $hosts = (array)$conf['dhcp-host']; exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); exec('cat ' . RASPI_DNSMASQ_LEASES, $leases); - $ap_iface = $_SESSION['ap_interface']; echo renderTemplate( "dhcp", compact( @@ -59,7 +62,7 @@ function DisplayDHCPConfig() "dnsmasq_state", "ap_iface", "conf", - "dhcpHost", + "hosts", "interfaces", "leases" ) diff --git a/templates/dhcp/static_leases.php b/templates/dhcp/static_leases.php index 3b804270..638ff064 100644 --- a/templates/dhcp/static_leases.php +++ b/templates/dhcp/static_leases.php @@ -3,7 +3,7 @@

- +
From 109c4f84d5c6263851f5faf0ad0d6456dc6dbd6d Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 09:49:24 +0000 Subject: [PATCH 04/16] Update features list --- BACKERS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BACKERS.md b/BACKERS.md index 6c51208d..8ea2c184 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -19,6 +19,8 @@ When backers were asked which feature they'd most like to see added to RaspAP, t ✅ Multiple OpenVPN client configs ✅ OpenVPN service logging +✅ Night mode toggle +✅ Restrict network to static clients ⚙️ Traffic shaping (in progress) Look for the list above to grow as we add more exclusive features. @@ -29,6 +31,8 @@ Below is a list of funding targets. When a funding target is reached, the featur #### $500 ✅ Multiple OpenVPN client configs ✅ OpenVPN service logging +✅ Night mode toggle +✅ Restrict network to static clients ⚙️ Traffic shaping (in progress) ### Frequently asked questions From 54b9d7ec5e0679effb5ad3c42678010f32038d66 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 12:02:12 +0000 Subject: [PATCH 05/16] Update release version --- README.md | 2 +- includes/defaults.php | 2 +- index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0ee055e1..4ceebd7a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![](https://i.imgur.com/xeKD93p.png) -[![Release 2.6.1](https://img.shields.io/badge/release-v2.6.1-green)](https://github.com/raspap/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/github/raspap/raspap-webgui/](https://api.travis-ci.org/RaspAP/raspap-webgui.svg) [![Crowdin](https://badges.crowdin.net/raspap/localized.svg)](https://crowdin.com/project/raspap) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/) +[![Release 2.6.2](https://img.shields.io/badge/release-v2.6.2-green)](https://github.com/raspap/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/github/raspap/raspap-webgui/](https://api.travis-ci.org/RaspAP/raspap-webgui.svg) [![Crowdin](https://badges.crowdin.net/raspap/localized.svg)](https://crowdin.com/project/raspap) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/) RaspAP lets you quickly get a wireless access point up and running to share the connectivity of many popular [Debian-based devices](#supported-operating-systems), including the Raspberry Pi. Our popular [Quick installer](#quick-installer) creates a known-good default configuration that "just works" on all current Raspberry Pis with onboard wireless. A responsive interface gives you control over the relevant services and networking options. Advanced DHCP settings, OpenVPN client support, SSL, security audits, themes and multilingual options are included. diff --git a/includes/defaults.php b/includes/defaults.php index 89fdb759..dfdb7ccb 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -6,7 +6,7 @@ if (!defined('RASPI_CONFIG')) { $defaults = [ 'RASPI_BRAND_TEXT' => 'RaspAP', - 'RASPI_VERSION' => '2.6.1', + 'RASPI_VERSION' => '2.6.2', 'RASPI_CONFIG_NETWORK' => RASPI_CONFIG.'/networking/defaults.json', 'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth', 'RASPI_WIFI_AP_INTERFACE' => 'wlan0', diff --git a/index.php b/index.php index d0884831..87b0c8b8 100755 --- a/index.php +++ b/index.php @@ -14,7 +14,7 @@ * @author Lawrence Yau * @author Bill Zimmerman * @license GNU General Public License, version 3 (GPL-3.0) - * @version 2.6.1 + * @version 2.6.2 * @link https://github.com/raspap/raspap-webgui/ * @link https://raspap.com/ * @see http://sirlagz.net/2013/02/08/raspap-webgui/ From d6570cbc41fb834ffdfa1939d0d626f9615b1f95 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 22 Feb 2021 16:08:24 +0000 Subject: [PATCH 06/16] Update install loader --- installers/raspbian.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 4b8011fd..469fff7f 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -17,9 +17,10 @@ # -a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) # -r, --repo, --repository Overrides the default GitHub repo (raspap/raspap-webgui) # -b, --branch Overrides the default git branch (master) -# -h, --help Outputs usage notes and exits # -u, --upgrade Upgrades an existing installation to the latest release version +# -i, --insiders Installs from the Insiders Edition (raspap/raspap-insiders) # -v, --version Outputs release info and exits +# -h, --help Outputs usage notes and exits # # Depending on options passed to the installer, ONE of the following # additional shell scripts will be downloaded and sourced: @@ -81,6 +82,9 @@ function _parse_params() { -u|--upgrade) upgrade=1 ;; + -i|--insiders) + repo="raspap/raspap-insiders" + ;; -v|--version) _version ;; @@ -126,6 +130,7 @@ OPTIONS: -r, --repo, --repository Overrides the default GitHub repo (raspap/raspap-webgui) -b, --branch Overrides the default git branch (latest release) -u, --upgrade Upgrades an existing installation to the latest release version +-i, --insiders Installs from the Insiders Edition (raspap/raspap-insiders) -v, --version Outputs release info and exits -h, --help Outputs usage notes and exits @@ -139,13 +144,16 @@ Examples: Invoke installer remotely, run non-interactively with option flags: curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --adblock 0 + Invoke remotely, uprgrade an existing install to the Insiders Edition: + curl -sL https://install.raspap.com | bash -s -- --upgrade --insiders + EOF exit } function _version() { _get_release - echo -e "RaspAP v${RASPAP_LATEST} - Simple AP setup & WiFi management for Debian-based devices" + echo -e "RaspAP v${RASPAP_LATEST} - Simple wireless AP setup & management for Debian-based devices" exit } @@ -166,7 +174,12 @@ function _display_welcome() { # Fetch latest release from GitHub API function _get_release() { - readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) + if [ "$repo" == "raspap/raspap-insiders" ]; then + readonly RASPAP_LATEST="Insiders" + branch="master" + else + readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) + fi } # Outputs a RaspAP Install log line From 33ac6d26cf3f01bb92eb69a55a3848492225cb4b Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 2 Mar 2021 14:37:50 +0000 Subject: [PATCH 07/16] Fix for #803 by @mp035 --- config/50-raspap-router.conf | 8 ++++---- installers/common.sh | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/config/50-raspap-router.conf b/config/50-raspap-router.conf index 31ac6b1a..c7634436 100644 --- a/config/50-raspap-router.conf +++ b/config/50-raspap-router.conf @@ -2,8 +2,8 @@ server.modules += ( "mod_rewrite", ) -$HTTP["url"] =~ "^/(?!(dist|app|ajax|config)).*" { - url.rewrite-once = ( - "^/[^\?]*(\?.*)?" => "/index.php$1" - ) +$HTTP["url"] =~ "^/REPLACE_ME/(?!(dist|app|ajax|config)).*" { + url.rewrite-once = ( "^/REPLACE_ME/(.*?)(\?.+)?$"=>"/REPLACE_ME/index.php/$1?$2" ) + server.error-handler-404 = "/REPLACE_ME/index.php" } + diff --git a/installers/common.sh b/installers/common.sh index cf3883e1..dba8a0b9 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -208,14 +208,30 @@ function _install_lighttpd_configs() { # Copy config files echo "Copying 50-raspap-router.conf to /etc/lighttpd/conf-available" - sudo cp "$webroot_dir/config/50-raspap-router.conf" "/etc/lighttpd/conf-available" || _install_status 1 "Unable to copy lighttpd config file." + + CONFSRC="$webroot_dir/config/50-raspap-router.conf" + LTROOT=$(grep "server.document-root" /etc/lighttpd/lighttpd.conf | awk -F '=' '{print $2}' | tr -d " \"") + + # compare values and get difference + HTROOT=${webroot_dir/$LTROOT} + + # remove trailing slash if present + HTROOT=$(echo "$HTROOT" | sed -e 's/\/$//') + + # substitute values + awk "{gsub(\"/REPLACE_ME\",\"$HTROOT\")}1" $CONFSRC > /tmp/50-raspap-router.conf + + # copy into place + sudo cp /tmp/50-raspap-router.conf /etc/lighttpd/conf-available/ || _install_status 1 "Unable to copy lighttpd config file into place." + # link into conf-enabled - echo "Creating link to /etc/lighttpd/conf-enabled"|| _install_status 1 "Unable to copy lighttpd config file." - sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file." + echo "Creating link to /etc/lighttpd/conf-enabled" + sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file (this is normal if the link already exists)." sudo systemctl restart lighttpd.service || _install_status 1 "Unable to restart lighttpd" _install_status 0 } + # Prompt to install ad blocking function _prompt_install_adblock() { _install_log "Configure ad blocking (Beta)" From 74497bebf1d61fed388c3c87d97518807770aa13 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 2 Mar 2021 17:27:40 +0000 Subject: [PATCH 08/16] Update page routing with PATH_INFO --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 87b0c8b8..b69f89b9 100755 --- a/index.php +++ b/index.php @@ -49,7 +49,7 @@ require_once 'includes/torproxy.php'; $config = getConfig(); $output = $return = 0; -$page = $_SERVER['REQUEST_URI']; +$page = $_SERVER['PATH_INFO']; $theme_url = getThemeOpt(); $toggleState = getSidebarState(); From 406ff39ef8c8cf16baa8a42c4221eb69a46413ce Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 5 Mar 2021 19:24:18 +0000 Subject: [PATCH 09/16] Update release version --- BACKERS.md | 2 ++ README.md | 2 +- includes/defaults.php | 2 +- index.php | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BACKERS.md b/BACKERS.md index 8ea2c184..cabd988b 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -21,6 +21,7 @@ When backers were asked which feature they'd most like to see added to RaspAP, t ✅ OpenVPN service logging ✅ Night mode toggle ✅ Restrict network to static clients +⚙️ WireGuard support (in progress) ⚙️ Traffic shaping (in progress) Look for the list above to grow as we add more exclusive features. @@ -33,6 +34,7 @@ Below is a list of funding targets. When a funding target is reached, the featur ✅ OpenVPN service logging ✅ Night mode toggle ✅ Restrict network to static clients +⚙️ WireGuard support (in progress) ⚙️ Traffic shaping (in progress) ### Frequently asked questions diff --git a/README.md b/README.md index 42266b4b..ce80cb0b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![](https://i.imgur.com/DpgvLIO.png) -[![Release 2.7](https://img.shields.io/badge/release-v2.7-green)](https://github.com/raspap/raspap-insiders/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/github/raspap/raspap-webgui/](https://api.travis-ci.org/RaspAP/raspap-webgui.svg) [![Crowdin](https://badges.crowdin.net/raspap/localized.svg)](https://crowdin.com/project/raspap) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/) +[![Release 2.7.1](https://img.shields.io/badge/release-v2.7.1-green)](https://github.com/raspap/raspap-insiders/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/github/raspap/raspap-webgui/](https://api.travis-ci.org/RaspAP/raspap-webgui.svg) [![Crowdin](https://badges.crowdin.net/raspap/localized.svg)](https://crowdin.com/project/raspap) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/) Welcome to **RaspAP Insiders**. You, the members of the Insiders community, support the sponsorware release model, which means that new features are first exclusively released to sponsors as part of Insiders. Read on for details about how this strategy works—and *thank you* for joining us on this journey. diff --git a/includes/defaults.php b/includes/defaults.php index 93aa2df3..3cde7d64 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -6,7 +6,7 @@ if (!defined('RASPI_CONFIG')) { $defaults = [ 'RASPI_BRAND_TEXT' => 'RaspAP', - 'RASPI_VERSION' => '2.7', + 'RASPI_VERSION' => '2.7.1', 'RASPI_CONFIG_NETWORK' => RASPI_CONFIG.'/networking/defaults.json', 'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth', 'RASPI_WIFI_AP_INTERFACE' => 'wlan0', diff --git a/index.php b/index.php index a132db68..7e157bfe 100755 --- a/index.php +++ b/index.php @@ -14,7 +14,7 @@ * @author Lawrence Yau * @author Bill Zimmerman * @license GNU General Public License, version 3 (GPL-3.0) - * @version 2.7 + * @version 2.7.1 * @link https://github.com/raspap/raspap-insiders/ * @link https://raspap.com/ * @see http://sirlagz.net/2013/02/08/raspap-webgui/ From c10d13c45e786d275da73eb68d4aea55d357ca5d Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Fri, 5 Mar 2021 20:30:03 +0100 Subject: [PATCH 10/16] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce80cb0b..901dd74d 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ When backers were asked which feature they'd most like to see added to RaspAP, t ✅ Manage OpenVPN client configs ✅ OpenVPN service logging ✅ Night mode toggle -⚙️ Traffic shaping (in progress) +✅ Restrict network to static clients +⚙️ WireGuard support (in progress) +⚙️ Traffic shaping (in progress) Look for the list above to grow as we add more exlcusive features. Have an idea or suggestion for a future enhancement? Start or join an [Insiders discussion](https://github.com/orgs/RaspAP/teams/insiders/discussions) and let us know! @@ -41,7 +43,9 @@ Following is a list of funding targets. When a funding target is reached, the fe ✅ Manage OpenVPN client configs ✅ OpenVPN service logging ✅ Night mode toggle -⚙️ Traffic shaping (in progress) +✅ Restrict network to static clients +⚙️ WireGuard support (in progress) +⚙️ Traffic shaping (in progress) ## Frequently asked questions From 5d13d75ce7a927fdb3799d1d3ce9c089ce28026a Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Fri, 5 Mar 2021 20:30:47 +0100 Subject: [PATCH 11/16] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 901dd74d..1f137ad1 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ When backers were asked which feature they'd most like to see added to RaspAP, t ✅ Manage OpenVPN client configs ✅ OpenVPN service logging ✅ Night mode toggle -✅ Restrict network to static clients -⚙️ WireGuard support (in progress) -⚙️ Traffic shaping (in progress) +✅ Restrict network to static clients +⚙️ WireGuard support (in progress) +⚙️ Traffic shaping (in progress) Look for the list above to grow as we add more exlcusive features. Have an idea or suggestion for a future enhancement? Start or join an [Insiders discussion](https://github.com/orgs/RaspAP/teams/insiders/discussions) and let us know! @@ -43,8 +43,8 @@ Following is a list of funding targets. When a funding target is reached, the fe ✅ Manage OpenVPN client configs ✅ OpenVPN service logging ✅ Night mode toggle -✅ Restrict network to static clients -⚙️ WireGuard support (in progress) +✅ Restrict network to static clients +⚙️ WireGuard support (in progress) ⚙️ Traffic shaping (in progress) ## Frequently asked questions From 6d635a96d52ec7eae2de184a6b382c459293e3e0 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Sat, 6 Mar 2021 08:44:52 +0100 Subject: [PATCH 12/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f137ad1..8a4fd06f 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,10 @@ Following is a list of funding targets. When a funding target is reached, the fe ### Upgrading *I have an existing RaspAP installation. How do I upgrade to Insiders?* -Upgrading is easy. Simply invoke the Quick Installer with the `--upgrade` switch, specifying the private Insiders repo, like so: +Upgrading is easy. Simply invoke the Quick Installer with the --upgrade switch, specifying the private Insiders Edition, like so: ``` -curl -sL https://install.raspap.com | bash -s -- --upgrade --repo raspap/raspap-insiders +curl -sL https://install.raspap.com | bash -s -- --upgrade --insiders ``` If you haven't [added SSH keys to your GitHub account](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh) you will be prompted to authenticate. If so, just enter your GitHub credentials during the install: From 70989202d154647d4d0a539cabff8aa3763ffcaa Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Mon, 8 Mar 2021 09:10:05 +0100 Subject: [PATCH 13/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a4fd06f..f754d941 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ When backers were asked which feature they'd most like to see added to RaspAP, t ✅ OpenVPN service logging ✅ Night mode toggle ✅ Restrict network to static clients -⚙️ WireGuard support (in progress) +✅ WireGuard support ⚙️ Traffic shaping (in progress) Look for the list above to grow as we add more exlcusive features. Have an idea or suggestion for a future enhancement? Start or join an [Insiders discussion](https://github.com/orgs/RaspAP/teams/insiders/discussions) and let us know! @@ -44,7 +44,7 @@ Following is a list of funding targets. When a funding target is reached, the fe ✅ OpenVPN service logging ✅ Night mode toggle ✅ Restrict network to static clients -⚙️ WireGuard support (in progress) +✅ WireGuard support ⚙️ Traffic shaping (in progress) ## Frequently asked questions From 445b0af4b56d7cda80efa5f1bc5f8cf38c149824 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Mar 2021 09:51:15 +0000 Subject: [PATCH 14/16] Add @zbchristian's token option, fix private repo handling --- installers/common.sh | 78 ++++++++++++++++++++++++++++++++++++++++-- installers/raspbian.sh | 34 ++++++++++++------ 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 6acb021f..d38c0b4f 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -26,9 +26,15 @@ readonly raspap_adblock="/etc/dnsmasq.d/090_adblock.conf" readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf" readonly raspap_network="$raspap_dir/networking/" readonly rulesv4="/etc/iptables/rules.v4" +readonly raspap_client_scripts="/usr/local/sbin" readonly notracking_url="https://raw.githubusercontent.com/notracking/hosts-blocklists/master/" webroot_dir="/var/www/html" -git_source_url="https://github.com/$repo" # $repo from install.raspap.com + +if [ "$insiders" == 1 ]; then + repo="RaspAP/raspap-insiders" + branch=${RASPAP_INSIDERS_LATEST} +fi +git_source_url="https://github.com/$repo" # NOTE: all the below functions are overloadable for system-specific installs function _install_raspap() { @@ -50,6 +56,8 @@ function _install_raspap() { _configure_networking _prompt_install_adblock _prompt_install_openvpn + _prompt_install_wireguard + _install_client_config _patch_system_files _install_complete } @@ -77,7 +85,7 @@ function _config_installation() { fi echo "${opt[1]} lighttpd directory: ${webroot_dir}" if [ "$upgrade" == 1 ]; then - echo "This will upgrade your existing install to version ${RASPAP_LATEST}" + echo "This will upgrade your existing install to version ${RASPAP_RELEASE}" echo "Your configuration will NOT be changed" fi echo -n "Complete ${opt[2]} with these values? [Y/n]: " @@ -145,6 +153,7 @@ function _install_dependencies() { echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections sudo apt-get install $apt_option lighttpd git hostapd dnsmasq iptables-persistent $php_package $dhcpcd_package vnstat qrencode || _install_status 1 "Unable to install dependencies" + sudo apt-get install wvdial socat bc || _install_status 1 "Unable to install dependencies" _install_status 0 } @@ -170,6 +179,11 @@ function _create_raspap_directories() { # Create a directory to store networking configs echo "Creating $raspap_dir/networking" sudo mkdir -p "$raspap_dir/networking" + # Copy existing dhcpcd.conf to use as base config + echo "Adding /etc/dhcpcd.conf as base configuration" + cat /etc/dhcpcd.conf | sudo tee -a /etc/raspap/networking/defaults > /dev/null + echo "Changing file ownership of $raspap_dir" + sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" } # Generate hostapd logging and service control scripts @@ -313,6 +327,49 @@ function _prompt_install_openvpn() { fi } +# Prompt to install WireGuard +function _prompt_install_wireguard() { + if [ "$insiders" == 1 ]; then + _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 + 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" @@ -464,6 +521,23 @@ function _enable_raspap_daemon() { sudo systemctl enable raspapd.service || _install_status 1 "Failed to enable raspap.service" } +function _install_client_config() { + _install_log "Install mobile client scripts and settings" + # Move scripts + sudo cp "$webroot_dir/config/client_config/"*.sh "$raspap_client_scripts/" || _install_status 1 "Unable to move client scripts" + sudo chmod a+rx "$raspap_client_scripts/"*.sh || _install_status 1 "Unable to chmod client scripts" + sudo cp "$webroot_dir/config/client_config/mcc-mnc-table.csv" "$raspap_client_scripts/" || _install_status 1 "Unable to move client data" + # wvdial settings + sudo cp "$webroot_dir/config/client_config/wvdial.conf" "/etc/" || _install_status 1 "Unable to install client configuration" + sudo cp "$webroot_dir/config/client_config/interfaces" "/etc/network/interfaces" || _install_status 1 "Unable to install interface settings" + # udev rules/services to auto start mobile data services + sudo cp "$webroot_dir/config/client_config/70-mobile-data-sticks.rules" "/etc/udev/rules.d/" || _install_status 1 "Unable to install client udev rules" + sudo cp "$webroot_dir/config/client_config/80-raspap-net-devices.rules" "/etc/udev/rules.d/" || _install_status 1 "Unable to install client udev rules" + sudo cp "$webroot_dir/config/client_config/"*.service "/etc/systemd/system/" || _install_status 1 "Unable to install client startup services" + # client configuration and udev rule templates + sudo cp "$webroot_dir/config/client_udev_prototypes.json" "/etc/raspap/networking/" || _install_status 1 "Unable to install client configuration" +} + # Configure IP forwarding, set IP tables rules, prompt to install RaspAP daemon function _configure_networking() { _install_log "Configuring networking" diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 469fff7f..da84a728 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -17,6 +17,7 @@ # -a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) # -r, --repo, --repository Overrides the default GitHub repo (raspap/raspap-webgui) # -b, --branch Overrides the default git branch (master) +# -t, --token Token to access a private repository # -u, --upgrade Upgrades an existing installation to the latest release version # -i, --insiders Installs from the Insiders Edition (raspap/raspap-insiders) # -v, --version Outputs release info and exits @@ -36,8 +37,7 @@ set -eo pipefail function _main() { # set defaults - repo="raspap/raspap-webgui" # override with -r, --repo option - + repo="RaspAP/raspap-webgui" # override with -r, --repo option _parse_params "$@" _setup_colors _log_output @@ -50,6 +50,8 @@ function _parse_params() { upgrade=0 ovpn_option=1 adblock_option=1 + insiders=0 + acctoken="" while :; do case "${1-}" in @@ -83,7 +85,10 @@ function _parse_params() { upgrade=1 ;; -i|--insiders) - repo="raspap/raspap-insiders" + insiders=1 + ;; + -t|--token) + acctoken="$2" ;; -v|--version) _version @@ -129,6 +134,7 @@ OPTIONS: -a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) -r, --repo, --repository Overrides the default GitHub repo (raspap/raspap-webgui) -b, --branch Overrides the default git branch (latest release) +-t, --token Token to access a private repository -u, --upgrade Upgrades an existing installation to the latest release version -i, --insiders Installs from the Insiders Edition (raspap/raspap-insiders) -v, --version Outputs release info and exits @@ -153,7 +159,7 @@ EOF function _version() { _get_release - echo -e "RaspAP v${RASPAP_LATEST} - Simple wireless AP setup & management for Debian-based devices" + echo -e "RaspAP v${RASPAP_RELEASE} - Simple wireless AP setup & management for Debian-based devices" exit } @@ -167,18 +173,19 @@ function _display_welcome() { echo -e " 88 88 88. .88 88 88. .88 88 88 88" echo -e " dP dP 88888P8 88888P 88Y888P 88 88 dP" echo -e " 88" - echo -e " dP version ${RASPAP_LATEST}" + echo -e " dP version ${RASPAP_RELEASE}" echo -e "${ANSI_GREEN}" echo -e "The Quick Installer will guide you through a few easy steps${ANSI_RESET}\n\n" } # Fetch latest release from GitHub API function _get_release() { - if [ "$repo" == "raspap/raspap-insiders" ]; then - readonly RASPAP_LATEST="Insiders" - branch="master" + readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) + if [ "$insiders" == 1 ]; then + RASPAP_INSIDERS_LATEST=$(curl -s "https://install.raspap.com/repos/RaspAP/raspap-insiders/releases/latest/" | grep -Po '"tag_name": "\K.*?(?=")' ) + RASPAP_RELEASE="${RASPAP_INSIDERS_LATEST} Insiders" else - readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) + RASPAP_RELEASE="${RASPAP_LATEST}" fi } @@ -214,6 +221,7 @@ function _update_system_packages() { # Fetch required installer functions function _load_installer() { + # fetch latest release tag _get_release @@ -223,14 +231,18 @@ function _load_installer() { fi UPDATE_URL="https://raw.githubusercontent.com/$repo/$branch/" + header=() + if [[ ! -z "$acctoken" ]]; then + header=(--header "Authorization: token $acctoken") + fi if [ "${install_cert:-}" = 1 ]; then source="mkcert" - wget -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh + wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh source /tmp/raspap_${source}.sh && rm -f /tmp/raspap_${source}.sh _install_certificate || _install_status 1 "Unable to install certificate" else source="common" - wget -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh + wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh source /tmp/raspap_${source}.sh && rm -f /tmp/raspap_${source}.sh _install_raspap || _install_status 1 "Unable to install RaspAP" fi From 76e87508bdc23cee5d10580cb2b0c00cb440269f Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Mar 2021 09:58:05 +0000 Subject: [PATCH 15/16] Remove feature branch routines --- installers/common.sh | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index d38c0b4f..8b532be3 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -26,7 +26,6 @@ readonly raspap_adblock="/etc/dnsmasq.d/090_adblock.conf" readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf" readonly raspap_network="$raspap_dir/networking/" readonly rulesv4="/etc/iptables/rules.v4" -readonly raspap_client_scripts="/usr/local/sbin" readonly notracking_url="https://raw.githubusercontent.com/notracking/hosts-blocklists/master/" webroot_dir="/var/www/html" @@ -57,7 +56,6 @@ function _install_raspap() { _prompt_install_adblock _prompt_install_openvpn _prompt_install_wireguard - _install_client_config _patch_system_files _install_complete } @@ -153,7 +151,6 @@ function _install_dependencies() { echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections sudo apt-get install $apt_option lighttpd git hostapd dnsmasq iptables-persistent $php_package $dhcpcd_package vnstat qrencode || _install_status 1 "Unable to install dependencies" - sudo apt-get install wvdial socat bc || _install_status 1 "Unable to install dependencies" _install_status 0 } @@ -179,9 +176,6 @@ function _create_raspap_directories() { # Create a directory to store networking configs echo "Creating $raspap_dir/networking" sudo mkdir -p "$raspap_dir/networking" - # Copy existing dhcpcd.conf to use as base config - echo "Adding /etc/dhcpcd.conf as base configuration" - cat /etc/dhcpcd.conf | sudo tee -a /etc/raspap/networking/defaults > /dev/null echo "Changing file ownership of $raspap_dir" sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || _install_status 1 "Unable to change file ownership for '$raspap_dir'" } @@ -521,23 +515,6 @@ function _enable_raspap_daemon() { sudo systemctl enable raspapd.service || _install_status 1 "Failed to enable raspap.service" } -function _install_client_config() { - _install_log "Install mobile client scripts and settings" - # Move scripts - sudo cp "$webroot_dir/config/client_config/"*.sh "$raspap_client_scripts/" || _install_status 1 "Unable to move client scripts" - sudo chmod a+rx "$raspap_client_scripts/"*.sh || _install_status 1 "Unable to chmod client scripts" - sudo cp "$webroot_dir/config/client_config/mcc-mnc-table.csv" "$raspap_client_scripts/" || _install_status 1 "Unable to move client data" - # wvdial settings - sudo cp "$webroot_dir/config/client_config/wvdial.conf" "/etc/" || _install_status 1 "Unable to install client configuration" - sudo cp "$webroot_dir/config/client_config/interfaces" "/etc/network/interfaces" || _install_status 1 "Unable to install interface settings" - # udev rules/services to auto start mobile data services - sudo cp "$webroot_dir/config/client_config/70-mobile-data-sticks.rules" "/etc/udev/rules.d/" || _install_status 1 "Unable to install client udev rules" - sudo cp "$webroot_dir/config/client_config/80-raspap-net-devices.rules" "/etc/udev/rules.d/" || _install_status 1 "Unable to install client udev rules" - sudo cp "$webroot_dir/config/client_config/"*.service "/etc/systemd/system/" || _install_status 1 "Unable to install client startup services" - # client configuration and udev rule templates - sudo cp "$webroot_dir/config/client_udev_prototypes.json" "/etc/raspap/networking/" || _install_status 1 "Unable to install client configuration" -} - # Configure IP forwarding, set IP tables rules, prompt to install RaspAP daemon function _configure_networking() { _install_log "Configuring networking" From 80c525c042a1e97f8eee00a754494010fd588ef7 Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 9 Mar 2021 10:58:15 +0000 Subject: [PATCH 16/16] Minor: update comments --- installers/raspbian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index da84a728..fed9b619 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -178,7 +178,7 @@ function _display_welcome() { echo -e "The Quick Installer will guide you through a few easy steps${ANSI_RESET}\n\n" } -# Fetch latest release from GitHub API +# Fetch latest release from GitHub or RaspAP Installer API function _get_release() { readonly RASPAP_LATEST=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) if [ "$insiders" == 1 ]; then