[GH-ISSUE #19] IMAP authentication doesn't work #17

Closed
opened 2026-02-25 21:33:56 +03:00 by kerem · 8 comments
Owner

Originally created by @ei4koote on GitHub (Aug 22, 2015).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/19

Originally assigned to: @jasonmunro on GitHub.

My setup is: ArchLinux + PHP + PHP-FPM + Dovecot. I am no expert in this stuff. So...

  1. I didn't edit hm3.ini. Because i didn't find anything to edit. As it was seemed to me, default IMAP authentication is ok.
  2. php ./scripts/config_gen.php created site for me.
  3. I was able to access site. I got login form, filled it with my account name and password, hit login button, and the i got login form again. Dovecot writes to its logs about login attempt, but it looks like
imap-login: Disconnected (no auth attempts in 0 secs): user=<>

So... What i'm doing wrong?

Originally created by @ei4koote on GitHub (Aug 22, 2015). Original GitHub issue: https://github.com/cypht-org/cypht/issues/19 Originally assigned to: @jasonmunro on GitHub. My setup is: ArchLinux + PHP + PHP-FPM + Dovecot. I am no expert in this stuff. So... 1. I didn't edit hm3.ini. Because i didn't find anything to edit. As it was seemed to me, default IMAP authentication is ok. 2. php ./scripts/config_gen.php created site for me. 3. I was able to access site. I got login form, filled it with my account name and password, hit login button, and the i got login form again. Dovecot writes to its logs about login attempt, but it looks like ``` imap-login: Disconnected (no auth attempts in 0 secs): user=<> ``` So... What i'm doing wrong?
kerem closed this issue 2026-02-25 21:33:56 +03:00
Author
Owner

@dumblob commented on GitHub (Aug 23, 2015):

Did you check whether you can login into dovecot using e.g. Thunderbird?

<!-- gh-comment-id:133856678 --> @dumblob commented on GitHub (Aug 23, 2015): Did you check whether you can login into dovecot using e.g. Thunderbird?
Author
Owner

@ei4koote commented on GitHub (Aug 23, 2015):

Yes. Mutt, Geary, Thunderbird login successfully.

<!-- gh-comment-id:133871241 --> @ei4koote commented on GitHub (Aug 23, 2015): Yes. Mutt, Geary, Thunderbird login successfully.
Author
Owner

@jasonmunro commented on GitHub (Aug 25, 2015):

IIRC, Dovecot will not allow standard IMAP LOGIN attempts on port 143 unless you enable them in the configuration. Could you try changing the imap_auth_port to 993, and the imap_auth_tls setting to true, rebuild your config, and see if that helps? If not, we can enable some debugging in the IMAP lib to track down exactly what the conversation between dovecot and cypht is. Thanks for the feedback!

<!-- gh-comment-id:134678822 --> @jasonmunro commented on GitHub (Aug 25, 2015): IIRC, Dovecot will not allow standard IMAP LOGIN attempts on port 143 unless you enable them in the configuration. Could you try changing the imap_auth_port to 993, and the imap_auth_tls setting to true, rebuild your config, and see if that helps? If not, we can enable some debugging in the IMAP lib to track down exactly what the conversation between dovecot and cypht is. Thanks for the feedback!
Author
Owner

@jasonmunro commented on GitHub (Sep 2, 2015):

I tested both the IMAP and POP3 auth mechs against a local Dovecot installation - and both worked. I made some improvements and fixes, but those did not have to do with the actual authentication.

<!-- gh-comment-id:137202496 --> @jasonmunro commented on GitHub (Sep 2, 2015): I tested both the IMAP and POP3 auth mechs against a local Dovecot installation - and both worked. I made some improvements and fixes, but those did not have to do with the actual authentication.
Author
Owner

@jasonmunro commented on GitHub (Sep 14, 2015):

I can't reproduce this issue, and have not heard back in 3 weeks, so I'm going to close this for now. Please feel free to open a new issue if you are still having problems. Thanks!

<!-- gh-comment-id:140149015 --> @jasonmunro commented on GitHub (Sep 14, 2015): I can't reproduce this issue, and have not heard back in 3 weeks, so I'm going to close this for now. Please feel free to open a new issue if you are still having problems. Thanks!
Author
Owner

@mbakhterev commented on GitHub (Jan 27, 2016):

Hi. I have the same problem... I think. My setup is (archlinux php pgp-cgi dovecot). When i'm trying to login with my IMAP credentials i get from the Dovecot

dovecot[513]: imap-login: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=::1, lip=::1, secured, session=<7v08t1Yq8LEAAAAAAAAAAAAAAAAAAAAB>

And Invalid username or password form Cypth. But there even was no attempts to authentificate. The specifity of my Dovecot setup is that it announces login only after STARTTLS.

Here goes my hm3.ini:

; -----------------------------------------------------------------------------
; General settings
; -----------------------------------------------------------------------------

; Define how to handle sessions. Standard PHP sessions, or a custom DB version
;
; PHP Standard PHP session handlers
; DB Custom database based sessions
session_type=PHP

; Define how users authenticate. You can use an IMAP or POP3 mail server, or
; a database schema
;
; DB use database support (see below) to authenticate
; IMAP use an IMAP server for authentication, the imap module must be enabled
; POP3 use a POP3 server for authentication, the pop3 module must be enabled
auth_type=IMAP

; if using "IMAP" as an auth type, this defines the server to use
imap_auth_name=localhost
imap_auth_server=localhost
imap_auth_port=143
imap_auth_tls=true

; if using "POP3" as the auth type, this defines the server to use
pop3_auth_name=localhost
pop3_auth_server=localhost
pop3_auth_port=110
pop3_auth_tls=

; Optional default SMTP server. Authentication will be done with the users login
; credentials, so this probably only makes sense if you are using POP3 or IMAP
; for authentication
default_smtp_name=
default_smtp_server=
default_smtp_port=
default_smtp_tls=
default_smtp_no_auth=

; Default language to use for the interface strings
default_language=en

; Storage location for user settings. Can be either "file" or "DB". If set to
; DB the hm_user_settings file must be available.
user_config_type=file

; location of other application data that should not be inside the document
; root
app_data_dir=/home/app/var/lib/hm3

; location of the user settings files. Must be readable/writable by the web
; server. Only used if user_config_type is set to "file"
user_settings_dir=/home/app/var/lib/hm3/users

; location of uploaded attachments for outbound messages
attachment_dir=/home/app/var/lib/hm3/attachments

; Allow HTTP requests. Not recommended.
disable_tls=false

; Comma delimited usernames with admin access. Currently this only enables the
; "create account" link in the account module set, and is only used if the
; auth_type is set to DB
admin_users=

; App name used throughout the program
app_name=HM3

; External command used to compress javascript includes during the config build process
; Examples:
; js_compress='java -jar /usr/local/lib/yuicompressor-2.4.8.jar --type js'
; js_compress='uglifyjs -nc --unsafe -c -v'
js_compress=false

; External command used to compress css includes during the config build process
; Examples:
; css_compress='java -jar /usr/local/lib/yuicompressor-2.4.8.jar --type css'
css_compress=false

; Browser side encryption using forge (https://github.com/digitalbazaar/forge)
; Enabling either one of these options causes the forge javascript lib to be
; included. This adds about 70KB to the page size (when gzipped).

; use AES encryption for ajax responses
encrypt_ajax_requests=

; use AES encryption for data stored in local storage
encrypt_local_storage=

; -----------------------------------------------------------------------------
; DB support
; -----------------------------------------------------------------------------
;
; All settings are required if using the built in DB user or session support.
;
; For the DB_auth session type The target DB must contain a table called
; hm_user that we can read and write to.
;
; Postgresql : create table hm_user (username varchar(255) primary key not null, hash varchar(255));
; Mysql or sqlite : create table hm_user (username varchar(250), hash varchar(250), primary key (username));
;
; For DB_session support the following additional table must be available:
;
; Postgresql : create table hm_user_session (hm_id varchar(250) primary key not null, data text, date timestamp);
; Mysql or sqlite : create table hm_user_session (hm_id varchar(250), data longblob, date timestamp, primary key (hm_id));
;
; For DB support for user_config_type the following additional table must be available:
;
; Postgresql : create table hm_user_settings (username varchar(250) primary key not null, settings text);
; Mysql or sqlite : create table hm_user_settings(username varchar(250), settings longblob, primary key (username));
;
; Technically any DB driver supported by the PHP PDO extension should work as
; long as the required tables are present. For sqlite, only the db_host needs to
; be set.

; database host name or ip address
db_host=127.0.0.1

; database name
db_name=test

; database user
db_user=test

; database password
db_pass=123456

; database type. can be any supported PDO driver
db_driver=mysql

; -----------------------------------------------------------------------------
; Modules
; -----------------------------------------------------------------------------

; Modules enabled
modules=core,contacts,feeds,imap,smtp,site,account,idle_timer,calendar,themes,nux,developer,github,wordpress,history,saved_searches,nasa

<!-- gh-comment-id:175844490 --> @mbakhterev commented on GitHub (Jan 27, 2016): Hi. I have the same problem... I think. My setup is (archlinux php pgp-cgi dovecot). When i'm trying to login with my IMAP credentials i get from the Dovecot `dovecot[513]: imap-login: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=::1, lip=::1, secured, session=<7v08t1Yq8LEAAAAAAAAAAAAAAAAAAAAB>` And Invalid username or password form Cypth. But there even was no attempts to authentificate. The specifity of my Dovecot setup is that it announces login only after STARTTLS. Here goes my hm3.ini: ; ----------------------------------------------------------------------------- ; General settings ; ----------------------------------------------------------------------------- ; Define how to handle sessions. Standard PHP sessions, or a custom DB version ; ; PHP Standard PHP session handlers ; DB Custom database based sessions session_type=PHP ; Define how users authenticate. You can use an IMAP or POP3 mail server, or ; a database schema ; ; DB use database support (see below) to authenticate ; IMAP use an IMAP server for authentication, the imap module must be enabled ; POP3 use a POP3 server for authentication, the pop3 module must be enabled auth_type=IMAP ; if using "IMAP" as an auth type, this defines the server to use imap_auth_name=localhost imap_auth_server=localhost imap_auth_port=143 imap_auth_tls=true ; if using "POP3" as the auth type, this defines the server to use pop3_auth_name=localhost pop3_auth_server=localhost pop3_auth_port=110 pop3_auth_tls= ; Optional default SMTP server. Authentication will be done with the users login ; credentials, so this probably only makes sense if you are using POP3 or IMAP ; for authentication default_smtp_name= default_smtp_server= default_smtp_port= default_smtp_tls= default_smtp_no_auth= ; Default language to use for the interface strings default_language=en ; Storage location for user settings. Can be either "file" or "DB". If set to ; DB the hm_user_settings file must be available. user_config_type=file ; location of other application data that should not be inside the document ; root app_data_dir=/home/app/var/lib/hm3 ; location of the user settings files. Must be readable/writable by the web ; server. Only used if user_config_type is set to "file" user_settings_dir=/home/app/var/lib/hm3/users ; location of uploaded attachments for outbound messages attachment_dir=/home/app/var/lib/hm3/attachments ; Allow HTTP requests. Not recommended. disable_tls=false ; Comma delimited usernames with admin access. Currently this only enables the ; "create account" link in the account module set, and is only used if the ; auth_type is set to DB admin_users= ; App name used throughout the program app_name=HM3 ; External command used to compress javascript includes during the config build process ; Examples: ; js_compress='java -jar /usr/local/lib/yuicompressor-2.4.8.jar --type js' ; js_compress='uglifyjs -nc --unsafe -c -v' js_compress=false ; External command used to compress css includes during the config build process ; Examples: ; css_compress='java -jar /usr/local/lib/yuicompressor-2.4.8.jar --type css' css_compress=false ; Browser side encryption using forge (https://github.com/digitalbazaar/forge) ; Enabling either one of these options causes the forge javascript lib to be ; included. This adds about 70KB to the page size (when gzipped). ; use AES encryption for ajax responses encrypt_ajax_requests= ; use AES encryption for data stored in local storage encrypt_local_storage= ; ----------------------------------------------------------------------------- ; DB support ; ----------------------------------------------------------------------------- ; ; All settings are required if using the built in DB user or session support. ; ; For the DB_auth session type The target DB must contain a table called ; hm_user that we can read and write to. ; ; Postgresql : create table hm_user (username varchar(255) primary key not null, hash varchar(255)); ; Mysql or sqlite : create table hm_user (username varchar(250), hash varchar(250), primary key (username)); ; ; For DB_session support the following additional table must be available: ; ; Postgresql : create table hm_user_session (hm_id varchar(250) primary key not null, data text, date timestamp); ; Mysql or sqlite : create table hm_user_session (hm_id varchar(250), data longblob, date timestamp, primary key (hm_id)); ; ; For DB support for user_config_type the following additional table must be available: ; ; Postgresql : create table hm_user_settings (username varchar(250) primary key not null, settings text); ; Mysql or sqlite : create table hm_user_settings(username varchar(250), settings longblob, primary key (username)); ; ; Technically any DB driver supported by the PHP PDO extension should work as ; long as the required tables are present. For sqlite, only the db_host needs to ; be set. ; database host name or ip address db_host=127.0.0.1 ; database name db_name=test ; database user db_user=test ; database password db_pass=123456 ; database type. can be any supported PDO driver db_driver=mysql ; ----------------------------------------------------------------------------- ; Modules ; ----------------------------------------------------------------------------- ; Modules enabled modules=core,contacts,feeds,imap,smtp,site,account,idle_timer,calendar,themes,nux,developer,github,wordpress,history,saved_searches,nasa
Author
Owner

@jasonmunro commented on GitHub (Jan 27, 2016):

specifity of my Dovecot setup is that it announces login only after STARTTLS.

If you are using STARTTLS, then imap_auth_tls should not be set to true, since that will cause cypht to attempt to connect with TLS. Can you change that, rebuild your config, and see if that helps?

Thanks!

<!-- gh-comment-id:175847679 --> @jasonmunro commented on GitHub (Jan 27, 2016): > specifity of my Dovecot setup is that it announces login only after STARTTLS. If you are using STARTTLS, then imap_auth_tls should not be set to true, since that will cause cypht to attempt to connect with TLS. Can you change that, rebuild your config, and see if that helps? Thanks!
Author
Owner

@mbakhterev commented on GitHub (Jan 28, 2016):

@jasonmunro Thanks! This works.

<!-- gh-comment-id:175978736 --> @mbakhterev commented on GitHub (Jan 28, 2016): @jasonmunro Thanks! This works.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#17
No description provided.