diff --git a/docs/development.md b/docs/development.md index 5856fa8..5071b3b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -792,9 +792,9 @@ sudo /opt/coulobre/bin/coulobre-mail-node restore-directadmin \ The importer supports both `imap/DOMAIN/LOCALPART/Maildir` and `backup/DOMAIN/email/data/imap/LOCALPART/Maildir`. It restores regular messages in `cur` and `new`, including Maildir++ folders, and preserves their -timestamps and filename flags. A selected message stored as a link blocks the -restore. Use a backup with regular message files or migrate that mailbox by -IMAP. Dovecot rebuilds its indexes. The importer checks the selected +timestamps and filename flags. A selected folder or message stored as a link +blocks the restore. Use a backup with regular files or migrate that mailbox +by IMAP. Dovecot rebuilds its indexes. The importer checks the selected mailbox's quota and publishes only after the archive has been read. Both an existing Maildir and an ambiguous source layout block publication. [DirectAdmin's two IMAP backup layouts](https://docs.directadmin.com/changelog/version-1.50.0.html) @@ -829,6 +829,9 @@ and the system mailbox in a nested home archive. Reissue TLS certificates and rotate access using the provisioned Coulobre credentials. Verify the website, database rows, mailbox folders, and published zone before cutover. +See [migration sources](migration-sources.md) for the assessment of cPanel +and Plesk account archives. + ## Request an Apache configuration preview Start RabbitMQ and set `COULOBRE_BROKER_URL` to its AMQP URL. The development diff --git a/src/coulobre/hosting/test_directadmin_data.py b/src/coulobre/hosting/test_directadmin_data.py index a732c10..24d172e 100644 --- a/src/coulobre/hosting/test_directadmin_data.py +++ b/src/coulobre/hosting/test_directadmin_data.py @@ -1,5 +1,7 @@ import gzip import json +import os +import stat from io import BytesIO, StringIO from pathlib import Path from tempfile import TemporaryDirectory @@ -14,6 +16,7 @@ from coulobre.directadmin_dns import convert_zone from coulobre.directadmin_mail import copy_mailbox_messages from coulobre.directadmin_payload import copy_database_dump from coulobre.mail_node import MailboxSpec +from coulobre.node_files import require_root_directory from .models import DnsPublication, HostingAccount, HostingDnsZone from .test_directadmin import make_tar @@ -116,6 +119,19 @@ class DirectAdminPayloadTests(SimpleTestCase): ZONE + '$INCLUDE "local-private-zone"\n', "example.net" ) + def test_node_directory_keeps_explicit_mode_under_restrictive_umask(self): + path = self.directory / "account" + with patch("coulobre.node_files.check_root_directory"): + previous = os.umask(0o077) + try: + require_root_directory(path, create_mode=0o755) + finally: + os.umask(previous) + self.assertEqual(stat.S_IMODE(path.stat().st_mode), 0o755) + path.chmod(0o750) + require_root_directory(path, create_mode=0o755) + self.assertEqual(stat.S_IMODE(path.stat().st_mode), 0o750) + class DirectAdminZoneTests(TestCase): def setUp(self): diff --git a/src/coulobre/node_files.py b/src/coulobre/node_files.py index 1d65a63..3596fee 100644 --- a/src/coulobre/node_files.py +++ b/src/coulobre/node_files.py @@ -9,7 +9,12 @@ def require_root_directory(path, *, create_mode=None): for parent in reversed(path.parents): check_root_directory(parent) if create_mode is not None: - path.mkdir(mode=create_mode, exist_ok=True) + try: + path.mkdir(mode=create_mode) + except FileExistsError: + pass + else: + path.chmod(create_mode) check_root_directory(path)