Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,5 @@ out
config.yml
CLAUDE.md
GEMINI.md
.release/
data/
conf.d
1 change: 1 addition & 0 deletions .release
Submodule .release added at a6911a
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@



[0.0.2]: https://github.com/NicTool/server/releases/tag/v0.0.2
9 changes: 9 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributors

This handcrafted artisanal software is brought to you by:

| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/NicTool/server/commits?author=msimerson">6</a>)|
| :---: |

<sub>this file is generated by [.release](https://github.com/msimerson/.release).
Contribute to this project to get your GitHub profile included here.</sub>
146 changes: 146 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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://<hostname>` (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 `<config-dir>/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 `<config-dir>/etc/tls/` in this order:

1. `<hostname>.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 `<hostname>.pem`.

To use your own certificate, place a combined PEM file at:

```
<config-dir>/etc/tls/<hostname>.pem
```

---

## CLI reference

```
nictool-server -c <config-dir>

Options:
-c, --config <dir> 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)
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nictool",
"version": "0.0.1",
"version": "0.0.2",
"description": "NicTool, the DNS manager",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -40,11 +40,16 @@
},
"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"
},
"prettier": {
"printWidth": 90,
"singleQuote": true,
"semi": false
}
}
}
Loading