Preserve managed directory modes during manual migration
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s

This commit is contained in:
parkel committed 2026-11-22 01:04:31 +01:00
1 parent 1b61fd0e6d
commit db86430433
3 files changed
+28 -4

No files matched your search

+6 -3
View File
@@ -792,9 +792,9 @@ sudo /opt/coulobre/bin/coulobre-mail-node restore-directadmin \
The importer supports both `imap/DOMAIN/LOCALPART/Maildir` and The importer supports both `imap/DOMAIN/LOCALPART/Maildir` and
`backup/DOMAIN/email/data/imap/LOCALPART/Maildir`. It restores regular `backup/DOMAIN/email/data/imap/LOCALPART/Maildir`. It restores regular
messages in `cur` and `new`, including Maildir++ folders, and preserves their messages in `cur` and `new`, including Maildir++ folders, and preserves their
timestamps and filename flags. A selected message stored as a link blocks the timestamps and filename flags. A selected folder or message stored as a link
restore. Use a backup with regular message files or migrate that mailbox by blocks the restore. Use a backup with regular files or migrate that mailbox
IMAP. Dovecot rebuilds its indexes. The importer checks the selected by IMAP. Dovecot rebuilds its indexes. The importer checks the selected
mailbox's quota and publishes only after the archive has been read. Both mailbox's quota and publishes only after the archive has been read. Both
an existing Maildir and an ambiguous source layout block publication. 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) [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 and rotate access using the provisioned Coulobre credentials. Verify the
website, database rows, mailbox folders, and published zone before cutover. 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 ## Request an Apache configuration preview
Start RabbitMQ and set `COULOBRE_BROKER_URL` to its AMQP URL. The development Start RabbitMQ and set `COULOBRE_BROKER_URL` to its AMQP URL. The development
@@ -1,5 +1,7 @@
import gzip import gzip
import json import json
import os
import stat
from io import BytesIO, StringIO from io import BytesIO, StringIO
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory 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_mail import copy_mailbox_messages
from coulobre.directadmin_payload import copy_database_dump from coulobre.directadmin_payload import copy_database_dump
from coulobre.mail_node import MailboxSpec from coulobre.mail_node import MailboxSpec
from coulobre.node_files import require_root_directory
from .models import DnsPublication, HostingAccount, HostingDnsZone from .models import DnsPublication, HostingAccount, HostingDnsZone
from .test_directadmin import make_tar from .test_directadmin import make_tar
@@ -116,6 +119,19 @@ class DirectAdminPayloadTests(SimpleTestCase):
ZONE + '$INCLUDE "local-private-zone"\n', "example.net" 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): class DirectAdminZoneTests(TestCase):
def setUp(self): def setUp(self):
+6 -1
View File
@@ -9,7 +9,12 @@ def require_root_directory(path, *, create_mode=None):
for parent in reversed(path.parents): for parent in reversed(path.parents):
check_root_directory(parent) check_root_directory(parent)
if create_mode is not None: 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) check_root_directory(path)