Validate SSH on fresh hosts and make Roundcube readable
This commit is contained in:
1 parent
3457c3c1a1
commit
8c9e2b35c1
3 files changed
+20
-2
No files matched your search
@@ -940,6 +940,13 @@ class Installer:
|
|||||||
ASSETS,
|
ASSETS,
|
||||||
*features,
|
*features,
|
||||||
label="Configure local hosting tools",
|
label="Configure local hosting tools",
|
||||||
|
failure=lambda _code, stderr: (
|
||||||
|
stderr.decode("utf-8", errors="replace")
|
||||||
|
.strip()
|
||||||
|
.splitlines()[-1][:400]
|
||||||
|
if stderr.strip()
|
||||||
|
else "Check the local hosting tools and retry."
|
||||||
|
),
|
||||||
).splitlines()
|
).splitlines()
|
||||||
workers.extend(local_workers)
|
workers.extend(local_workers)
|
||||||
self.folder_sftp_supported = (
|
self.folder_sftp_supported = (
|
||||||
|
|||||||
@@ -201,7 +201,13 @@ def prepare_sftp(assets, command):
|
|||||||
|
|
||||||
if not SSHD.is_file():
|
if not SSHD.is_file():
|
||||||
raise ValueError("Install OpenSSH Server before enabling SFTP.")
|
raise ValueError("Install OpenSSH Server before enabling SFTP.")
|
||||||
|
require_root_directory(Path("/run/sshd"), create_mode=0o755)
|
||||||
|
try:
|
||||||
command(str(SSHD), "-t")
|
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)
|
require_root_directory(AUTHORIZED_KEYS, create_mode=0o755)
|
||||||
create_service_identity(SFTP_GROUP, "", command)
|
create_service_identity(SFTP_GROUP, "", command)
|
||||||
created = not os.path.lexists(SFTP_SSHD_CONFIG)
|
created = not os.path.lexists(SFTP_SSHD_CONFIG)
|
||||||
@@ -219,10 +225,12 @@ def prepare_sftp(assets, command):
|
|||||||
command(str(SSHD), "-t")
|
command(str(SSHD), "-t")
|
||||||
if active("ssh.service"):
|
if active("ssh.service"):
|
||||||
command(SYSTEMCTL, "reload", "ssh.service")
|
command(SYSTEMCTL, "reload", "ssh.service")
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError) as error:
|
||||||
if created:
|
if created:
|
||||||
SFTP_SSHD_CONFIG.unlink()
|
SFTP_SSHD_CONFIG.unlink()
|
||||||
raise
|
raise ValueError(
|
||||||
|
"Could not validate or reload the Coulobre OpenSSH configuration."
|
||||||
|
) from error
|
||||||
|
|
||||||
|
|
||||||
def check_folder_sftp_filesystem():
|
def check_folder_sftp_filesystem():
|
||||||
|
|||||||
@@ -331,6 +331,9 @@ def unpack_roundcube(command):
|
|||||||
):
|
):
|
||||||
raise ValueError("Roundcube has an unexpected archive layout.")
|
raise ValueError("Roundcube has an unexpected archive layout.")
|
||||||
source.extractall(staging, members=files, filter="data")
|
source.extractall(staging, members=files, filter="data")
|
||||||
|
for member in files:
|
||||||
|
if member.isdir():
|
||||||
|
(staging / member.name).chmod(0o755)
|
||||||
app = staging / root
|
app = staging / root
|
||||||
write_new_file(
|
write_new_file(
|
||||||
app / ".coulobre-release", ROUNDCUBE_VERSION, mode=0o644
|
app / ".coulobre-release", ROUNDCUBE_VERSION, mode=0o644
|
||||||
|
|||||||
Reference in new issue
Block a user