From 3b6497cd51f055333b17b869a85a827be6c77c4f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 13 Feb 2022 15:39:37 +0100 Subject: [PATCH] outposts: ensure keypair is set for SSH connections Signed-off-by: Jens Langhammer --- authentik/outposts/docker_ssh.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/authentik/outposts/docker_ssh.py b/authentik/outposts/docker_ssh.py index 46d9f6ebb..929f55e34 100644 --- a/authentik/outposts/docker_ssh.py +++ b/authentik/outposts/docker_ssh.py @@ -3,6 +3,8 @@ import os from pathlib import Path from tempfile import gettempdir +from docker.errors import DockerException + from authentik.crypto.models import CertificateKeyPair HEADER = "### Managed by authentik" @@ -27,6 +29,8 @@ class DockerInlineSSH: def __init__(self, host: str, keypair: CertificateKeyPair) -> None: self.host = host self.keypair = keypair + if not self.keypair: + raise DockerException("keypair must be set for SSH connections") self.config_path = Path("~/.ssh/config").expanduser() self.header = f"{HEADER} - {self.host}\n"