Skip to content

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 11 Aug 10:11
· 14 commits to main since this release
v0.1.0
8f96e00

First release. hostsctl keeps /etc/hosts entries in a YAML config and renders them into a block between markers; everything outside those markers is carried over byte for byte.

Added

  • A YAML config at ~/.config/hostsctl/config.yaml (overridable with --config or $HOSTSCTL_CONFIG) holding groups of entries. A group is enabled or disabled as a whole, and an entry maps N addresses to M hostnames, so one name on several addresses stays several lines in /etc/hosts.
  • Zone files: include attaches files next to the config, in either plain hosts syntax (.hosts, one group per file, comments preserved) or YAML (.yaml). Edits made through the CLI go back to the file the group came from, in that file's own format, and a file that did not change is not rewritten.
  • Remote blocklists: source add attaches a hosts list as a group, with rewrite_ip and an allowlist. Lists are cached under ~/.cache/hostsctl/sources/ and refreshed with source update, which honours ETag. apply reads only the cache and never touches the network, so its result does not depend on connectivity.
  • Backups: a snapshot of the target is taken before every write, including before a restore. backup list, backup restore [ID] and backup prune manage them, and settings.keep_backups bounds how many are kept.
  • check, a linter for what /etc/hosts would silently ignore: wildcards, ports and paths in a hostname, invalid addresses, an address repeated inside one entry, and a name already defined outside the managed block.
  • Safety guarantees: writes are atomic (temporary file, fsync, rename) and preserve the target's mode and owner; the result is refused unless it still contains 127.0.0.1 localhost; a legacy hosts-sync block is visible to the tool but is never removed without --drop-legacy or migrate.
  • Under sudo, the config and cache are still read from the invoking user's home directory (resolved through SUDO_USER in passwd), and files created as root are handed back to that user.
  • migrate and import to move an existing hosts-sync setup or loose *.hosts files into the config.
  • Shell completions for bash, zsh, fish, elvish and PowerShell, plus a man page.
  • A documented exit-code contract: 0 ok, 1 generic failure, 2 usage, 3 config error, 4 permission, 5 I/O, 6 network.
  • A documentation site at https://jtprogru.github.io/hostsctl/, English with a Russian locale. The command reference and the exit-code table are generated from the code, and CI fails when the committed copies drift.
  • Release archives for Linux (x86_64/aarch64, glibc and musl) and macOS (Apple silicon and Intel), each with a keyless cosign signature, a SLSA build-provenance attestation and an entry in checksums.txt. Distributed through Homebrew, crates.io, scripts/install.sh and the archives themselves.

Install

brew install jtprogru/tap/hostsctl
cargo install hostsctl --version 0.1.0
curl -fsSL https://raw.githubusercontent.com/jtprogru/hostsctl/main/scripts/install.sh | sh

Every archive carries a keyless cosign signature (.bundle) and a SLSA build
provenance attestation; checksums.txt lists the sha256 of each one.