kasapi-cli

module
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: BSD-3-Clause

README

kasapi-cli logo

kasapi-cli

[!IMPORTANT] An independent open-source KAS-API CLI written in Go that communicates with the KAS-API from All-Inkl.com. Not affiliated with All-Inkl.com.

Disclaimer

[!IMPORTANT] This tool interacts with the KAS API and can modify domains, DNS records, and other account-related settings.

Use this software at your own risk.

The author assumes no liability for any damage, data loss, service disruption, or misconfiguration caused by the use of this tool, to the extent permitted by applicable law.

Always verify commands and test changes in a safe environment before applying them to production systems.

This project is not affiliated with or endorsed by All-Inkl.com.

Status

Early development. The transport, authentication, configuration, and several read modules are wired up; many write paths and the remaining read endpoints are still pending — see ROADMAP.md for the current state. The repository also ships recorded KAS-API response fixtures under testdata/ that drive offline parser tests.

CI gates gofmt/go vet/golangci-lint (with gosec)/go test/go test -race/go build, plus a govulncheck job on every PR. Dependabot keeps gomod and github-actions versions current.

What it does

kasapi-cli is a command-line client for the All-Inkl KAS-API. It wraps the SOAP/ns2:Map wire format the API uses, handles the KasAuth credential-token flow (plain or session, optional 2FA), enforces the KasFloodDelay between calls, and exposes read and write operations for the resources documented at https://kasapi.kasserver.com/dokumentation/phpdoc/.

Install

Pre-built binaries, deb and rpm packages, and tar.gz / zip archives for Linux and Windows (amd64 + arm64) are published on the Releases page. Each artefact ships with a cosign keyless signature (*.sig + *.pem); verify with:

cosign verify-blob \
  --certificate kasapi-cli_<ver>_linux_amd64.tar.gz.pem \
  --signature  kasapi-cli_<ver>_linux_amd64.tar.gz.sig \
  --certificate-identity-regexp 'https://github.com/chmmou/kasapi-cli/.*' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  kasapi-cli_<ver>_linux_amd64.tar.gz

SHA256SUMS (and its signature) covers every artefact in the release.

Building from source

go build ./cmd/kasapi-cli
go test ./...

Configuration

kasapi-cli resolves credentials in this precedence (highest first):

  1. --login, --auth-data, --auth-type flags on the command,
  2. environment variables KAS_LOGIN, KAS_AUTHDATA, KAS_AUTHTYPE,
  3. the active profile from the config file (--profile <name> if given, otherwise default_profile).

Each field is resolved independently, so a flag can override a single profile field without re-specifying the whole profile.

Config file

Default location (Linux): $XDG_CONFIG_HOME/kasapi-cli/config.toml, falling back to $HOME/.config/kasapi-cli/config.toml. macOS and Windows use the equivalent OS-specific config dir. Override with --config <path>.

The file is TOML; profiles live under [profiles.<name>]. auth_type accepts plain or session.

# ~/.config/kasapi-cli/config.toml
default_profile = "main"

[profiles.main]
# session: bootstrap a credential token via KasAuth and reuse it for the
# call sequence. Required for 2FA. Recommended for interactive use.
login     = "w0000000"
auth_data = "your-account-password"
auth_type = "session"

[profiles.scripted]
# plain: send the password on every KasApi call. No KasAuth round-trip,
# but no 2FA support either. Useful for one-shot scripted calls.
login     = "w0000001"
auth_data = "service-account-password"
auth_type = "plain"

Pick a non-default profile with --profile <name>:

kasapi-cli --profile scripted accounts list
Environment variables

Useful for CI, sandboxes, and direnv-style per-directory overrides:

Variable Maps to Notes
KAS_LOGIN login KAS account login (w<digits>).
KAS_AUTHDATA auth_data Password or pre-issued session token.
KAS_AUTHTYPE auth_type plain or session.

Env vars are consulted only when the matching flag is unset; they override the profile file.

Quick start

The read surface that exists today covers accounts, server info, domains/subdomains/TLDs, DNS, mail, databases, FTP/Samba users, cronjobs, directory protection, software installs, DDNS users, and usage statistics. A few representative commands:

# All accounts visible to the login.
kasapi-cli accounts list

# A single account by login.
kasapi-cli accounts get w0000001

# Quota counters for the authenticated account.
kasapi-cli accounts resources

# Server / hosting information for the account.
kasapi-cli server info

Output formats are selected with --output / -o; the default is human-readable. JSON is available everywhere:

kasapi-cli accounts list -o json
kasapi-cli accounts list -o table

For the full subcommand tree run kasapi-cli --help (or <subcommand> --help). Per-resource usage pages with realistic invocations and output samples live under docs/usage/, and the auto-generated Markdown flag reference (regenerated by make docs from the live command tree) lives under docs/cli/.

Troubleshooting

KasFloodDelay (rate limiting)

Every successful KAS-API response carries a server-side KasFloodDelay (typically 0.5 s); the next call from the same login must wait at least that long. kasapi-cli honours it transparently — the second of two back-to-back calls will appear to hang for ~500 ms. There is also a server-side flood_protection fault that carries no delay value; if you see it repeatedly, slow down the caller (e.g. add a sleep in scripts).

no_auth / unknown_session / kas_session_invalid

These three faults all mean "your credential token is no longer valid" — typically because the session expired, the server was restarted, or another tool invalidated the token. With auth_type=session, kasapi-cli invalidates its cached token and retries the call once with fresh credentials, so the user-visible result is just a slightly slower response. If the retry also fails the original fault is returned as a typed error and the command exits non-zero.

If you see no_auth with auth_type=plain, the password in auth_data is wrong — there is no token cache to invalidate, and the call will not be retried.

--verbose

--verbose / -v enables logging on stderr, including the resolved credentials (with auth_data redacted) and the SOAP action being called. Use it to confirm which profile / env var / flag combination actually took effect.

Contributing

See CONTRIBUTING.md for the repository layout, setup, coding conventions, the vertical-slice pattern used per KAS endpoint, the commit/PR workflow (incl. signed commits and the FF-push merge model required by main's branch protection), and the code-review loop.

Roadmap

The current state of the KAS-API surface — implemented vs. pending — is tracked in ROADMAP.md.

License

BSD 3-Clause — see LICENSE.

Directories

Path Synopsis
cmd
kasapi-cli command
Command kasapi-cli is the All-Inkl KAS API command-line client.
Command kasapi-cli is the All-Inkl KAS API command-line client.
internal
account
Package account holds the domain types and use cases for the KAS account endpoints (get_accounts, get_accountsettings, get_accountresources, add_account, update_account, delete_account, update_accountsettings, update_superusersettings).
Package account holds the domain types and use cases for the KAS account endpoints (get_accounts, get_accountsettings, get_accountresources, add_account, update_account, delete_account, update_accountsettings, update_superusersettings).
api
Package api is the generic KasApi.php call surface that all per-resource modules build on.
Package api is the generic KasApi.php call surface that all per-resource modules build on.
auth
Package auth implements the KasAuth.php credential-token flow.
Package auth implements the KasAuth.php credential-token flow.
chown
Package chown holds the domain types and use cases for the KAS chown endpoint (update_chown).
Package chown holds the domain types and use cases for the KAS chown endpoint (update_chown).
cli
Package cli holds the kasapi-cli root command, global flags, and the shared output renderers (json / yaml / table).
Package cli holds the kasapi-cli root command, global flags, and the shared output renderers (json / yaml / table).
config
Package config loads KAS credentials and CLI defaults from a TOML file (XDG path), environment variables, and command-line flags, and resolves the effective values for a single API call.
Package config loads KAS credentials and CLI defaults from a TOML file (XDG path), environment variables, and command-line flags, and resolves the effective values for a single API call.
cronjob
Package cronjob holds the domain types and use cases for the KAS cronjob endpoints (get_cronjobs, get_cronjob, add_cronjob, update_cronjob, delete_cronjob).
Package cronjob holds the domain types and use cases for the KAS cronjob endpoints (get_cronjobs, get_cronjob, add_cronjob, update_cronjob, delete_cronjob).
database
Package database holds the domain types and use cases for the KAS database endpoints (get_databases, get_database, add_database, update_database, delete_database).
Package database holds the domain types and use cases for the KAS database endpoints (get_databases, get_database, add_database, update_database, delete_database).
ddns
Package ddns holds the domain types and use cases for the KAS DynDNS endpoints (get_ddnsusers, add_ddnsuser, update_ddnsuser, delete_ddnsuser).
Package ddns holds the domain types and use cases for the KAS DynDNS endpoints (get_ddnsusers, add_ddnsuser, update_ddnsuser, delete_ddnsuser).
directoryprotection
Package directoryprotection holds the domain types and use cases for the KAS directory-protection endpoints (get_directoryprotections, get_directoryprotection, add_directoryprotection, update_directoryprotection, delete_directoryprotection).
Package directoryprotection holds the domain types and use cases for the KAS directory-protection endpoints (get_directoryprotections, get_directoryprotection, add_directoryprotection, update_directoryprotection, delete_directoryprotection).
dns
Package dns holds the domain types and use cases for the KAS DNS endpoints (get_dns_settings, add_dns_settings, update_dns_settings, delete_dns_settings, reset_dns_settings).
Package dns holds the domain types and use cases for the KAS DNS endpoints (get_dns_settings, add_dns_settings, update_dns_settings, delete_dns_settings, reset_dns_settings).
domain
Package domain holds the domain types and use cases for the KAS domain endpoints (get_domains, get_domain, get_topleveldomains, add_domain, update_domain, delete_domain, move_domain).
Package domain holds the domain types and use cases for the KAS domain endpoints (get_domains, get_domain, get_topleveldomains, add_domain, update_domain, delete_domain, move_domain).
ftpuser
Package ftpuser holds the domain types and use cases for the KAS FTP-user endpoints (get_ftpusers, get_ftpuser, add_ftpuser, update_ftpuser, delete_ftpuser).
Package ftpuser holds the domain types and use cases for the KAS FTP-user endpoints (get_ftpusers, get_ftpuser, add_ftpuser, update_ftpuser, delete_ftpuser).
kasread
Package kasread provides shared scaffolding for the read endpoints of the KAS API.
Package kasread provides shared scaffolding for the read endpoints of the KAS API.
mailaccount
Package mailaccount holds the domain types and use cases for the KAS mail-account endpoints (get_mailaccounts, get_mailaccount, add_mailaccount, update_mailaccount, delete_mailaccount).
Package mailaccount holds the domain types and use cases for the KAS mail-account endpoints (get_mailaccounts, get_mailaccount, add_mailaccount, update_mailaccount, delete_mailaccount).
mailfilter
Package mailfilter holds the domain types and use cases for the KAS mail-standard-filter endpoints (get_mailstandardfilter, add_mailstandardfilter, delete_mailstandardfilter).
Package mailfilter holds the domain types and use cases for the KAS mail-standard-filter endpoints (get_mailstandardfilter, add_mailstandardfilter, delete_mailstandardfilter).
mailforward
Package mailforward holds the domain types and use cases for the KAS mail-forward endpoints (get_mailforwards, get_mailforward, add_mailforward, update_mailforward, delete_mailforward).
Package mailforward holds the domain types and use cases for the KAS mail-forward endpoints (get_mailforwards, get_mailforward, add_mailforward, update_mailforward, delete_mailforward).
mailinglist
Package mailinglist holds the domain types and use cases for the KAS mailinglist endpoints (get_mailinglists in list and singular form, add_mailinglist, update_mailinglist, delete_mailinglist).
Package mailinglist holds the domain types and use cases for the KAS mailinglist endpoints (get_mailinglists in list and singular form, add_mailinglist, update_mailinglist, delete_mailinglist).
sambauser
Package sambauser holds the domain types and use cases for the KAS samba-user endpoints (get_sambausers, add_sambauser, update_sambauser, delete_sambauser).
Package sambauser holds the domain types and use cases for the KAS samba-user endpoints (get_sambausers, add_sambauser, update_sambauser, delete_sambauser).
server
Package server holds the domain types and use cases for the KAS server information endpoint (get_server_information).
Package server holds the domain types and use cases for the KAS server information endpoint (get_server_information).
session
Package session holds the domain types and use cases for the KAS session endpoints (add_session, delete_session) used by the session-mode auth flow.
Package session holds the domain types and use cases for the KAS session endpoints (add_session, delete_session) used by the session-mode auth flow.
soap
Package soap implements the codec for the KAS-API SOAP shape.
Package soap implements the codec for the KAS-API SOAP shape.
softwareinstall
Package softwareinstall holds the domain types and use cases for the KAS software-install endpoints (get_softwareinstalls, get_softwareinstall, add_softwareinstall).
Package softwareinstall holds the domain types and use cases for the KAS software-install endpoints (get_softwareinstalls, get_softwareinstall, add_softwareinstall).
ssl
Package ssl holds the domain types and use cases for the KAS SSL endpoint (update_ssl).
Package ssl holds the domain types and use cases for the KAS SSL endpoint (update_ssl).
subdomain
Package subdomain holds the domain types and use cases for the KAS subdomain endpoints (get_subdomains, add_subdomain, update_subdomain, delete_subdomain, move_subdomain).
Package subdomain holds the domain types and use cases for the KAS subdomain endpoints (get_subdomains, add_subdomain, update_subdomain, delete_subdomain, move_subdomain).
symlink
Package symlink holds the domain types and use cases for the KAS symlink endpoint (add_symlink).
Package symlink holds the domain types and use cases for the KAS symlink endpoint (add_symlink).
tablefmt
Package tablefmt holds presentation-shaped constants and helpers shared across the read-domain modules.
Package tablefmt holds presentation-shaped constants and helpers shared across the read-domain modules.
testutil
Package testutil provides shared helpers used by tests across the internal/ packages: repository-root discovery, SOAP fixture loading, and a fake Caller stub for module Client tests.
Package testutil provides shared helpers used by tests across the internal/ packages: repository-root discovery, SOAP fixture loading, and a fake Caller stub for module Client tests.
transport
Package transport provides the HTTP client that posts SOAP envelopes to a KAS endpoint.
Package transport provides the HTTP client that posts SOAP envelopes to a KAS endpoint.
usage
Package usage holds the domain types and use cases for the KAS space/traffic endpoints (get_space, get_space_usage, get_traffic).
Package usage holds the domain types and use cases for the KAS space/traffic endpoints (get_space, get_space_usage, get_traffic).
version
Package version exposes build-time version information for kasapi-cli.
Package version exposes build-time version information for kasapi-cli.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL