diff --git a/README.md b/README.md index 190a0c3..7050856 100644 --- a/README.md +++ b/README.md @@ -32,40 +32,24 @@ Prerequisites Install ------ -Check out [v1.2b](https://github.com/roenw/PiPass/blob/beta/README.md#Install) as it includes an automated install script! If you still wish to install v1.1, you may by expanding the details. +**NOTE:** Versions 1.2/1.2b and below are now deprecated due to not having automatic update checking functionality. Please update immediately by removing your current installation and following this much simpler setup guide. -
-Installing PiPass is straightforward and simple. It should take about 10-15 minutes. All it requires is a small change to your Pi-Hole's permissions, moving around some files, filling out a configuration file, and changing some settings with your webserver. -1. We'll get the most difficult stuff out of the way first. Use ``sudo visudo`` to edit your ``/etc/sudoers`` file. We will use this to give PHP permission to make changes to the whitelist. Add the following line to the _bottom_ of the file. Substitute ``USER_RUNNING_PHP`` in the file with the user that is running PHP on your system. - -``USER_RUNNING_PHP ALL=(ALL) NOPASSWD: /usr/local/bin/pihole -w *, /usr/local/bin/pihole -w -d *`` -> The /etc/sudoers file is a critical file to the security of your Linux installation. Adding anything other than what is above can expose your system to security threats. -2. Next, we have to tell our webserver to point all 404 erros to the homepage. It's not ideal and hopefully it can be changed in a future release, but as of now it's required for proper function. How you do this depends on your webserver. For lighttpd, comment out the existing 404 line and replace it with: - -``server.error-handler-404 = "/index.php"`` - -I don't personally run lighttpd and this is untested, but it should work. Just don't be surprised if it doesn't ;) -I use nginx, so this code is verified working: +1. Make your webserver redirect all 404 errors to the webroot. For nginx, this is ``` location / { - try_files $uri $uri/ =404; - error_page 404 =200 http://$host; + try_files $uri $uri/ =404; + error_page 404 =200 http://$host; } ``` -3. We must instruct Pi-Hole to use a blockpage instead of returning ``NXDOMAIN``. Don't worry, this will still result in a blank space where advertisements should be. Using your favorite editor, edit ``/etc/pihole/pihole-FTL.conf`` and find the line ``BLOCKINGMODE``. Replace it with ``BLOCKINGMODE=IP`` and restart the Pi-Hole FTL service. - -You can now test the configuration so far. Go to a website you know is blocked. It should return the ``index`` page, or a ``404 Not Found/403 Forbidden`` error if configured correctly. - -4. To prepare for installation, ``cd`` to your webroot folder. Make sure there are no ``index`` files and there is no folder called ``blockpage``. +For lighttpd, use ``server.error-handler-404 = "/index.php"`` (this is untested, but should work) -5. Now, we're at the fun part. Making sure you are still in your webroot, run ``sudo git clone https://github.com/roenw/pipass.git && cd pipass && sudo git checkout tags/v1.1 && cd .. && sudo mv pipass/* . && sudo rm -r pipass/`` This command downloads all PiPass files and moves them to your webroot. +2. Execute ``cd ~ && wget https://apps.roen.us/pipass/getuser && mv getuser getuser.php && wget https://apps.roen.us/pipass/setup && mv setup setup.php`` to download the setup script and rename it. -6. Using your favorite text editor, edit ``config.php`` with appropriate information. +3. Execute ``sudo php setup.php`` to execute the setup script. -7. It works! (Hopefully) -
+4. Fill out the ``config.php`` configuration file. Support ------ @@ -75,14 +59,12 @@ Pull requests are welcome! Known Caveats ------ -* /etc/sudoers file must be modified * Requires webroot index * Requires end-user to (sometimes) clear their DNS cache -* Configuration is not automated * Does not work on websites with HSTS header cached :( Future Ideas ------ -* Configuration script (maybe even an apt package?) * Ability to trigger permanent whitelist after password entry +* Admin console for PiPass diff --git a/blockpage/index.php b/blockpage/index.php index d73e068..71a2ddf 100755 --- a/blockpage/index.php +++ b/blockpage/index.php @@ -116,14 +116,37 @@ function unblock() { TECHNICAL INFO:
Reported by $hostname ($server_ip) at $date. Running PiPass version $pipass_v. - -EOL; - } else { - echo << EOL; } ?> + + Update Available! +EOL; + } else { + echo << +
+ Your PiPass installation is up-to-date. +EOL; + } + ?> +
diff --git a/config.php b/config.php index 42d213a..f04a00a 100644 --- a/config.php +++ b/config.php @@ -43,6 +43,7 @@ // A way of saying the amount of unblock seconds in english. // For example, 300 seconds would equal 5 minutes. -$conf['pipass_v'] = "1.1 (beta)"; -// PiPass current version. +$conf['pipass_v'] = "1.3"; +// PiPass current version. Must be a NUMBER! Or else "update available" +// will be showing forever and you will get a HEADACHE trying to debug. ?> diff --git a/setup/getuser.php b/setup/getuser.php new file mode 100644 index 0000000..ea6c5db --- /dev/null +++ b/setup/getuser.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/setup/setup.php b/setup/setup.php new file mode 100644 index 0000000..aa02daf --- /dev/null +++ b/setup/setup.php @@ -0,0 +1,104 @@ + \ No newline at end of file diff --git a/setup/update.php b/setup/update.php new file mode 100644 index 0000000..e07431d --- /dev/null +++ b/setup/update.php @@ -0,0 +1,86 @@ + \ No newline at end of file