Showing posts with label UW-IMAPD. Show all posts
Showing posts with label UW-IMAPD. Show all posts

Tuesday, March 20, 2012

5.1 amd64 K43U: Alpine > UW-IMAP > OfflineIMAP > Davmail > OWA stuck.

1) Install Alpine+ldap, setting up DavMail.

Install Alpine using port with FLAVOR set to ldap. I just referred to my previous post. So this post will focus more on OfflineIMAP and UW-IMAPd side of the project.

1) Install imap-uw2007

read the /usr/local/share/doc/pkg_readmes/uw-imap-2007f and follow the instruction. For me, I vim /etc/inetd.conf and add:

imap stream tcp nowait root /usr/local/libexec/imapd imapd
imap stream tcp6 nowait root /usr/local/libexec/imapd imapd


And it's also stated a way to enable plain text login. So I vim /etc/c-client.cf and change:

#set disable-plaintext nil

to

set disable-plaintext nil

You can restart inetd, but I just reboot. Then I telnet to localhost:143.

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 I18NLEVEL=1 LITERAL+ SASL-IR LOGIN-REFERRALS STARTTLS] localhost IMAP4rev1 2007f.404 at Tue, 20 Mar 2012 13:27:16 +0800 (MYT)


So far so good. In Alpine I just need to Add Folder collection (S+L+A) with the details:

Nickname: UW-IMAPd
Server: localhost:143
Path: mail/MyCompany/INBOX/
View:


Then after I saved the settings, inside folder list (L) Alpine will ask for my username (same as my OpenBSD's login name) and password (also same as my OpenBSD's password) then I can manipulate my IMAP's INBOX folder. I can add folders, delete etc. So this part is ok.

3) Installing and configuring OfflineIMAP.

I installed OfflineIMAP from OpenBSD's packages. Then I create ~/.offlineimaprc and put the basic as stated in offlineimap.org.

[general]
accounts = MyCompany

[Account MyCompany]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = IMAP
remotehost = localhost
remoteport = 143
remoteuser = karl

[Repository Remote]
type = IMAP
remotehost = locahost
remoteport = 1143
remoteuser = ASIA\karl


Then I run OfflineIMAP by issuing offlineimap. Lo and behold, I got this error:

$ offlineimap
OfflineIMAP 6.3.4
Copyright 2002-2011 John Goerzen & contributors.
Licensed under the GNU GPL v2+ (v2 or any later version).

Account sync MyCompany:
***** Processing account MyCompany
Copying folder structure from IMAP to MappedIMAP
Establishing connection to localhost:1143.
WARNING: Error occured attempting to sync account 'MyCompany':
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/offlineimap/accounts.py", line 177, in syncrunner self.sync()
File "/usr/local/lib/python2.7/site-packages/offlineimap/accounts.py", line 235, in sync remoterepos.syncfoldersto(localrepos, [statusrepos])
File "/usr/local/lib/python2.7/site-packages/offlineimap/repository/Base.py", line 124, in syncfoldersto srcfolders = src.getfolders()
File "/usr/local/lib/python2.7/site-packages/offlineimap/repository/IMAP.py", line 303, in getfolders self.accountname, self))
File "/usr/local/lib/python2.7/site-packages/offlineimap/folder/IMAP.py", line 32, in __init__ self.name = imaputil.dequote(name)
File "/usr/local/lib/python2.7/site-packages/offlineimap/imaputil.py", line 36, in dequote if not (string[0] == '"' and string[-1] == '"'): IndexError: string index out of range

***** Finished processing account MyCompany


Eh. Bah. Something is wrong somewhere. Help....

Wednesday, November 24, 2010

OpenBSD NC4200: Getting Alpine to work with DavMail.

Firstly, yeah I changed the blog's title. As I'm using ONLY OpenBSD nowadays, I think it's appropriate to change the title as I don't use other type of BSD. Now back to the main story.

So far, this is a brief description of what I (initially) wanted to achieve:

Alpine+LDAP <---> DavMail <---> CompanyEmail@OWA/Exchange

So here's what I'm currently doing. Getting Alpine + DavMail to play nicely together. I have posted earlier that I compiled my Alpine with LDAP support so I can check my company's email address book. Here's the current status of the project:

DavMail <---> CompanyEmail@OWA: Working fine
Thunderbird <---> DavMail: Working fine

As DavMail is working, I can just focus on configuring Alpine. The first time I start Alpine (by typing Alpine in xterm), the program will create ~/.pinerc configuration file. I don't need to blow my head to configure Alpine as it has a great built-in configuration tool.

Chapter 1: Receiving emails.
Inside Alpine's Main menu [M], I just key [S] (Setup), [L] (collectionLists). Then inside Alpine's Setup Collection List page, I hit [A] (Add collection). Here's my configurations:

Nickname: MyCompany
Server: localhost:1143/user=ASIA\karl
Path:
View:


After I save & exit the configuration [Ctrl+X], Alpine requested for my email's password. I keyed in my password and Alpine ask for confirmation to exit the page. No error messages, so it's all good. Now to test it.

I go to Main [M], then hit [L] (Folder List). I can see 2 folders:

MAIL
   Local folders in mail/

MyCompany
   Folders on localhost:1143/user=ASIA\karl in home directory


I choose MyCompany and using the Right Arrow [>] key, Alpine opened up my company email. I can see all the folders I have there and I can read my emails. So far so good.

Chapter 2: Sending emails (Working now!).
I'm still configuring this part as it's not working. I'll just put the steps for revising purpose. If you have a working solution, do comment.

Thanks to Christopher for commenting and posting a usefull link. Surely, I managed to tweak Alpine's setting and managed to get the SMTP portion working for sending emails. Do take note that I'm already running a new version of DavMail so it'll be better for you guys to update too.

Inside Alpine's Main menu, I choose [S] (Setup) and [C] (Config). The mandatory line to be update is this:

SMTP Server (for sending) = localhost:1025/user=ASIA\karl

So here, I don't need to use user=ASIA\\karl because the single \ is not escaped.
As I stated, it's currently not working. I kept getting "Error sending" message if I want to send out email. Previously I tried user=ASIA\karl but the "\" got escaped in ~/.pinerc and I still can't send email.

If I can't sort this out, I might have to go with using Sendmail instead of going thru DavMail. I will post any updates on this. I've also added this line in the same Config's screen:

Inbox Path = {localhost:1143/user=ASIA\karl}inbox

Note that this setting depends on whether you need it or not. As I use Alpine only for 1 OWA account, I set this up. Now press [E] to exit and save the setting. Press [Q] to quit Alpine.

Now vim your .pinerc file, normally in your home folder (~/.pinerc) and change this line:

disable-these-authenticators=GSSAPI,PLAIN

Save the .pinerc file and open Alpine back. I composed [C] an email and wallah! Alpine asked for my OWA password and email is sent! Great!. Again, thanks Christopher!

Chapter 3: Using LDAP.
As I've compiled my Alpine with LDAP support, I can use it to search my company's email address book. Inside Alpine's Main menu, I choose [S] (Setup) and [D] (Directory). Inside Alpine's Setup Directory Servers page, I hit [A] (Add dir) and this is my settings:

ldap-server= localhost
search-base= ou=people
port= 1389
bind-dn= ASIA\karl
nickname= MyCompany


Then I hit [E] (Exit Setup) and [Y] to save changes. [E] to exit the Setup Directory Servers page.

To test out, inside Alpine's Main menu, I hit [A] (Address Book) and select MyCompany. I hit the Right Arrow [>] key and type a name to search. Alpine then requested for my password and after a while, list of matches appears. So this part is working too.

Chapter 4: Offline email reading.
Yes, there's no offline reading for Alpine using IMAP. So now I know. That's one of the most important feature I wanted to use. After searching for solutions, I found the most suitable option. This is the latest description of the (possible) solution:

Alpine+LDAP <---> UW-IMAPD <---> OfflineIMAP <---> DavMail <---> CompanyEmail@OWA

So, instead of getting Alpine to directly access DavMail, Now I need to set up UW-IMAPD and OfflineIMAP. UW-IMAPD is built as dependency for Alpine+LDAP. UW-IMAPD is a local IMAP server and OfflineIMAP is like what the name means, reading emails from IMAP server in offline mode. Now OfflineIMAP will retrieve emails from my company's exchange thru DavMail (OfflineIMAP can't directly retrieve exchange emails), then OfflineIMAP will sync the emails to my local IMAP server which is UW-IMAPD so I will have a local offline copy of my emails that I can use with Alpine. Here's the checklist of needed softwares:

- Alpine+ldap
- UW-IMAPD
- DavMail
- OfflineIMAP

Update 13/04/11: Thanks to Christopher's comment, I got my email sending working! Thank you very much! You guys should read his comment and go to the link posted. I've update this post to reflect the changes. Later then.

6.5 amd64: Modify existing certbot certificates.

Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...