From aaf65f3f36c7654fb6c7599e9d1c4efe86ae95dc Mon Sep 17 00:00:00 2001 From: stitch1 Date: Fri, 7 Feb 2025 15:07:55 +0100 Subject: [PATCH] clean up some installation details --- README.md | 8 +- .../management/commands/connect_superusers.py | 27 +++++++ docs/input/1_installation.rst | 75 ++++++++++--------- 3 files changed, 71 insertions(+), 39 deletions(-) create mode 100644 dashboard/internet_nl_dashboard/management/commands/connect_superusers.py diff --git a/README.md b/README.md index 43451ee9..c7211384 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -For quick installation: Follow [these quick instructions](https://github.com/internetstandards/Internet.nl-dashboard/blob/50/docs/render/markdown/1_installation.md) -and watch [this 6 minute video](https://github.com/internetstandards/Internet.nl-dashboard/tree/50/docs/input/internet.nl%20dashboard%20installation%20video%20small.mp4). +For quick installation: Follow [these quick instructions](https://github.com/internetstandards/Internet.nl-dashboard/blob/main/docs/render/markdown/1_installation.md) +and watch [this 6 minute video](https://github.com/internetstandards/Internet.nl-dashboard/tree/main/docs/input/internet.nl%20dashboard%20installation%20video%20small.mp4). # Internet.nl Dashboard The internet.nl dashboard allows you to visualize batch scans from the internet.nl API. It allows: @@ -18,8 +18,8 @@ The internet.nl dashboard allows you to visualize batch scans from the internet. ## Setup / installation -For quick installation: Follow [these quick instructions](https://github.com/internetstandards/Internet.nl-dashboard/blob/50/docs/render/markdown/1_installation.md) -and watch [this 6 minute video](https://github.com/internetstandards/Internet.nl-dashboard/tree/50/docs/input/internet.nl%20dashboard%20installation%20video%20small.mp4). +For quick installation: Follow [these quick instructions](https://github.com/internetstandards/Internet.nl-dashboard/blob/main/docs/render/markdown/1_installation.md) +and watch [this 6 minute video](https://github.com/internetstandards/Internet.nl-dashboard/tree/main/docs/input/internet.nl%20dashboard%20installation%20video%20small.mp4). ## Screenshots diff --git a/dashboard/internet_nl_dashboard/management/commands/connect_superusers.py b/dashboard/internet_nl_dashboard/management/commands/connect_superusers.py new file mode 100644 index 00000000..61da73e6 --- /dev/null +++ b/dashboard/internet_nl_dashboard/management/commands/connect_superusers.py @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: Apache-2.0 +import logging + +from django.core.management.base import BaseCommand +from django.contrib.auth.models import User + +from dashboard.internet_nl_dashboard.models import DashboardUser, Account + +log = logging.getLogger(__package__) + + +class Command(BaseCommand): + + def handle(self, *args, **options): + superusers = User.objects.all().filter(is_superuser=True) + + for user in superusers: + if not DashboardUser.objects.filter(user=user).first(): + DashboardUser.objects.create( + user=user, + account=Account.objects.all().first(), # should always exist + mail_preferred_language='en', + mail_send_mail_after_scan_finished=False, + mail_after_mail_unsubscribe_code='', + ) + print(f"Added DashboardUser for superuser {user}") + print("Done") diff --git a/docs/input/1_installation.rst b/docs/input/1_installation.rst index 94f889bd..7a0f060a 100644 --- a/docs/input/1_installation.rst +++ b/docs/input/1_installation.rst @@ -40,6 +40,8 @@ What do you need * Optional: a domain name and SMTP settings +On this machine you need to be running docker, orbstack or something like that. + .. rst-class:: page-break .. raw:: pdf @@ -54,7 +56,7 @@ Installation is mostly configuration work inside the dashboard. Some of the belo is released. -Running the dashboard (during development of 5.0) +Running the dashboard ------------------------------------------------- In the command shell, perform the following commands. @@ -63,32 +65,14 @@ In the command shell, perform the following commands. git clone https://github.com/internetstandards/Internet.nl-dashboard/ cd Internet.nl-dashboard - git checkout 50 docker compose up --build -After a short while your dashboard instance will be ready at :8000. - -You can start and restart the application by running ``docker compose up --build``, use control+c to stop. - - -Running the dashboard (when 5.0 is released) --------------------------------------------- -Download the version you want to run. These can be downloaded from the releases page, here: -https://github.com/internetstandards/Internet.nl-dashboard/releases - -Releases from version 5.0 and over support docker compose. You can also download a release -from the command line, with the following command: - -:: - - mkdir dashboard && cd dashboard - wget https://github.com/internetstandards/Internet.nl-dashboard/archive/refs/tags/v5.0.tar.gz - tar -zxvf v5.0.tar.gz - docker compose up --build +After a short while your dashboard instance will be ready at http://localhost:8000 -After a short while your dashboard instance will be ready at :8000. +Note that on local environments the web application will not work well with the Apple Safari browser due to +CSRF security policies that come out of the box. Please use another browser for testing purposes. -You can start and restart the application by running ``docker compose up --build``, use control+c to stop. +For production environments we recommend running a reverse proxy to this port. Examples include nginx or apache. Load up default configuration @@ -120,21 +104,14 @@ If you also want an example lists to get started, run the following command. Setting up the first user ------------------------- +After setting up the first user administration can be performed via the administrative interface. + Create a new user: ``docker exec -ti internetnl-dashboard-backend-1 dashboard createsuperuser`` - -Associate that user to the default account, assuming the createsuperuser was added with user id 1: - -``docker exec -ti internetnl-dashboard-database-1 psql --user dashboard -c "update internet_nl_dashboard_dashboarduser set account_id=1 where user_id=1;"`` - - -If you get an error that a certain user already exists, this might not be your first attempt to install the dashboard -via this method. The docker installation method shares the same database. -Make sure to associate the newly created super user also is connected to an account. This can be performed with SQL and -via the admin portal. - +Then connect the superuser to a dashboard account. Superusers can join any account through the front-end or admin interface: +``docker exec -ti internetnl-dashboard-backend-1 dashboard connect_superusers`` Logging in ---------- @@ -196,6 +173,15 @@ Use the following commands, of course with your own personal settings:: docker exec -ti internetnl-dashboard-backend-1 dashboard constance set INTERNET_NL_SCAN_TRACKING_NAME "My Dashboard Instance" +Examples of these settings for internet.nl servers are: + + - DASHBOARD_FRONTEND_URL https://dashboard.internet.nl + - INTERNET_NL_API_URL https://batch.internet.nl/api/batch/v2 + - CREDENTIAL_CHECK_URL https://batch.internet.nl/api/batch/v2/requests + - INTERNET_NL_SCAN_TRACKING_NAME "My Internet.nl Dashboard" + - EMAIL_DASHBOARD_ADDRESS https://dashboard.internet.nl + + 4. Setup the API credentials for the account. 1. Go to the account management page @@ -221,6 +207,7 @@ You are now set to perform your first scan. PageBreak + Performing your first scan ========================== @@ -272,7 +259,8 @@ Advanced configuration Setting up e-mail notification after scanning --------------------------------------------- -After a scan completes it's possible to receive an e-mail. An SMTP server has to be configured. +After a scan completes it's possible to receive an e-mail. An SMTP server has to be configured in the admin interface, +here: http://localhost:8000/admin/django_mail_admin/outbox/ 1. Visit the admin interface on ``/admin/`` and log in. @@ -289,6 +277,23 @@ templates is English and several templates are pre-installed to be customized. F check the :ref:`email templates` chapter. + +Setting up subdomain suggestions +-------------------------------- + +It's possible to use subdomain suggestions when managing lists of urls. The exact instructions for running and installing +this feature are to be documented. + +In the admin interface on http://localhost:8000/admin/constance/config/ you will find the possibility to use subdomain +suggestions via a separate installation of the CTLSSA tool. + +The CTLSSA tool can be found here and run via docker: +https://github.com/internetstandards/Internet.nl-ct-log-subdomain-suggestions-api/ + +In the internet.nl dashboard settings, point the SUBDOMAIN_SUGGESTION_SERVER_ADDRESS setting to the CTLSSA instance. + + + .. rst-class:: page-break .. raw:: pdf