Baikal icon indicating copy to clipboard operation
Baikal copied to clipboard

IMAP Authentication added to Baikal

Open n-connect opened this issue 4 months ago • 0 comments

Moving this week from another calendar server to Sabre/dav -> Baikal needed the IMAP auth capability. After checking #52 #869 #656 plus some Google search here is a fully working IMAP auth extension for Baikal, including Webadmin UI and saving the IMAP connection data into baikal.yaml. I'm no PHP coder, used the existing coding style to add the functionality (the PHP-CS fixer throws errors for some reasons, not checked).

Highlights :

  • Model/Config/Standard.php extended: to have "imap_connection" value saved into baikal.yaml config file plus the Webadmin UI got a new connected field to be able to see/read/modify the IMAP connection
  • Core/Server.php extended: to be able to use imap_connection from baikal.yaml
  • Including Sabre.io/dav v4.6.0 IMAP Auth Backend code, under /Core/Frameworks/Baikal/Core/
  • web-admin UI settings Standard.php updated, the new IMAP connection text field shows only if IMAP selected as auth type. The connected Listbox now has the "refreshonchange" property as "true" . As a consequence, during install, manipulating the Auth type listbox throws an exception on Admin passwd fields (just type "1" twice in the PW field to be able to change Auth type multiple times during install)

Tested with:

  • UNIX/Linux IMAP server on tcp/993 over SSL valid public certificate
  • based on Sabre/dav, it should work with any other IMAP flavors, eg. port 143 with StartTLS

Usage:

  • install as usual
  • in Web-admin UI set for IMAP auth, and add/edit to your IMAP server details. Additional info in Sabre/dav Authenticaton or PHP's imap_open docs
  • default string set to localhost:993, make sure you have your IMAP server details right, save it
  • create 1 to N users in web-admin (I've set the usernames as full e-mail address), set arbitrary passwords for these accounts -> then add them in your(their) calendar via the e-mail account's password in the calendar app.
  • For me the calendar URL setup worked like this: calendarserver.com/dav.php/principals/[email protected]/

If you want to disable web-admin UI after your configuration is done:

  • set your NGINX/Lighthttpd's config index to another filename than index.php,
  • or deny the index.php -> until the Baikal adds this functionality into the code/baikal.yaml

TODO:

  • imap connection validation(?)

Working code can be downloaded/tested from my fork

n-connect avatar Oct 05 '24 11:10 n-connect