Validate SSH on fresh hosts and make Roundcube readable

This commit is contained in:
parkel committed 2026-12-01 15:01:45 +01:00
1 parent 3457c3c1a1
commit 8c9e2b35c1
3 files changed
+21 -3

No files matched your search

+11 -3
View File
@@ -201,7 +201,13 @@ def prepare_sftp(assets, command):
if not SSHD.is_file():
raise ValueError("Install OpenSSH Server before enabling SFTP.")
command(str(SSHD), "-t")
require_root_directory(Path("/run/sshd"), create_mode=0o755)
try:
command(str(SSHD), "-t")
except ValueError:
raise ValueError(
"The existing OpenSSH configuration failed sshd -t."
) from None
require_root_directory(AUTHORIZED_KEYS, create_mode=0o755)
create_service_identity(SFTP_GROUP, "", command)
created = not os.path.lexists(SFTP_SSHD_CONFIG)
@@ -219,10 +225,12 @@ def prepare_sftp(assets, command):
command(str(SSHD), "-t")
if active("ssh.service"):
command(SYSTEMCTL, "reload", "ssh.service")
except (OSError, ValueError):
except (OSError, ValueError) as error:
if created:
SFTP_SSHD_CONFIG.unlink()
raise
raise ValueError(
"Could not validate or reload the Coulobre OpenSSH configuration."
) from error
def check_folder_sftp_filesystem():
+3
View File
@@ -331,6 +331,9 @@ def unpack_roundcube(command):
):
raise ValueError("Roundcube has an unexpected archive layout.")
source.extractall(staging, members=files, filter="data")
for member in files:
if member.isdir():
(staging / member.name).chmod(0o755)
app = staging / root
write_new_file(
app / ".coulobre-release", ROUNDCUBE_VERSION, mode=0o644