Re: sieve-filter ignores -u argument

2022-01-26 Thread Андрей Куницын
I have found the problem

auth debug helped me

sieve-filter -u test

```
Jan 27 03:38:03 mail dovecot: auth: Debug: master in:
USER#0111#011test#011service=sieve-filter
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(t...@domain.tld):
Performing userdb lookup
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(t...@domain.tld): user
search: base=o=domains,dc=mail,dc=domain,dc=tld scope=subtree
filter=(&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail)(enabledService=sieve-filter)(|(mail=t...@domain.tld
)(&(enabledService=shadowaddress)(shadowAddress=t...@domain.tld
fields=mail,mail,homeDirectory,mailboxFormat,mailboxFolder,mailQuota
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(t...@domain.tld): no fields
returned by the server
Jan 27 03:38:03 mail dovecot: auth: ldap(t...@domain.tld): unknown user
Jan 27 03:38:03 mail dovecot: auth: Debug: ldap(t...@domain.tld): Finished
userdb lookup
Jan 27 03:38:03 mail dovecot: auth: Debug: userdb out: NOTFOUND#0111
```

doveadm user test

```
Jan 27 03:38:08 mail dovecot: auth: Debug: master in:
USER#0111#011test#011service=doveadm#011debug
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(t...@domain.tld):
Performing userdb lookup
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(t...@domain.tld): user
search: base=o=domains,dc=mail,dc=domain,dc=tld scope=subtree
filter=(&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail)(enabledService=doveadm)(|(mail=t...@domain.tld
)(&(enabledService=shadowaddress)(shadowAddress=t...@domain.tld
fields=mail,mail,homeDirectory,mailboxFormat,mailboxFolder,mailQuota
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(t...@domain.tld): result:
mail=t...@domain.tld
homeDirectory=/var/vmail/vmail1/domain.tld/t/r/a/test-2022.01.21.10.09.47/
mailQuota=1073741824 mailboxFolder=sdbox mailboxFormat=sdbox;
mailboxFormat,homeDirectory,mailQuota,mail,mailboxFolder unused
Jan 27 03:38:08 mail dovecot: auth: Debug: ldap(t...@domain.tld): Finished
userdb lookup
Jan 27 03:38:08 mail dovecot: auth: Debug: userdb out:
USER#0111#011t...@domain.tld#011master_user=t...@domain.tld
#011home=/var/vmail/vmail1/domain.tld/t/r/a/test-2022.01.21.10.09.47/#011mail=sdbox:~/sdbox/#011quota_rule=*:bytes=1073741824
```

`(enabledService=sieve-filter)` is absent for users by default



вт, 25 янв. 2022 г. в 20:21, Андрей Куницын :

> Hm, looks like I misunderstood initial error sieve-filter(root): Fatal:
> Unknown user
> filter-sieve do not understand -u postma...@domain.tld
> Where (root) is about who runs the command, not who is not found
>
> Anyway I've tried
>
> # cd
> /var/vmail/vmail1/domain.tld/t/e/s/test-2022.01.22.05.55.26/sdbox/mailboxes/
> #sieve-filter -c /etc/dovecot/dovecot.conf -v
> /var/vmail/sieve/dovecot.sieve INBOX
> sieve-filter(root): Error: stat(/root/Maildir/tmp) failed: Permission
> denied (euid=2000(vmail) egid=2000(vmail) missing +x perm: /root, dir owned
> by 0:0 mode=0700)
> sieve-filter(root): Fatal: Couldn't open source mailbox 'INBOX': Internal
> error occurred. Refer to server log for more information. [2022-01-25
> 14:46:35]
>
> sudo -u vmail sieve-filter -c /etc/dovecot/dovecot.conf -v
> /var/vmail/sieve/dovecot.sieve INBOX
>
> sieve-filter(vmail): Info: Mailbox created: INBOX
>
> /home/vmail/Maildir was created after that and  not in the current
> directory
>
> I've tried  '-u test', '-u t...@domain.tld', '-u t...@mail.domain.tld' and
> passed config  '-c /etc/dovecot/dovecot.conf.'
> And still got
> Fatal: Unknown user
>
> How do sieve-filters understand virtual users?
>
> вт, 25 янв. 2022 г. в 18:31, Eric Wood :
>
>> I read the sieve-filter man page so I'll speculate.   Granted, I still
>> don't fully understand how sieve and virtual users work as I have never set
>> this up.
>>
>> "postmaster" is an alias of root and "vmail" is probably just a directory
>> name.   So, from the root's command prompt, the environment variables
>> probably aren't totally set up for sieve-filter to understand virtual users.
>>
>> So, working from the command prompt, you probably have to explicitly
>> specify the .sieve path and leave off the -u argument
>>
>> # cd /location_of_virtual_user_INBOX
>> # sieve-filter -v /opt/some_global_rules/sieve/managesieve.sieve INBOX
>>
>> Would is be great if seive-filter had an argument to understand the
>> system's virual user's settings?  Of course.  I don't know why the
>> developer haven't included it.
>>
>> -Eric
>>
>> On 1/24/2022 7:59 AM, Андрей Куницын wrote:
>>
>> Hello
>> I try to test my sieve script, but found out that it is impossible to use
>> a sieve-filter tool with virtual mail users. It always uses a real user
>> name instead of passed via -u argument.
>>
>>
>> # sieve-filter -v -u postmas...@domain.tld ~/sieve/managesieve.sieve
>> INBOX
>> sieve-filter(root): Fatal: Unknown user
>>
>> sudo -u vmail sieve-filter -u postmas...@domain.tld
>> ~/sieve/managesieve.sieve INBOX
>> sieve-filter(vmail): Fatal: Unknown user

Re: sieve-filter ignores -u argument

2022-01-25 Thread Андрей Куницын
Hm, looks like I misunderstood initial error sieve-filter(root): Fatal:
Unknown user
filter-sieve do not understand -u postma...@domain.tld
Where (root) is about who runs the command, not who is not found

Anyway I've tried

# cd
/var/vmail/vmail1/domain.tld/t/e/s/test-2022.01.22.05.55.26/sdbox/mailboxes/
#sieve-filter -c /etc/dovecot/dovecot.conf -v
/var/vmail/sieve/dovecot.sieve INBOX
sieve-filter(root): Error: stat(/root/Maildir/tmp) failed: Permission
denied (euid=2000(vmail) egid=2000(vmail) missing +x perm: /root, dir owned
by 0:0 mode=0700)
sieve-filter(root): Fatal: Couldn't open source mailbox 'INBOX': Internal
error occurred. Refer to server log for more information. [2022-01-25
14:46:35]

sudo -u vmail sieve-filter -c /etc/dovecot/dovecot.conf -v
/var/vmail/sieve/dovecot.sieve INBOX

sieve-filter(vmail): Info: Mailbox created: INBOX

/home/vmail/Maildir was created after that and  not in the current directory

I've tried  '-u test', '-u t...@domain.tld', '-u t...@mail.domain.tld' and
passed config  '-c /etc/dovecot/dovecot.conf.'
And still got
Fatal: Unknown user

How do sieve-filters understand virtual users?

вт, 25 янв. 2022 г. в 18:31, Eric Wood :

> I read the sieve-filter man page so I'll speculate.   Granted, I still
> don't fully understand how sieve and virtual users work as I have never set
> this up.
>
> "postmaster" is an alias of root and "vmail" is probably just a directory
> name.   So, from the root's command prompt, the environment variables
> probably aren't totally set up for sieve-filter to understand virtual users.
>
> So, working from the command prompt, you probably have to explicitly
> specify the .sieve path and leave off the -u argument
>
> # cd /location_of_virtual_user_INBOX
> # sieve-filter -v /opt/some_global_rules/sieve/managesieve.sieve INBOX
>
> Would is be great if seive-filter had an argument to understand the
> system's virual user's settings?  Of course.  I don't know why the
> developer haven't included it.
>
> -Eric
>
> On 1/24/2022 7:59 AM, Андрей Куницын wrote:
>
> Hello
> I try to test my sieve script, but found out that it is impossible to use
> a sieve-filter tool with virtual mail users. It always uses a real user
> name instead of passed via -u argument.
>
>
> # sieve-filter -v -u postmas...@domain.tld ~/sieve/managesieve.sieve
> INBOX
> sieve-filter(root): Fatal: Unknown user
>
> sudo -u vmail sieve-filter -u postmas...@domain.tld
> ~/sieve/managesieve.sieve INBOX
> sieve-filter(vmail): Fatal: Unknown user
>
> Also there is the same question on serverfault, but without an answer.
>
> https://serverfault.com/questions/1055407/how-to-make-sieve-filter-use-virtual-users
>
> My environment is Ubuntu 20.04
> dovecot --version
> 2.3.7.2 (3c910f64b)
>
> --
> Sincerely, Andrey Kunitsyn
>
>
>

-- 
С уважением, Куницын Андрей.


Re: sieve-filter ignores -u argument

2022-01-25 Thread Benny Pedersen

On 2022-01-25 14:31, Eric Wood wrote:


sudo -u vmail sieve-filter -u postmas...@domain.tld
~/sieve/managesieve.sieve INBOX
sieve-filter(vmail): Fatal: Unknown user


~ is the users HOME dir, if -u is defined it possible could be another 
user


so make sure shell define $(HOME) in dovecot auth

i am not dovecot expert sorry

read "as home" 
https://serverfault.com/questions/896236/getting-error-with-dovecot-when-authenticating-user-home-directory-not-set-for




Re: sieve-filter ignores -u argument

2022-01-25 Thread Christian Mack
Hello

What do you get for
doveadm user postmas...@domain.tld


Kind regards,
Christian Mack

Am 24.01.22 um 13:59 schrieb Андрей Куницын:
> Hello
> I try to test my sieve script, but found out that it is impossible to use a
> sieve-filter tool with virtual mail users. It always uses a real user name
> instead of passed via -u argument.
> 
> 
> # sieve-filter -v -u postmas...@domain.tld ~/sieve/managesieve.sieve INBOX
> sieve-filter(root): Fatal: Unknown user
> 
> sudo -u vmail sieve-filter -u postmas...@domain.tld
> ~/sieve/managesieve.sieve INBOX
> sieve-filter(vmail): Fatal: Unknown user
> 
> Also there is the same question on serverfault, but without an answer.
> https://serverfault.com/questions/1055407/how-to-make-sieve-filter-use-virtual-users
> 
> My environment is Ubuntu 20.04
> dovecot --version
> 2.3.7.2 (3c910f64b)
> 


-- 
Christian Mack
Universität Konstanz
Kommunikations-, Informations-, Medienzentrum (KIM)
Abteilung IT-Dienste Forschung und Lehre
78457 Konstanz
+49 7531 88-4416



smime.p7s
Description: S/MIME Cryptographic Signature


Re: sieve-filter ignores -u argument

2022-01-25 Thread Eric Wood
I read the sieve-filter man page so I'll speculate.   Granted, I still 
don't fully understand how sieve and virtual users work as I have never 
set this up.


"postmaster" is an alias of root and "vmail" is probably just a 
directory name.   So, from the root's command prompt, the environment 
variables probably aren't totally set up for sieve-filter to understand 
virtual users.


So, working from the command prompt, you probably have to explicitly 
specify the .sieve path and leave off the -u argument


# cd /location_of_virtual_user_INBOX
# sieve-filter -v /opt/some_global_rules/sieve/managesieve.sieve INBOX

Would is be great if seive-filter had an argument to understand the 
system's virual user's settings?  Of course.  I don't know why the 
developer haven't included it.


-Eric

On 1/24/2022 7:59 AM, Андрей Куницын wrote:

Hello
I try to test my sieve script, but found out that it is impossible to 
use a sieve-filter tool with virtual mail users. It always uses a real 
user name instead of passed via -u argument.



# sieve-filter -v -u postmas...@domain.tld ~/sieve/managesieve.sieve 
INBOX

sieve-filter(root): Fatal: Unknown user

sudo -u vmail sieve-filter -u postmas...@domain.tld 
~/sieve/managesieve.sieve INBOX

sieve-filter(vmail): Fatal: Unknown user

Also there is the same question on serverfault, but without an answer.
https://serverfault.com/questions/1055407/how-to-make-sieve-filter-use-virtual-users

My environment is Ubuntu 20.04
dovecot --version
2.3.7.2 (3c910f64b)

--
Sincerely, Andrey Kunitsyn


sieve-filter ignores -u argument

2022-01-24 Thread Андрей Куницын
Hello
I try to test my sieve script, but found out that it is impossible to use a
sieve-filter tool with virtual mail users. It always uses a real user name
instead of passed via -u argument.


# sieve-filter -v -u postmas...@domain.tld ~/sieve/managesieve.sieve INBOX
sieve-filter(root): Fatal: Unknown user

sudo -u vmail sieve-filter -u postmas...@domain.tld
~/sieve/managesieve.sieve INBOX
sieve-filter(vmail): Fatal: Unknown user

Also there is the same question on serverfault, but without an answer.
https://serverfault.com/questions/1055407/how-to-make-sieve-filter-use-virtual-users

My environment is Ubuntu 20.04
dovecot --version
2.3.7.2 (3c910f64b)

-- 
Sincerely, Andrey Kunitsyn