Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP Authentication added to Baikal #1292

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

n-connect
Copy link

@n-connect n-connect commented Oct 5, 2024

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

IMAP auth added:
- Standard.php extended, having imap_connection saved into baikal.yaml config file & Webadmin UI got a new conneted field to read/modify the IMAP connection
- Server.php modified, to be able to use imap_connection from baikal.yaml

Including Sabre.io/dav v4.6.0 IMAP Auth code, some tweaking
The web-admin UI now handles the additional IMAP connection input field as it is in the database settings page: when IMAP selected the field rendered, if not it gots hidden.

(No validation built-in)
Fix: remove declaration of non-existent validation-hook
The unchanged IMAP.php from sabre.io/dav got updated:
- the Baikal namespace & class extension
- the GitHub PR at Baikel using different PHP-CS requirements than the one at Sabre.io/dav -> CS has been aligned to Baikal's one

The same CS alignation applied to:
- Core/Server.php
- Model/Config/Standard.php
- Controller/Settings/Standard.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant