From 2c96f026bdeb4a261197b2c1beeabb67d6e88f6a Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sat, 11 Nov 2023 22:08:22 +0100 Subject: [PATCH 1/6] Default to false instead of GitHub link for terms of use in Docker --- docker/php-fpm/src/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/php-fpm/src/config.php b/docker/php-fpm/src/config.php index 9c71442..a3d366f 100644 --- a/docker/php-fpm/src/config.php +++ b/docker/php-fpm/src/config.php @@ -82,4 +82,4 @@ const LG_SPEEDTEST_FILES = [ ]; // Define if you require visitors to agree with the Terms, set false to disable; -define('LG_TERMS', getenv('LG_TERMS') ?: 'https://github.com/hybula/lookingglass/'); +define('LG_TERMS', getenv('LG_TERMS') ?: false); From 49ba83ea2406935971d3f6bf046dbd42f8fae29a Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sat, 11 Nov 2023 22:12:32 +0100 Subject: [PATCH 2/6] Return 204 if no favicon is defined to fix CSRF token error on initial page load --- docker/nginx/nginx.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index 92253e3..c95737e 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -30,10 +30,15 @@ http { server_name _; root /var/www/html; + location / { try_files $uri $uri/ /index.php$is_args$args; } + location = /favicon.ico { + try_files $uri =204; + } + location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php-fpm:9000; From 750df47eb724b2cae61302610b3a4a2b47adc06d Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sat, 11 Nov 2023 22:13:55 +0100 Subject: [PATCH 3/6] Fix wrong ignore paths in PHP-FPM .dockerignore --- docker/php-fpm/Dockerfile.dockerignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/php-fpm/Dockerfile.dockerignore b/docker/php-fpm/Dockerfile.dockerignore index 1037ac9..da2c31b 100644 --- a/docker/php-fpm/Dockerfile.dockerignore +++ b/docker/php-fpm/Dockerfile.dockerignore @@ -1,3 +1,3 @@ -Dockerfile -Dockerfile.dockerignore -.git \ No newline at end of file +docker/php-fpm/Dockerfile +docker/php-fpm/Dockerfile.dockerignore +.git From eaf8cb012e3c97340038d3ade32564326d067f27 Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sat, 11 Nov 2023 22:22:12 +0100 Subject: [PATCH 4/6] Add example env vars to docker-compose.yml --- docker-compose.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 96bbc10..6a92465 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,4 +15,17 @@ services: build: context: . dockerfile: docker/php-fpm/Dockerfile - restart: unless-stopped \ No newline at end of file + restart: unless-stopped + environment: + # For a better reference as to what these variables do, check out 'config.dist.php' or 'docker/php-fpm/src/config.php'. + # Please replace them with values that are relevant to your situation! + LOCATION: Location + FACILITY: Facility + FACILITY_URL: http://localhost/ + IPV4_ADDRESS: 127.0.0.1 + IPV6_ADDRESS: ::1 + MAPS_QUERY: Amsterdam + # Uncomment to enable the custom block, which you can use to add something custom to the LG. + # ENABLE_CUSTOM_BLOCK: 'true' + # Uncomment if you require visitors to accept the Terms of Use; the value should be a link to the terms. + # LG_TERMS: http://localhost/ From 76aa8f25f68417567cb78b2af36f7b6e4beaf43c Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sun, 12 Nov 2023 11:21:02 +0100 Subject: [PATCH 5/6] Add simple installation steps for Docker to README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 41c3d21..2768168 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ made user-friendly for everyone to use. It allows you to execute network related - Root access. ### Installation +#### Manual For this installation we will assume that we are working on AlmaLinux 8 or 9. Warning: This guide does not cover any security hardening or rate limiting. Note: These steps also work with AlmaLinux 9, but it will install PHP 8 instead of 7. @@ -34,6 +35,17 @@ Note: These steps also work with AlmaLinux 9, but it will install PHP 8 instead 7. Rename config.dist.php to config.php and adjust the settings. 8. (Optional) You might want to enable SSL using LetsEncrypt, take a look at [acme.sh](https://github.com/acmesh-official/acme.sh). +#### Docker +For installation using Docker, follow these steps and run the commands on the target machine where the application should be installed: + +1. First, ensure Docker and Docker Compose are already installed. +2. Clone this GitHub repository: `git clone https://github.com/hybula/lookingglass.git`. +3. Change your current working directory to the freshly cloned repository. +4. Currently, the Docker images are not hosted on an image repository, so you'll have to build them yourself with the following command: `docker compose build`. +5. For production use, change the environment variables inside the `docker-compose.yml` file to the desired values. For testing purposes, the default values are fine. +6. Create and start the containers: `docker compose up -d`. +7. Afterward, the Looking Glass should be reachable from your web browser at `http://$your_server_ip/`! + ### Upgrading Upgrading from a previous version is easy, simply overwrite your current installation with the new files. Then update your config.php accordingly, the script will automatically check for missing variables. From b12b6ec1bf0d5403a14ffc3d06daf50df128419b Mon Sep 17 00:00:00 2001 From: evanebb <78433178+evanebb@users.noreply.github.com> Date: Sun, 12 Nov 2023 11:21:29 +0100 Subject: [PATCH 6/6] Set LG_TERMS to false in config.dist.php, add better comment --- config.dist.php | 4 ++-- docker/php-fpm/src/config.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.dist.php b/config.dist.php index fe18c9f..37a39a2 100644 --- a/config.dist.php +++ b/config.dist.php @@ -81,5 +81,5 @@ const LG_SPEEDTEST_FILES = [ '10G' => 'https://github.com/hybula/lookingglass/' ]; -// Define if you require visitors to agree with the Terms, set false to disable; -const LG_TERMS = 'https://github.com/hybula/lookingglass/'; +// Define if you require visitors to agree with the Terms of Use. The value should be a link to the terms, or false to disable it completely. +const LG_TERMS = false; diff --git a/docker/php-fpm/src/config.php b/docker/php-fpm/src/config.php index a3d366f..ea5ddce 100644 --- a/docker/php-fpm/src/config.php +++ b/docker/php-fpm/src/config.php @@ -81,5 +81,5 @@ const LG_SPEEDTEST_FILES = [ '10G' => 'https://github.com/hybula/lookingglass/' ]; -// Define if you require visitors to agree with the Terms, set false to disable; +// Define if you require visitors to agree with the Terms of Use. The value should be a link to the terms, or false to disable it completely. define('LG_TERMS', getenv('LG_TERMS') ?: false);