charmed-openssh-ssh-config-interface
Usage
The ssh_config interface enables charms to provide custom OpenSSH server
configuration to a subordinate charm such as the openssh operator. A provider
- for example, like the SSSD charm that needs the SSH daemon to query an LDAP server
for user public keys - sends configuration snippets that the requirer writes
into
/etc/ssh/ssh_config.d/.
To install, add charmed-openssh-ssh-config-interface to your Python
dependencies. Then in your Python code, import as:
from charmed_openssh_ssh_config_interface import (
SSHConfigConnectedEvent,
SSHConfigData,
SSHConfigDisconnectedEvent,
SSHConfigProvider,
SSHConfigReadyEvent,
SSHConfigRequirer,
)
Direction
The ssh_config interface implements a provider/requirer pattern.
The Provider supplies custom SSH daemon configuration through the integration
application databag.
The Requirer consumes that configuration and applies it to the local SSH
daemon.
flowchart TD
Provider -- ssh_config --> Requirer
Behavior
Provider
- Emits
ssh_config_connectedwhen a requirer joins the integration. - Sets the
ssh_configkey in the application databag viaset_config_data. - Only writes data when the unit is the application leader.
- Uses
set_config_datato serialize anSSHConfigDataobject into the application databag.
Requirer
- Observes
relation_changedand emitsssh_config_readywhen the provider's application databag contains the requiredssh_configfield. - Observes
relation_brokenand emitsssh_config_disconnectedwhen the provider application departs. - Calls
get_config_datato deserialize theSSHConfigDataobject from the integration databag.
Integration data
A single field, ssh_config, is exchanged through the integration's application
databag. No data flows in the reverse direction and no Juju Secrets are used.
Example
provider:
app:
ssh_config: "AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys"
unit: {}
requirer:
app: {}
unit: {}
Examples
Provider charm
import ops
from charmed_openssh_ssh_config_interface import (
SSHConfigConnectedEvent,
SSHConfigData,
SSHConfigProvider,
)
class ExampleProviderCharm(ops.CharmBase):
"""Charm that provides SSH daemon configuration."""
def __init__(self, framework: ops.Framework) -> None:
super().__init__(framework)
self._ssh_config = SSHConfigProvider(self, "ssh-config")
framework.observe(
self._ssh_config.on.ssh_config_connected,
self._on_ssh_config_connected,
)
def _on_ssh_config_connected(self, event: SSHConfigConnectedEvent) -> None:
data = SSHConfigData(
ssh_config="AuthorizedKeysCommand /usr/bin/sss_ssh_authorizedkeys\n"
)
self._ssh_config.set_config_data(data, integration_id=event.relation.id)
Requirer charm
import ops
from charmed_openssh_ssh_config_interface import (
SSHConfigData,
SSHConfigReadyEvent,
SSHConfigRequirer,
)
class ExampleRequirerCharm(ops.CharmBase):
"""Charm that consumes SSH daemon configuration."""
def __init__(self, framework: ops.Framework) -> None:
super().__init__(framework)
self._ssh_config = SSHConfigRequirer(self, "ssh-config")
framework.observe(
self._ssh_config.on.ssh_config_ready,
self._on_ssh_config_ready,
)
def _on_ssh_config_ready(self, event: SSHConfigReadyEvent) -> None:
data = self._ssh_config.get_config_data(event.relation.id)
if data is not None:
# Write `data.ssh_config` to `/etc/ssh/ssh_config.d/` and
# reload the SSH daemon.
self.unit.status = ops.ActiveStatus()
Metadata
Release files for charmed-openssh-ssh-config-interface 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| charmed_openssh_ssh_config_interface-0.1.0.tar.gz | 8.8 kB | Without provenance | Details for charmed_openssh_ssh_config_interface-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| charmed_openssh_ssh_config_interface-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for charmed_openssh_ssh_config_interface-0.1.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / charmed_openssh_ssh_config_interface-0.1.0.tar.gz
| Download URL | charmed_openssh_ssh_config_interface-0.1.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74478f49cdf6d4ea2c417aed4ccf36aab8d0a483422b8377004be7ea7e9ab800
|
|
BLAKE2b-256 checksum How to use checksums |
b6aeab1794b31cf464cbb4597e62a5c275dea8f35c42e3a5fdff101efb15908c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / charmed_openssh_ssh_config_interface-0.1.0-py3-none-any.whl
| Download URL | charmed_openssh_ssh_config_interface-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c05626c7e73ad1151f5317a0987e65755ad1540529aa9e8451f4e407f4d6cd8
|
|
BLAKE2b-256 checksum How to use checksums |
53cd7f644d4614457d98eee11f66d0e59b25bd9d9ee3170f8de4210edf5721d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for charmed-openssh-ssh-config-interface 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.