Installation
Requirements
Section titled “Requirements”- Go 1.26 or newer. wardn supports the two most recent Go releases, matching Go’s own security-support policy.
- A database for production: PostgreSQL 13+, MySQL 8.0+, MariaDB 10.6+, SQLite 3.24+ or MongoDB 6.0+. Tests and demos can use the built-in in-memory store.
wardn is open source (Apache-2.0) and fetched through the public Go module proxy like any other module: no credentials or GOPRIVATE setting are needed. If you set GOPRIVATE=github.com/MogRex-Limited/* while it was private, you can remove it for wardn.
Packages
Section titled “Packages”wardn is split so that each product downloads only what it uses. The core has no dependencies beyond the Go standard library and a YAML parser.
| You need | Import | Install |
|---|---|---|
| The library, the in-memory store and cache, and the HTTP middleware | github.com/MogRex-Limited/wardn |
go get github.com/MogRex-Limited/wardn |
| PostgreSQL, MySQL, MariaDB or SQLite | github.com/MogRex-Limited/wardn/store/sql |
included in the core module |
PostgreSQL through pgx (pgxpool, pgx.Tx), from v1.2 |
github.com/MogRex-Limited/wardn/store/pgx |
go get github.com/MogRex-Limited/wardn/store/pgx |
| MongoDB | github.com/MogRex-Limited/wardn/store/mongo |
go get github.com/MogRex-Limited/wardn/store/mongo |
| A cache shared by several instances (Redis or Valkey) | github.com/MogRex-Limited/wardn/cache/redis |
go get github.com/MogRex-Limited/wardn/cache/redis |
| Test helpers | github.com/MogRex-Limited/wardn/wardntest |
included in the core module |
The SQL store uses Go’s standard database/sql, so you bring the driver you already use:
import _ "github.com/jackc/pgx/v5/stdlib" // or github.com/lib/pq
db, err := sql.Open("pgx", os.Getenv("DATABASE_URL"))import _ "github.com/go-sql-driver/mysql"
db, err := sql.Open("mysql", os.Getenv("DATABASE_DSN"))import _ "modernc.org/sqlite"
// A busy timeout lets concurrent writers wait instead of failing.db, err := sql.Open("sqlite", "file:app.db?_pragma=busy_timeout(5000)")wardn detects which database it is talking to from the driver.
The command-line tool
Section titled “The command-line tool”The wardn CLI validates policy files and generates Go constants from them. Add it as a tool of your module, so it always matches the library version you use:
go get -tool github.com/MogRex-Limited/wardn/cmd/wardngo tool wardn check # validate wardn.yamlgo tool wardn gen # write perm/perm.goGitHub releases also carry signed binaries for Linux, macOS and Windows, with build provenance you can verify. If the release you want has none, use go tool wardn as above. To verify a binary:
gh attestation verify wardn_vX.Y.Z_linux_amd64 --repo MogRex-Limited/wardnQuestions about this page?
Ask below, point out something wrong or unclear, or suggest an improvement. Reading needs no account; to post, sign in with GitHub.