Alternera. Plugin. Provisional. Upstream behaviour
(alternera_plugin_sdk v0.9.0)
Copy Markdown
View Source
Provisional: added for plugins that run processes of their own, and a
change to it needs a changelog line but no new major
(docs/USER_PLUGINS_DESIGN.md). The namespace has nothing to do with the
context's :provisional? key.
A plugin that serves its steps from processes of its own on this node (a pool of OS processes behind loopback ports, say) claims a host suffix, and the proxy then treats every name under it as that plugin's:
- the SSRF guard refuses the names to everyone, a client of either door, a reverse site, a Request step, a replay;
- a call the plugin makes itself (
Plugin.Provisional.Outbound.call/3with:upstream) to one of them is dialed wheredial/2says, which may be loopback, and gets the TLS optionstls/1gives instead of the tenant's verification settings.
The suffix must sit under .internal, the top-level domain reserved for
private use, so a plugin can never take a name that resolves on the public
internet. Two installed plugins may not claim the same suffix, or one that
ends with the other's: the proxy refuses to start.
The exemption belongs to the call, not to the name. A forward pipeline may
move a plugin's call to another host; that request is then an ordinary one,
checked by the guard and sent without the call's :upstream headers. And a
plugin installed in the proxy can call anything the proxy can: the guard
keeps tenants and their clients away from the plugin's processes, not the
plugin away from the network.
Summary
Callbacks
Where to dial host (a name under the suffix) on port: the addresses,
tried in order, or an error that fails the call before anything is sent
(:not_listening when nothing of the plugin's serves that name and port).
Called on every dial of one of the plugin's calls, so it reads what it
needs from memory.
The :ssl options of a TLS dial to host, verification included: the
tenant's settings and the installation's trusted roots do not apply. Without
this callback a call over https to the plugin's names fails :no_tls.
The suffix the plugin claims, with its leading dot: ".camel.internal".
Compared case-insensitively, against the name without a trailing dot.
Functions
host as the proxy compares it with a suffix: lower case, without a
trailing dot.
Whether suffix is one a plugin may claim: starts with a dot, ends with
.internal, at least one label before it, each a DNS label of letters,
digits and hyphens, all lower case.
Callbacks
@callback dial(host :: String.t(), port :: :inet.port_number()) :: {:ok, [:inet.ip_address(), ...]} | {:error, atom()}
Where to dial host (a name under the suffix) on port: the addresses,
tried in order, or an error that fails the call before anything is sent
(:not_listening when nothing of the plugin's serves that name and port).
Called on every dial of one of the plugin's calls, so it reads what it
needs from memory.
The :ssl options of a TLS dial to host, verification included: the
tenant's settings and the installation's trusted roots do not apply. Without
this callback a call over https to the plugin's names fails :no_tls.
@callback upstream_suffix() :: String.t()
The suffix the plugin claims, with its leading dot: ".camel.internal".
Compared case-insensitively, against the name without a trailing dot.
Functions
host as the proxy compares it with a suffix: lower case, without a
trailing dot.
Whether suffix is one a plugin may claim: starts with a dot, ends with
.internal, at least one label before it, each a DNS label of letters,
digits and hyphens, all lower case.