NAME

PowerDNS::API::ACL::Proxy - A PSGI application that passes allowed requests on to the PowerDNS API

VERSION

version 0.001

SYNOPSIS

# app.psgi
use PowerDNS::API::ACL::Proxy;

PowerDNS::API::ACL::Proxy->new(
    db       => '/var/lib/pdns-acl/acl.db',
    upstream => '/var/spool/powerdns/api.sock',
    api_key  => $ENV{PDNS_API_KEY},
)->to_app;

DESCRIPTION

Checks each request against PowerDNS::API::ACL, and passes an allowed request on to PowerDNS with the real API key in place of the token of the client. A client presents its token as PowerDNS expects a key, in the X-API-Key header, so a client of PowerDNS needs no change but the URL and the key.

A refused request gets the status that authorize in PowerDNS::API::ACL chose, and a body in the form that PowerDNS gives an error, {"error": "..."}.

Serve it with any PSGI server, behind a web server that terminates TLS. The token travels in a header, so it must not travel in the clear.

METHODS

new(%opts)

db

The path of the database of PowerDNS::API::ACL::Store. Or pass store, an object that answers as the store does.

upstream

Where the PowerDNS API listens: a path to its unix socket, as webserver-address names it from PowerDNS 5.0, or a URL such as http://127.0.0.1:8081.

api_key

The key of the PowerDNS API. It never leaves this process except toward upstream.

timeout

Seconds to wait for PowerDNS. The default is 10.

to_app()

Returns the PSGI application.

handle($request)

Answers one Plack::Request, and returns the PSGI response.

error($status, $message)

Returns a PSGI response with $status and a body as PowerDNS writes an error. A class method, and a function.

SEE ALSO

Please see those modules/websites for more information related to this module.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/Troglodyne-Internet-Widgets/perl-powerdns-api-acl/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHORS

Current Maintainers:

  • George S. Baugh <george@troglodyne.net>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Troglodyne LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.