class DnssecKeyService (View source)

Lists, adds, activates, deactivates and removes the DNSSEC keys of a zone the one way the web key pages and the API agree on: validate a new key against what the server offers, refuse changes when PowerDNS cannot be asked, has DNSSEC off or the zone is presigned, and audit what changed.

Constants

private MAX_PRIVATE_KEY_BYTES

Generous upper bound for an ISC private key; an RSA-4096 key is about 3.3 KB

Methods

listKeys(string $zoneName)

No description

findKey(string $zoneName, int $keyId)

No description

validateNewKey(string $type, string $algorithm, int|null $bits, PdnsCapabilities|null $capabilities)

Check a new key's type, algorithm and size, in that order, without asking PowerDNS.

addKey(int $zoneId, string $zoneName, string $type, string $algorithm, int $bits, bool $active, PdnsCapabilities|null $capabilities)

No description

static bool
isIscPrivateKey(string $privateKey)

Check that a private key looks like the ISC/BIND format PowerDNS imports ("Private-key-format: v1.x" and an "Algorithm:" line), without asking PowerDNS. PEM keys are refused: the PowerDNS HTTP API does not take them.

importKey(int $zoneId, string $zoneName, string $type, string $privateKey, bool $active, PdnsCapabilities|null $capabilities = null)

Import a key from an existing ISC/BIND private key. PowerDNS derives the algorithm and size from the key; the created key carries them. The key's algorithm must be one offered for new keys.

setKeyActive(int $zoneId, string $zoneName, int $keyId, bool $active)

No description

toggleKey(int $zoneId, string $zoneName, int $keyId)

Activate an inactive key or deactivate an active one; the result's key tells which.

removeKey(int $zoneId, string $zoneName, int $keyId)

No description

Details

DnssecKeyResult listKeys(string $zoneName)

No description

Parameters

string $zoneName

Return Value

DnssecKeyResult

DnssecKeyResult findKey(string $zoneName, int $keyId)

No description

Parameters

string $zoneName
int $keyId

Return Value

DnssecKeyResult

DnssecKeyResult|null validateNewKey(string $type, string $algorithm, int|null $bits, PdnsCapabilities|null $capabilities)

Check a new key's type, algorithm and size, in that order, without asking PowerDNS.

Parameters

string $type
string $algorithm
int|null $bits

Null when the caller could not read a number

PdnsCapabilities|null $capabilities

The connected server, which decides the algorithms offered

Return Value

DnssecKeyResult|null

The refusal, or null when the key may be added

DnssecKeyResult addKey(int $zoneId, string $zoneName, string $type, string $algorithm, int $bits, bool $active, PdnsCapabilities|null $capabilities)

No description

Parameters

int $zoneId
string $zoneName
string $type
string $algorithm
int $bits
bool $active
PdnsCapabilities|null $capabilities

Return Value

DnssecKeyResult

static bool isIscPrivateKey(string $privateKey)

Check that a private key looks like the ISC/BIND format PowerDNS imports ("Private-key-format: v1.x" and an "Algorithm:" line), without asking PowerDNS. PEM keys are refused: the PowerDNS HTTP API does not take them.

Parameters

string $privateKey

Return Value

bool

DnssecKeyResult importKey(int $zoneId, string $zoneName, string $type, string $privateKey, bool $active, PdnsCapabilities|null $capabilities = null)

Import a key from an existing ISC/BIND private key. PowerDNS derives the algorithm and size from the key; the created key carries them. The key's algorithm must be one offered for new keys.

The private key is only passed on to PowerDNS: it is not audited, logged or part of the result.

Parameters

int $zoneId
string $zoneName
string $type
string $privateKey
bool $active
PdnsCapabilities|null $capabilities

The connected server, which decides the algorithms accepted

Return Value

DnssecKeyResult

DnssecKeyResult setKeyActive(int $zoneId, string $zoneName, int $keyId, bool $active)

No description

Parameters

int $zoneId
string $zoneName
int $keyId
bool $active

Return Value

DnssecKeyResult

DnssecKeyResult toggleKey(int $zoneId, string $zoneName, int $keyId)

Activate an inactive key or deactivate an active one; the result's key tells which.

Parameters

int $zoneId
string $zoneName
int $keyId

Return Value

DnssecKeyResult

DnssecKeyResult removeKey(int $zoneId, string $zoneName, int $keyId)

No description

Parameters

int $zoneId
string $zoneName
int $keyId

Return Value

DnssecKeyResult