From 6f79ea28377f4c3b07385a52489bc98aaff0b942 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 8 Apr 2026 00:08:41 -0700 Subject: [PATCH 1/3] doc(CHANGELOG): add commit messages for 0.0.2 --- .release | 1 + CHANGELOG.md | 1 + package.json | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 160000 .release create mode 100644 CHANGELOG.md diff --git a/.release b/.release new file mode 160000 index 0000000..a6911a9 --- /dev/null +++ b/.release @@ -0,0 +1 @@ +Subproject commit a6911a90f1b15486fb319d844341421c78035b2a diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a53ca42 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +[0.0.2]: https://github.com/NicTool/server/releases/tag/v0.0.2 diff --git a/package.json b/package.json index 4cfd384..1d4f6c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nictool", - "version": "0.0.1", + "version": "0.0.2", "description": "NicTool, the DNS manager", "main": "index.js", "type": "module", @@ -40,11 +40,11 @@ }, "homepage": "https://github.com/NicTool/server#readme", "dependencies": { - "joi": "^18.1.1", - "@nictool/api": "^3.0.0-alpha.10", - "@nictool/dns-nameserver": "^0.7.3", + "joi": "^18.1.2", + "@nictool/api": "^3.0.0-alpha.11", + "@nictool/dns-nameserver": "^0.7.4", "@nictool/dns-resource-record": "^1.6.0", - "@nictool/dns-zone": "^1.1.7", + "@nictool/dns-zone": "^1.1.8", "smol-toml": "^1.6.1" } } From e06c33102ce2f5db93b5dea64372a63e4a0662fb Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 8 Apr 2026 00:08:43 -0700 Subject: [PATCH 2/3] doc(CONTRIBUTORS): added --- CONTRIBUTORS.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 CONTRIBUTORS.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..1b33364 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,9 @@ +# Contributors + +This handcrafted artisanal software is brought to you by: + +|
msimerson (6)| +| :---: | + +this file is generated by [.release](https://github.com/msimerson/.release). +Contribute to this project to get your GitHub profile included here. From 352a080c3938a69b2226b154a60a9f4e374f9de2 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 8 Apr 2026 00:18:10 -0700 Subject: [PATCH 3/3] add README --- .github/workflows/ci.yml | 26 ++++++ .github/workflows/publish.yml | 17 ++++ .gitignore | 1 - CHANGELOG.md | 3 + README.md | 146 ++++++++++++++++++++++++++++++++++ package.json | 7 +- 6 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7c1fbee --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + pull_request: + types: [opened, synchronize, reopened] + +env: + CI: true + +jobs: + lint: + uses: NicTool/.github/.github/workflows/lint.yml@main + permissions: + contents: read + + coverage: + uses: NicTool/.github/.github/workflows/coverage.yml@main + secrets: inherit + permissions: + contents: read + + test: + uses: NicTool/.github/.github/workflows/test.yml@main + secrets: inherit + permissions: + contents: read diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..13c2b0c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,17 @@ +name: publish + +on: + release: + types: [published] + +env: + CI: true + +jobs: + publish: + uses: NicTool/.github/.github/workflows/publish.yml@main + secrets: inherit + permissions: + contents: read + packages: write + id-token: write \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7b4837b..a359853 100644 --- a/.gitignore +++ b/.gitignore @@ -109,6 +109,5 @@ out config.yml CLAUDE.md GEMINI.md -.release/ data/ conf.d diff --git a/CHANGELOG.md b/CHANGELOG.md index a53ca42..bc40e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,4 @@ + + + [0.0.2]: https://github.com/NicTool/server/releases/tag/v0.0.2 diff --git a/README.md b/README.md index e69de29..8acf7a4 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,146 @@ +# NicTool Server + +NicTool is an open-source DNS management system. This package provides the **server** — a Node.js process that serves the web-based configurator UI, hosts the REST API (in-process or as a proxy), and manages TLS automatically. + +## Prerequisites + +- [Node.js](https://nodejs.org/) 18 or later +- `openssl` in `$PATH` (used to auto-generate self-signed TLS certs on first run) +- MySQL 8+ **or** a writable directory (for the TOML-based file store) + +## Quickstart + +### 1. Install + +```sh +npm install -g nictool +``` + +Or run without installing: + +```sh +npx nictool-server -c /var/lib/nictool +``` + +### 2. Create a data directory + +```sh +mkdir -p /var/lib/nictool +``` + +### 3. Start the server + +```sh +nictool-server -c /var/lib/nictool +``` + +On first run the server will: + +1. Generate a self-signed TLS certificate for your hostname and save it to `/var/lib/nictool/etc/tls/`. +2. Open the **web configurator** at `https://` (falls back to port `8443` if 443 is unavailable). + +### 4. Complete setup in the browser + +Open the URL printed to the console, fill in the configuration form, and click **Save**. The configurator writes `/var/lib/nictool/etc/nictool.toml` and starts the API automatically. + +> **TLS warning** – The auto-generated certificate is self-signed. Accept the browser security warning for the initial setup, then replace it with a trusted certificate (see [TLS](#tls) below). + +--- + +## Configuration + +All settings live in `/etc/nictool.toml`. The file is created by the web configurator but can also be edited by hand. The server reads it on every start. + +### Data store options + +| `store.type` | Description | +|---|---| +| `mysql` | Production-ready; requires MySQL 8+ | +| `directory` | File-based TOML store; good for development | + +#### MySQL example + +```toml +[store] +type = "mysql" +host = "127.0.0.1" +port = 3306 +user = "nictool" +password = "secret" +database = "nictool" +``` + +#### Directory (file) example + +```toml +[store] +type = "directory" +path = "/var/lib/nictool/zones" +``` + +### API mode + +The API can run **in-process** (default) or as a **remote** service: + +```toml +[api] +mode = "local" # "local" | "remote" +port = 3000 # only used for remote mode +host = "" # only used for remote mode +``` + +--- + +## TLS + +On startup the server looks for certificates in `/etc/tls/` in this order: + +1. `.pem` — combined PEM (private key + certificate chain) +2. `localhost.pem` — combined PEM, bound as `localhost` +3. `cert.pem` + `key.pem` — legacy split files + +If none are found, a self-signed certificate is generated via `openssl` and saved as `.pem`. + +To use your own certificate, place a combined PEM file at: + +``` +/etc/tls/.pem +``` + +--- + +## CLI reference + +``` +nictool-server -c + +Options: + -c, --config Path to the NicTool data root (required). +``` + +--- + +## Development + +```sh +# Install dependencies +npm install + +# Run tests +npm test + +# Run tests in watch mode +npm run watch + +# Check formatting and linting +npm run format:check + +# Auto-fix formatting and linting +npm run format +``` + +--- + +## License + +BSD-3-Clause © [Matt Simerson](https://github.com/msimerson) diff --git a/package.json b/package.json index 1d4f6c7..6a1fd66 100644 --- a/package.json +++ b/package.json @@ -46,5 +46,10 @@ "@nictool/dns-resource-record": "^1.6.0", "@nictool/dns-zone": "^1.1.8", "smol-toml": "^1.6.1" + }, + "prettier": { + "printWidth": 90, + "singleQuote": true, + "semi": false } -} +} \ No newline at end of file