Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

namefi

The command-line interface for Namefi: sign in, list the domains in your account, and keep DNS records pointed at a machine whose public address changes (dynamic DNS).

The dynamic DNS daemon reacts to OS network events rather than polling, so a new address is published within seconds of the link changing, and an unchanged address costs zero API calls.

Source of truth: the CLI is developed in d3servelabs/namefi-astra under projects/namefi-dyndns. This repository exists to publish the built binaries and the installers. Open issues and pull requests against namefi-astra.

Install

macOS / Linux

curl -fsSL https://github.com/raw/d3servelabs/namefi-cli/main/install.sh | sh

The script detects your OS and CPU, downloads the matching release asset, verifies its SHA-256 against checksums.txt, and installs to /usr/local/bin (or ~/.local/bin when that is not writable). It prints everything it is about to do and is safe to re-run.

Variable Effect
NAMEFI_CLI_VERSION Pin a release, e.g. v0.1.0. Default: latest.
NAMEFI_INSTALL_DIR Install somewhere else, e.g. ~/bin.
NAMEFI_CLI_VERSION=v0.1.0 NAMEFI_INSTALL_DIR="$HOME/bin" sh install.sh

Windows

PowerShell (recommended):

irm https://raw.githubusercontent.com/d3servelabs/namefi-cli/main/install.ps1 | iex

Or download install.bat and double-click it; it delegates to install.ps1. Both install to %LOCALAPPDATA%\Programs\namefi, add that directory to your user PATH, and verify the checksum. Open a new terminal afterwards so the PATH change takes effect.

go install

go install github.com/d3servelabs/namefi-astra/projects/namefi-dyndns/cmd/namefi@latest

go install builds without version stamping, so namefi --version reports dev.

Manual download

Grab an archive from Releases, verify it, extract it, and put namefi on your PATH:

curl -fsSLO https://github.com/d3servelabs/namefi-cli/releases/download/cli-v0.1.0/namefi_v0.1.0_linux_amd64.tar.gz
curl -fsSLO https://github.com/d3servelabs/namefi-cli/releases/download/cli-v0.1.0/checksums.txt
sha256sum -c checksums.txt --ignore-missing
tar -xzf namefi_v0.1.0_linux_amd64.tar.gz
sudo install -m 755 namefi /usr/local/bin/namefi

Assets are named namefi_<version>_<os>_<arch>.tar.gz (.zip on Windows) for darwin/amd64, darwin/arm64, linux/amd64, linux/arm64, windows/amd64, and windows/arm64.

Quickstart

namefi login                       # browser sign-in; the session renews itself
namefi status                      # which credential is active, and why
namefi domains list                # your portfolio

# Dynamic DNS for one hostname, using a scoped credential from the dashboard
# (Domain settings -> Dynamic DNS):
namefi dyndns creds set --username ddns_… --scope home.example.com
namefi dyndns check                # resolve + diff, writes nothing
namefi dyndns run                  # daemon: publish on every address change

Credentials and precedence

Three credential sources, in the order they win:

  1. Scoped dynamic DNS credential — a username/secret pair created in the Namefi dashboard, stored in your OS keyring by namefi dyndns creds set, or supplied as NAMEFI_DYNDNS_USERNAME / NAMEFI_DYNDNS_SECRET for containers and services. Never expires, limited to one hostname pattern. This is the right credential for a daemon.
  2. Account API key — NAMEFI_API_KEY, environment only by design, never written to disk. Full account access, survives restarts, needs no browser.
  3. Stored login — namefi login puts an account session in the keyring.

Whichever wins is printed at startup, e.g. credential: scoped dyndns (keyring) — home.example.com. Run namefi status to see it at any time.

Account logins are sessions, not durable credentials. namefi login (browser, RFC 8252 loopback + PKCE) also receives a rotating refresh token, so the CLI renews the ~12h access token on its own. namefi login --device — the headless fallback — receives no refresh token, so that session simply ends at expiry. Running namefi dyndns run on any account login prints a warning telling you when the session ends and recommending a scoped credential or NAMEFI_API_KEY instead.

namefi domains list reads account data, so it requires an account credential (API key or login); a scoped dynamic DNS credential cannot see your portfolio.

Scope

The server is always the authority, but the CLI fails fast locally when the configured scope clearly excludes the hostname:

Scope Matches
home.example.com that exact hostname
*.example.com any single-label descendant
example.com zone-wide: the apex or any descendant

Command reference

Command What it does
namefi login Browser sign-in on this machine; the session auto-renews.
namefi login --device Headless sign-in: open the printed URL elsewhere. No auto-renewal.
namefi logout Remove the stored session from the keyring.
namefi status Show which credential is active and where it came from.
namefi domains list List the account's domains. --long, --json, --names-only, --search, --expiring-in 720h, --ns namefi|external, --parked, --sort name|expiry.
namefi dyndns run Daemon: publish on network events, with a fallback poll.
namefi dyndns update One-shot: resolve current addresses, push, exit.
namefi dyndns check Resolve and diff against the push cache. Writes nothing.
namefi dyndns creds set Store a scoped credential. --username, --scope.
namefi dyndns creds show Inspect the stored credential (never prints the secret).
namefi dyndns creds clear Delete the stored credential.
namefi --version Print the stamped version.

Flags shared by the dyndns commands: --hostname, --ipv4 / --ipv6 (both on by default), --zone, --ttl, --update-host, --state-file, --map. run adds --settle (default 7s) and --poll-interval (default 5m). Configuration layers flags → environment → file.

Running the daemon

namefi dyndns run                       # both address families
namefi dyndns run --ipv6=false          # IPv4 only
namefi dyndns run --verbose             # log the event stream
  • Pushes immediately at startup, then reacts to link-change events, debounced by --settle.
  • A fallback poll every --poll-interval catches upstream/CGNAT changes that produce no local event.
  • The push cache lives at ~/.config/namefi/dyndns-state.json and is written only after a confirmed success, so a failed push retries on the next tick.
  • IPv4 and IPv6 are independent tracks. A missing family is a no-op, never a delete: an IPv6 outage will not clear your AAAA record.
  • Transient failures retry with jittered exponential backoff. Auth, scope, and config errors are terminal so a supervisor can tell "retry" from "give up".
  • SIGINT / SIGTERM shut down cleanly. Credential material is never logged.

Port forwarding with --map

For a machine behind a home router, --map asks the gateway to forward ports over the LAN — no router login required:

namefi dyndns run --map 443/tcp --map 22/tcp   # external port = internal port
namefi dyndns run --map 8443:443/tcp           # external 8443 -> internal 443
namefi dyndns check --map 443/tcp              # diagnose without writing
  • Protocol chain: PCP → NAT-PMP → UPnP IGD, first success wins.
  • Mappings are leases: renewed at half-lifetime, re-established after link changes (a router reboot wipes its table), released on clean shutdown.
  • Publishing is reachability-gated. With --map set, the A record is only published while every mapping is granted — publishing a router address that drops the traffic would be wrong. A blocked IPv4 prints withheld: …; IPv6 is not gated because it has no NAT.
  • check --map … reports the gateway, the protocol that worked, the granted lease, and names CGNAT plainly instead of failing mysteriously.

Install as a service

Example unit files live in the source repository:

Use a scoped dynamic DNS credential or NAMEFI_API_KEY for a service; an account login will expire under it.

Exit codes

Code Meaning
0 Success.
1 Transient or unexpected failure — retrying later may work.
2 Configuration error — the invocation or config file is wrong.
3 Authentication error — sign in again or fix the credential.
4 Scope violation — the credential may not update that hostname.

Codes 2, 3, and 4 are terminal: a supervisor should not restart on them.

Source and releases

Source, design notes, and issue tracking: namefi-astra/projects/namefi-dyndns. Releases and installers are published here by the CLI Release workflow in that repository.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages