$OpenBSD: README,v 1.2 2020/02/28 07:45:04 remi Exp $

+-----------------------------------------------------------------------
| Running netshot on OpenBSD
+-----------------------------------------------------------------------

Netshot requires a database which might be on the same server as Netshot
or remote. It supports PostgreSQL and MySQL/MariaDB. Below example uses
MariaDB on the same host.

- Install the package mariadb-server.
  See /usr/local/share/doc/pkg-readmes/mariadb-server for the first
  steps after the installation.

- Create a database and a database user (change the password!):
  $ mysql -u root
  > CREATE DATABASE netshot01 CHARACTER SET utf8
    DEFAULT COLLATE utf8_general_ci;
  > GRANT ALL PRIVILEGES ON netshot01.*
    TO 'netshot'@'localhost' IDENTIFIED BY 'password';
  > quit

- Check the database connection config in /etc/netshot.conf.
  Should netshot not start but log "The server time zone value 'CEST' is
  unreconized or represents more than one time zone" the connect string
  might be modified to look like this:
  netshot.db.url = jdbc:mysql://localhost/netshot01?serverTimezone=UTC

- Create a key and self-signed X509 certificate; alternatively you may
  use a CA-signed certificate, possibly from acme-client(1).
  # openssl req -new -x509 -days 825 \
    -subj '/CN=netshot.example.com' \
    -addext 'subjectAltName = DNS:netshot.example.com' \
    -keyout /etc/ssl/private/netshot.key \
    -out /etc/ssl/netshot.crt

- Export to PKCS#12 format for use with Java.
  # openssl pkcs12 -export -name netshot \
    -in /etc/ssl/netshot.crt \
    -inkey /etc/ssl/private/netshot.key \
    -out /etc/netshot.pfx
  # chmod 640 /etc/netshot.pfx
  # chgrp _netshot /etc/netshot.pfx

- Enable and start Netshot to create the database tables.
  # rcctl enable netshot; rcctl start netshot

- Add an initial application user to the database:
  $ mysql -u root
  > USE netshot01;
  > INSERT INTO user (level, local, username, hashed_password)
    VALUES (1000, 1, 'netshot', '7htrot2BNjUV/g57h/HJ/C1N0Fqrj+QQ');

- Access Netshot with a browser on https://localhost:8443.
  (username 'netshot' with password 'netshot')
