vmail on network drive

Discussion in 'Installation/Configuration' started by SamTzu, Aug 29, 2018.

  1. SamTzu

    SamTzu Active Member

    I'm trying to mount /var/vmail folder on a network drive using sshfs on host and bind-mounting /var/vmail on LXC container but dovecot does not like it.

    dovecot: lda([email protected]): Error: open(/var/vmail/mf1.ic4.eu/postmaster/Maildir/dovecot-uidvalidity)
    failed: Permission denied
    dovecot: imap([email protected]): Error: file dict commit: file_dotlock_open(/var/vmail/mf1.ic4.eu/postmaster/.quotausage) failed: Operation not permitted
    dovecot: imap([email protected]): Error: open(/var/vmail/mf1.ic4.eu/postmaster/Maildir/dovecot-uidlist) failed: Permission denied
    dovecot: imap([email protected]): Error: Couldn't get size of mail UID 2 in INBOX: Internal error occurred. Refer to server log for more information. [2018-08-29 20:38:51]

    Any ideas how to spank dovecot in to submission?

    This is the /etc/fstab mount on host

    sshfs#[email protected]:/share/Q1vmail/ /mnt/Q1vmail fuse delay_connect,allow_other,identityfile=/root/.ssh/id_rsa,cache_timeout=1800,cache_dir_timeout=1800,cache_stat_timeout=1800,cache_link_timeout=1800,entry_timeout=1800,negative_timeout=1800,attr_timeout=1800,defaults 0 0


    Sam
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you verify that the mentioned files are really owned by user and group 'vmail' ?
     
  3. SamTzu

    SamTzu Active Member

    All but /var/vmail/mf1.ic4.eu/postmaster/Maildir/dovecot-uidlist is owned vmail.
    uidlist there is owned by root. uidlist in .Drafts is owned by vmail.
    It's odd.
    New emails are coming in but they are owned by root.
     
    Last edited: Aug 29, 2018
  4. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    Looks like a permission-problem with your mount. I use this on a proxmox-host:
    Code:
    root@bremote:/folder /mount fuse.sshfs allow_other,_netdev 0 0
    
    and mount /folder from the host to a container:
    Code:
    pct set CTID -mp0 /mount,mp=/var/backup
    
     
    Jesse Norell likes this.
  5. SamTzu

    SamTzu Active Member

    I had to give up on this. ISPConfig remote API for vmail/dovecot/sieve simply did not work with SSHFS mount on NAS.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    It does not matter for the remote API which type of filesystem you use, the folder must just be readable and writable for the Linux vmail user. The error messages you posted are from dovecot and not from ISPConfig, if you got an error from ISPConfig as well in debug mode, then please post that. As Florian pointed out, this looks as if it is a permission problem and he suggested some mount options, did you test them? What are the permissions of the file that dovecot complained about?
     
  7. SamTzu

    SamTzu Active Member

    It was odd. When I used sshfs mount on the /var/vmail folder all API created accounts created 2 folders under vmail. Like this.
    /var/vmail/domain.com/username (this had a sym link pointing to .sieve folder that was missing because it was on the other folder.)
    /var/vmail/domain.com/[email protected] (this had the rest.)

    I'm not sure what caused that but Sieve started to work after I dismounted the SSHFS and used local storage.
    In general I have noticed that sym links are problematic with mounted filesystems.
     
    Last edited: Sep 5, 2018
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Maybe some inconsistency in dovecot config? The exact same dovecot config files work when you don't use a network filesystem?
     
  9. SamTzu

    SamTzu Active Member

    Yep. No change except in the fstab. I don't really have time to debug it now but it's interesting.
    Probably has something to do with the fact that Postfix and Dovecot both use Certbot cert that points from /etc/postfix/postfix.cert -> /usr.../ispconfig/ssl -> /etc/letsencrypt etc.
    Maybe debug this later with proper certs and without sym links.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    If you want to debug it, use ISPConfig debug mode when you create a new mailbox to see if there are any errors and check the mailbox path of that mailbox in the ispconfig mail_user table.
     
  11. SamTzu

    SamTzu Active Member

    OK. So it's not the fuse mount that is creating double folders under vmail. It's the API.
    When accounts are created by the API it's creating double folders and when by ISPc ControlPanel only one folder.
    It's weird.

    drwx------ 4 vmail vmail 4.0K Sep 25 07:40 info
    drwx------ 2 vmail vmail 4.0K Sep 22 09:19 test1
    drwx------ 3 vmail vmail 4.0K Sep 22 09:19 [email protected]
    drwx------ 2 vmail vmail 4.0K Sep 22 09:25 test2
    drwx------ 3 vmail vmail 4.0K Sep 22 09:25 [email protected]
    drwx------ 2 vmail vmail 4.0K Sep 22 09:27 test3
    drwx------ 3 vmail vmail 4.0K Sep 22 09:27 [email protected]
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    The api does nothing different than what the UI does, the code is the same. I guess the reason might be that you pass a wrong path to the API which causes the duplicate folders to be added?
     
  13. SamTzu

    SamTzu Active Member

    Found it.
    It needs to be like this...
    'maildir' => '/var/vmail/mail.fish/.$user->username',
    not like this...
    'maildir' => '/var/vmail/mail.fish/'.$user->username,

    My script broke the quote placement.
     
  14. SamTzu

    SamTzu Active Member

    I'm using a sed / bash script to sync/manage +100 Family Name email domain sites.
    example: After rsyncing a site from skeleton it's necessary to modify the API script. This is what caused the quote misplacement.
    sed -i 's#'"/var/vmail/mail.fish/"'#'"/var/vmail/lebedev.red/"'#g' /var/www/lebedev.red/web/app/Http/Controllers/EmailController.php

    Sam

    "Damn the quote's. Full speed ahead."
     
    Last edited: Sep 25, 2018
  15. SamTzu

    SamTzu Active Member

    I was too quick to say it's solved.
    Now the API creates 3 folders :)
    Fortunately it no longer creates test1 and [email protected] folders but only test1 folder.

    drwx------ 3 vmail vmail 4.0K Sep 25 09:30 .$user->username
    drwxr-xr-x 9 vmail vmail 4.0K Sep 24 16:25 ..
    drwx------ 3 root root 4.0K Sep 25 09:30 .\$user-\>username
    drwx------ 2 vmail vmail 4.0K Sep 25 09:30 test1

    So where exactly should I place the last hyphen on the line?
    'maildir' => '/var/vmail/mail.fish/.$user->username',
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Create a mailbox in the UI and then take a look at the database to see the mailbox path, the database table is mail_user
     
  17. SamTzu

    SamTzu Active Member

    Good point.
    The $user variable is not correctly passed down trough the remote API.
     
    Last edited: Sep 25, 2018
  18. SamTzu

    SamTzu Active Member

    So. This is what we ended up doing...

    'maildir' => '/var/vmail/'.$emailData[1].'/'.$emailData[0],
     
    till likes this.

Share This Page