Issue with imap folder structure

2017-10-04 Thread absolutely_free
Hi,

I use Dovecot 2.2.32

I just migrated spool from another server (by copying filesystem, I use 
maildir), this is an example of mailbox's content:

drwx-- 20 postfix postfix 30 Oct 4 18:38 .
drwx-- 3 postfix postfix 3 Nov 16 2012 ..
drwx-- 5 postfix postfix 11 Jun 19 18:22 .Deleted Items
drwx-- 5 postfix postfix 11 Sep 29 09:27 .Drafts
drwx-- 5 postfix postfix 9 Oct 4 10:18 .INBOX.Drafts
drwx-- 5 postfix postfix 9 Oct 4 10:18 .INBOX.Sent
drwx-- 5 postfix postfix 9 Oct 3 18:01 .INBOX.Trash
drwx-- 5 postfix postfix 12 Sep 29 09:27 .Junk
drwx-- 5 postfix postfix 8 Dec 9 2014 .Junk E-mail
drwx-- 5 postfix postfix 8 Nov 11 2015 .Archive
drwx-- 5 postfix postfix 9 Oct 2 14:18 .Posta indesiderata
drwx-- 5 postfix postfix 9 Jun 19 18:22 .Posta inviata
drwx-- 5 postfix postfix 10 Oct 4 12:27 .Sent
drwx-- 5 postfix postfix 10 Oct 4 18:01 .Trash
drwx-- 2 postfix postfix 215 Oct 4 18:00 cur
-rw--- 1 postfix postfix 53 Feb 16 2017 dovecot-keywords
-rw--- 1 postfix postfix 13963 Oct 4 16:45 dovecot-uidlist
-rw--- 1 postfix postfix 8 Oct 3 18:01 dovecot-uidvalidity
-r--r--r-- 1 postfix postfix 0 Nov 27 2015 dovecot-uidvalidity.5658162a
-r--r--r-- 1 postfix postfix 0 Sep 27 18:18 dovecot-uidvalidity.59cbcf5c
-rw--- 1 postfix postfix 7200 Sep 29 01:19 dovecot.index
-rw--- 1 postfix postfix 63336 Oct 4 18:00 dovecot.index.cache
-rw--- 1 postfix postfix 6436 Oct 4 18:38 dovecot.index.log
-rw--- 1 postfix postfix 216 Oct 3 18:01 dovecot.mailbox.log
drwx-- 2 postfix postfix 2 Oct 4 16:45 new
-rw--- 1 postfix postfix 96 Oct 3 18:01 subscriptions
drwx-- 2 postfix postfix 2 Oct 4 16:12 tmp

and this is my Dovecot's conf:


auth_mechanisms = plain login digest-md5 cram-md5
disable_plaintext_auth = no
first_valid_gid = 125
first_valid_uid = 125
mail_gid = 1003
mail_location = maildir:/var/spool/virtual/domains
mail_privileged_group = postfix
mail_uid = 1003
namespace {
inbox = yes
location =
prefix = INBOX.
separator = .
type = private
}
namespace inbox {
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =

}
passdb {
args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
passdb {
args = /etc/dovecot/dovecot-sql-crypt.conf.ext
driver = sql
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
group = postfix
mode = 0600
user = postfix
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl_cert = 

Re: moving from mysql to pgsql

2017-10-04 Thread Noel Butler
On 05/10/2017 02:06, Magnus wrote:

> Hello,
> 
> I hope that this mailing list is "alive", since I am looking for a solution 
> for my problem for a long time.
> 
> I would like to migrate my existing dovecot installation from mysql to pgsql. 
> But I have problems with the passwords when using pgsql.
> 
> The existing and working mysql-based installation looks like this:
> 
> dovecot-sql.conf.ext:
> 
> driver = mysql
> default_pass_scheme = SHA512-CRYPT
> 
> Users are created like this:
> 
> INSERT INTO mls_user (idx,domain,password,email)
> VALUES (1,99,ENCRYPT('Test'),'m...@alpenjodel.de');
> 
> This setup is working, which I can verify like this:
> 
> $ telnet localhost 143
> * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID
> ENABLE IDLE AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5
> AUTH=CRAM-MD5] Dovecot ready.
> 
> a login m...@alpenjodel.de Test
> OK
> 
> Now let's take a look at the pgsql version of the setup:
> 
> dovecot-sql.conf.ext:
> 
> driver = pgsql
> default_pass_scheme = SHA512-CRYPT
> 
> Users are created like this:
> 
> INSERT INTO mls_user (idx,domain,password,email)
> VALUES (1,99,crypt('Test',gen_salt('des')),'m...@alpenjodel.de');
> 
> This setup is not working:
> 
> $ telnet localhost 143
> * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID
> ENABLE IDLE AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5
> AUTH=CRAM-MD5] Dovecot ready.
> 
> a login m...@alpenjodel.de Test
> a NO [AUTHENTICATIONFAILED] Authentication failed.
> 
> Assumptions:
> 
> - I believe that the mysql encrypt function uses the crypt system call,
> which in turn uses the DES algorithm with a random salt.
> 
> - I believe that the same is done with the pgsql function call
> crypt('Test',gen_salt('des')).
> 
> But obviously some of these assumptions must be wrong.
> 
> Besides that, the variable "default_pass_scheme" is set to "SHA512-CRYPT" in 
> both cases. But obviously, not SHA but DES is used by the working mysql-based 
> setup. I don't understand that. Could someone please explain the relationship 
> between the default_pass_scheme variable and the encryption/hashing algorithm 
> used to store the user passwords?
> 
> And finally: What can I do to migrate to pgsql?
> 
> Thank you
> Magnus

Migrate? if the passwords are truly as designed already, it shouldnt
matter, it should read them, be it for mail, ftp, or httpd, they all
read the same thing mysql, or anything that reads sha512. 

What are you using to insert users, php? perl? , what does the database
entry look like? 

We use a perl backend to add members and hosts, in mysql mypassword
field is populated ascrypt($password, '$6$' . $salt) 

I can't help you if its php, i'll leave that for someone who knows php
and my php guru is off sick this week with the flu 

But does your database password field entry start with $6$ ? 
perhaps your mysql isnt using what you think? 

 As a test, this istesting123 in sha512 

$6$Z6I5oyWUed.tmNUs$0ScF2w3ejPWFAX/3F6DgMyWpbXLq0DD6blL8rwBpSHGWaZ9RiXlpo5PPZFoJPZWIuQMETELsXG2YtbsAc8K3q/


copy and paste that into a test users mysql password field directly, and
your pgsql directly and see if it works. 

incidentally, we use

default_pass_scheme = CRYPT 

Which handles all the subsystems crypt options including sha's -
providing your system is half modern, if its ten years old dont use
that, it'll be likely using the old 8 char limited crypt :)   (and dont
laugh the number of antique debian and RH boxes I've come across is
scary) 

anyway, so even as a fallback for testing you could insert even an md5
hash into a password field and it will work as well, I wont tell you not
to do this in production because of course you know better ;)

-- 
Kind Regards, 

Noel Butler 

This Email, including any attachments, may contain legally 
privileged
information, therefore remains confidential and subject to copyright
protected under international law. You may not disseminate, discuss, or
reveal, any part, to anyone, without the authors express written
authority to do so. If you are not the intended recipient, please notify
the sender then delete all copies of this message including attachments,
immediately. Confidentiality, copyright, and legal privilege are not
waived or lost by reason of the mistaken delivery of this message. Only
PDF [1] and ODF [2] documents accepted, please do not send proprietary
formatted documents 

 

Links:
--
[1] http://www.adobe.com/
[2] http://en.wikipedia.org/wiki/OpenDocument


moving from mysql to pgsql

2017-10-04 Thread Magnus

Hello,

I hope that this mailing list is "alive", since I am looking for a 
solution for my problem for a long time.


I would like to migrate my existing dovecot installation from mysql to 
pgsql. But I have problems with the passwords when using pgsql.


The existing and working mysql-based installation looks like this:

dovecot-sql.conf.ext:

driver = mysql
default_pass_scheme = SHA512-CRYPT

Users are created like this:

INSERT INTO mls_user (idx,domain,password,email)
VALUES (1,99,ENCRYPT('Test'),'m...@alpenjodel.de');

This setup is working, which I can verify like this:

$ telnet localhost 143
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID
ENABLE IDLE AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5
AUTH=CRAM-MD5] Dovecot ready.

a login m...@alpenjodel.de Test
OK

Now let's take a look at the pgsql version of the setup:

dovecot-sql.conf.ext:

driver = pgsql
default_pass_scheme = SHA512-CRYPT

Users are created like this:

INSERT INTO mls_user (idx,domain,password,email)
VALUES (1,99,crypt('Test',gen_salt('des')),'m...@alpenjodel.de');

This setup is not working:

$ telnet localhost 143
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID
ENABLE IDLE AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5
AUTH=CRAM-MD5] Dovecot ready.

a login m...@alpenjodel.de Test
a NO [AUTHENTICATIONFAILED] Authentication failed.

Assumptions:

- I believe that the mysql encrypt function uses the crypt system call,
  which in turn uses the DES algorithm with a random salt.

- I believe that the same is done with the pgsql function call
  crypt('Test',gen_salt('des')).

But obviously some of these assumptions must be wrong.

Besides that, the variable "default_pass_scheme" is set to 
"SHA512-CRYPT" in both cases. But obviously, not SHA but DES is used by 
the working mysql-based setup. I don't understand that. Could someone 
please explain the relationship between the default_pass_scheme variable 
and the encryption/hashing algorithm used to store the user passwords?


And finally: What can I do to migrate to pgsql?

Thank you
Magnus


Re: STAT command error

2017-10-04 Thread Aki Tuomi
Can you turning on rawlogs?

https://wiki2.dovecot.org/Debugging/Rawlog

note that if you are running older than v2.2.26, you need to use rawlog
binary.

Aki


On 04.10.2017 12:53, Andrew Charnley wrote:
> Hi,
>
> Unsure if my previous message made it through as didn't see it on
> a digest.
>
> I'm using Claws Email and 3 of 4 email accounts keep giving;
>
> [10:50:45] POP< +OK Dovecot ready.
> [10:50:45] POP> USER sales
> [10:50:45] POP< +OK
> [10:50:45] POP> PASS 
> [10:50:45] POP< +OK Logged in.
> [10:50:45] POP> STAT
> [10:50:45] POP< -ERR Unknown command: 
> *** error occurred on POP session
> *** Error occurred while processing mail.
>
> I've turned on as much logging as I can find in Dovecot but nothing
> useful is coming out, it honestly does believe STAT is invalid - I can
> see the connection close rather than disconnect.
>
> It's strange how it works for one account but not others, the settings
> are identical - I went through them with a fine tooth comb.
>
> Any suggestions appreciated. 
>
> Regards,
>
> Andrew


STAT command error

2017-10-04 Thread Andrew Charnley
Hi,

Unsure if my previous message made it through as didn't see it on
a digest.

I'm using Claws Email and 3 of 4 email accounts keep giving;

[10:50:45] POP< +OK Dovecot ready.
[10:50:45] POP> USER sales
[10:50:45] POP< +OK
[10:50:45] POP> PASS 
[10:50:45] POP< +OK Logged in.
[10:50:45] POP> STAT
[10:50:45] POP< -ERR Unknown command: 
*** error occurred on POP session
*** Error occurred while processing mail.

I've turned on as much logging as I can find in Dovecot but nothing
useful is coming out, it honestly does believe STAT is invalid - I can
see the connection close rather than disconnect.

It's strange how it works for one account but not others, the settings
are identical - I went through them with a fine tooth comb.

Any suggestions appreciated. 

Regards,

Andrew