zmmailbox TGZ impor...
 
Notifications
Clear all

zmmailbox TGZ import reports FileNotFoundException when archive is readable but a parent directory is not traversable

1 Posts
1 Users
0 Reactions
49 Views
(@abalamut)
New Member
Joined: 2 weeks ago
Posts: 4
Topic starter  

Issue Type: [BUG]

Summary: zmmailbox TGZ import reports FileNotFoundException when archive is readable but a parent directory is not traversable

Affected Components: Carbonio Mailbox / zmmailbox / REST TGZ import

Description:

During migration of mailboxes to Carbonio CE using TGZ archives, an import failed with a zclient.CLIENT_ERROR / java.io.FileNotFoundException ending with "Permission denied".

The archive itself existed and had the correct owner and permissions for the zextras user.

Example:

Archive:
/opt/zimbra-migration/ap/<archive>.tgz

Archive ownership:
zextras:zextras

Archive mode:
0600

However, the containing directory had:

ladmin:ladmin
mode 0700

Therefore the zextras user could not traverse the parent directory even though the archive itself was owned by zextras.

The resulting error from zmmailbox was misleading because it looked as if the TGZ file did not exist or could not be opened for another reason.

After changing the directory ownership and permissions to:

chown zextras:zextras /opt/zimbra-migration/ap
chmod 700 /opt/zimbra-migration/ap

the same archive became readable by zextras and the import proceeded.

Server OS:
[insert output of /etc/os-release]

Carbonio Version:
[insert output of: su - zextras -c "zmcontrol -v"]

Current Behavior:

The import fails with a generic FileNotFoundException / Permission denied when any parent directory in the archive path is not traversable by the user executing zmmailbox.

The error does not clearly identify that the problem is the parent directory permissions.

Expected Behavior:

Before starting a potentially long TGZ import, zmmailbox should validate that:

  1. the archive exists;

  2. it is a regular readable file;

  3. every directory in the path can be traversed by the effective user.

If validation fails, the command should return an explicit error such as:

"Archive exists but cannot be accessed by user zextras: permission denied while traversing /opt/zimbra-migration/ap"

This would make migration failures much easier to diagnose.

Steps to Reproduce:

  1. Create a directory accessible only by another user:
    mkdir -p /opt/zimbra-migration/test
    chown ladmin:ladmin /opt/zimbra-migration/test
    chmod 700 /opt/zimbra-migration/test

  2. Place a valid Carbonio/Zimbra TGZ export inside it.

  3. Set the TGZ owner to:
    zextras:zextras

  4. Set the archive mode to:
    0600

  5. Attempt a TGZ REST import using zmmailbox as the zextras user.

  6. Observe zclient.CLIENT_ERROR / FileNotFoundException / Permission denied.

  7. Change the parent directory to:
    zextras:zextras and mode 0700.

  8. Repeat the exact same import.

  9. The archive can now be accessed and the import proceeds.

Workaround:

Ensure that the zextras user has execute/traverse permission on every parent directory and read permission on the TGZ archive before starting the import.

Additional note:

I understand that the underlying filesystem permission denial is expected Unix behavior. The issue I am reporting is primarily the lack of a clear pre-flight permission check and diagnostic message in the Carbonio migration/import workflow.


   
Quote