T
The_Lux

  • Apr 29, 2021
  • Joined Jul 13, 2020
  • 2 discussions
  • 5 posts
  • 0 best answers
  • Post posted... wait what?
  • Nur um das Klarzustellen. Ich bin auch Admin und kein Entwickler šŸ˜‰
    Und ich habe noch viel zum Thema skripten zu lernen. Ich wƤre z.B. nie auf sed oder awk gekommen.

  • Hey p0wer. Sorry for the late reply.
    Your script works almost like a charm. I was really excited šŸ˜ƒ
    The only thing that was problematic was that it doesnā€™t recognize german umlauts. So I added sed -i.bak -i 's/&/\\&/g to your script.
    I also changed it a bit, so that you only have to change two settings to get it working in your environment.

    
    # Only change these settings!
    # mailcowfolder = Folder where you "installed" your mailcow docker instance
    # mailcowvolumes = Folder where the public folders are stored
    # Normally docker volumes are stored under "/var/lib/docker/volumes/"
    # If so, the structure should look like:
    # /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/public"
    mailcowfolder=/opt/mailcow-dockerized
    mailcowvolumes=/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/rathaus
    
    # You don't have to change anything from here on.
    
    # Create a variable for the sent parameter and change to the mailcow volumes
    Subfolder=$1
    len=$(( ${#Subfolder} + 3 ))
    cd $mailcowvolumes
    
    #  Generate a list of all subfolder from the given public folder name
    find . -name "*"$Subfolder"*" > $mailcowfolder/helper-scripts/$Subfolder.pub
    sed -i.bak -r "/^.{,$len}$/d" $mailcowfolder/helper-scripts/$Subfolder.pub
    sed -i.bak -r 's#./##g' $mailcowfolder/helper-scripts/$Subfolder.pub
    sed -i.bak -e 's/[[:space:]]/\\ /g' /$mailcowfolder/helper-scripts/$Subfolder.pub
    sed -i.bak -i 's/(/\\(/g' $mailcowfolder/helper-scripts/$Subfolder.pub
    sed -i.bak -i 's/)/\\)/g' $mailcowfolder/helper-scripts/$Subfolder.pub
    sed -i.bak -i 's/&/\\&/g' $mailcowfolder/helper-scripts/$Subfolder.pub
    
    
    #Remive dos flag
    dos2unix $mailcowfolder/helper-scripts/$Subfolder.pub
    
    # copy ACLs
    awk '{ system (" cp '$mailcowvolumes'/.'$1'/dovecot-acl '$mailcowvolumes'/"$0"/dovecot-acl") }' < $mailcowfolder/helper-scripts/$Subfolder.pub
    
    #change owner back to 5000
    chown 5000:5000 -R $mailcowvolumes

    Iā€™ve tested this script on a few mailboxes and it seems to work. It converts german umlauts and folders with paragraphs as well.

    Again. Thank you for your help p0wer This was one thing that really bugged me with mailcow/dovecot and you got rid of it šŸ˜ƒ

  • Hey there,

    I have a problem with authenticating users to submailboxes through wildcards.
    I know that there is no acl-inheritance

    but it also says, that I can use wildcards in mailboxes here
    wiki2.dovecot.org
    Wiki has been closed
    .

    Iā€™ve tried to authenticate a user with different approaches
    docker-compose exec dovecot-mailcow doveadm acl set -u person@mailserver.tld "Public/Folder1/*" user=person@mailserver.tld lookup read write write-seen write-deleted insert post expunge create

    docker-compose exec dovecot-mailcow doveadm acl set -u person@mailserver.tld "Public/Folder1*" user=person@mailserver.tld lookup read write write-seen write-deleted insert post expunge create

    docker-compose exec dovecot-mailcow doveadm acl set -u person@mailserver.tld "Public/Folder1/?" user=person@mailserver.tld lookup read write write-seen write-deleted insert post expunge create

    docker-compose exec dovecot-mailcow doveadm acl set -u person@mailserver.tld "Public/Folder1?" user=person@mailserver.tld lookup read write write-seen write-deleted insert post expunge create

    docker-compose exec dovecot-mailcow doveadm acl set -u person@mailserver.tld "Public/Fold*" user=person@mailserver.tld lookup read write write-seen write-deleted insert post expunge create

    docker-compose exec dovecot-mailcow doveadm acl set -u person@mailserver.tld "Public/Fold?" user=person@mailserver.tld lookup read write write-seen write-deleted insert post expunge create

    But none of these acutally worked. Can anyone help me out with this? Iā€™ve already googled it and only found a mailgroup where someone is asking the same question, but without any answer.

    I know that new mailboxes inherit the acl from itā€™s parent mailboxes, but I want to set the acl recursive for new user, after alle mailboxes are created. Is this possible?

  • Hey diekuh
    Thanks for the link. I already read through it and configured a few public folder. But in the provided link it only tells me about authenticating single users or ā€œauthenticatedā€. Not how to add users to a group.
    Iā€™ve followed the link to the dovecot documentation, too. But I only found, that you can use groups, but not how.
    I think mostly they use Linux GIDs, but since we use docker, I donā€™t know how to do this with mailcow.

  • Hey there, Iā€™m implementing Mailcow in our office and we are using public folder on our old imap-server.
    Now we have many departments and I want to create a Mailbox for every department.

    Iā€™m trying to create acl groups for every mailbox, so that I only have to add a new colleague to this group, instead of adding him/her to every single mailbox and sub-mailboxes, because Iā€™ve read here

    that there is no ACL inheritance.

    Unfortunately, I cannot find a documentation on how to create acl groups for dovecat/mailcow, so that Iā€™m currently not able to create such groups and have to permit every single user instead of one group.

    My question is: Is it even possible to create acl groups in dovecot/mailcow? Or do I have to use the single users?

    Many thanks in advance
    Cheers
    The_Lux