Tuesday, November 16, 2010

OpenBSD NC4200: Alpine + DavMail: DavMail configurations.

A bit of personal history. Bear with me as it might get you bored to death as it will be a long one. Ok, my company uses MS Exchange for emails. And, wait, I guess that just sums it up. Company uses MS Exchange, bla bla, I don't want to use Outlook, bla bla, I don't want to use MS Windows, bla bla so here I am. Basically, I just want to use Alpine / Thunderbird to access my company's exchange so I can receive and send emails. Bit of details about my profile and the company's email (this won't be a real one, just to show you how I done it):

Email: karl.bsd@company.com
Username: ASIA\karl
OWA Exchange: https://owa.company.com/exchange/

As you can see, the Username for me to log in to the OWA is different than my email add. To make things a bit more complicated, my internet access is through a http proxy which I will name as http://my.proxy.com at port 8080. Ok enough history class, now on to the good stuff.

For DavMail, it comes zipped with quite some files inside. From DavMail's website, I choose Workstation (personal) mode > Other DavMail release. What contains inside mine is:

lib (folder with lots of *.jar files)
davmail.jar
davmail.sh


I created ~/davmail/ folder and extracted the archive inside it. In basic, I can just use:

$ sh ~/davmail/davmail.sh &

And the familiar DavMail icon will appear in XFCE's taskbar. But that's for XFCE. As wmii's status bar is not a task bar, DavMail will not have the icon. In XFCE, right clicking the DavMail icon and choosing settings, I just put my OWA address in the DavMail url. Then I choose to set the proxy server with the 8080 port. I left all the other setting to default.

XFCE + Thunderbird + DavMail:
This part is quite easy. There's numerous documentations / HOWTOs on this. Even the official DavMail website have tutorial on setting up Thunderbird to work with DavMail. I just follow the documentation and it's working ok. I can send receive emails, do LDAP queries and even sync with the company's calendar using Thunderbird+Lightning+CalDav. Just remember to install lightning using packages as there will be none available in Thunderbird's AddOn website for OpenBSD. As I've stated earlier, sh ~/davmail/davmail.sh & is enough to get you started with DavMail in XFCE.

wmii + Alpine + DavMail:
Now this is THE thing. wmii and normal DavMail don't quite play nicely. By saying "normal" I mean using the command I stated above. There's no taskbar for DavMail to icon-er-ify(?) to. The solution? A quick google and I found something about DavMail configuration file. Shamelessly following the said information, I created davmail.properties file inside ~/davmail/ folder. Here's my davmail.properties file, important bits are bolded for your pleasure:

davmail.url=https://owa.company.com/exchange/
davmail.popPort=1110
davmail.imapPort=1143
davmail.smtpPort=1025
davmail.caldavPort=1080
davmail.ldapPort=1389
davmail.keepDelay=30
davmail.sentKeepDelay=90
davmail.imapIdleDelay=
davmail.useSystemProxies=false
davmail.enableProxy=true
davmail.proxyHost=my.proxy.com
davmail.proxyPort=8080

davmail.proxyUser=
davmail.proxyPassword=
davmail.ssl.keystoreType=JKS
davmail.ssl.keyPass=
davmail.ssl.keystorePass=
davmail.server=true
davmail.server.certificate.hash=
davmail.bindAddress=
davmail.allowRemote=true
davmail.disableUpdateCheck=false
log4j.rootLogger=WARN
log4j.logger.davmail=DEBUG
log4j.logger.org.apache.commons.httpclient=WARN
log4j.logger.httpclient.wire=WARN
davmail.logFilePath=/var/log/davmail.log


For davmail.proxyHost=, previously I was tearing my hairs apart because normal DavMail is working fine but not so when I use the davmail.properties file. When I tried using my.proxy.com instead of http://my.proxy.com, wallah! The earth smiles back at me. davmail.useSystemProxies= is "false" and davmail.enableProxy= is "true" so that instead of using the (currently malfunctioned) System Proxy, DavMail will use the proxy address I specified. Then I need to set the davmail.server= to "true" so that DavMail will not show any icon / GUI and be in daemon mode. I also need to chmod the /var/log/ folder so that DavMail can properly write logs inside there. After all is done, I do testing with:

$ sudo sh ~/davmail/davmail.sh ~/davmail/davmail.properties &

I opened up Thunderbird and all is good. Now to get DavMail started everytime I log in wmii. I mentioned earlier that I use SLiM login manager to replace xdm. SliM can let me choose what window manager / desktop environment I want to log in and that's something xdm currently don't have. I posted my ~/.xinitrc script earlier and this is the changes I need to make to get DavMail started after my login:

# This is for SLiM

case $1 in
wmii)
 xscreensaver &
 nohup sh ~/davmail/davmail.sh ~/davmail/davmail.properties &
 eval `cat ~/.fehbg`
 exec wmii
 ;;


You can follow the rest of the script by searching my previous post. As for the nohup, man nohup will give you great explaination. I log out from wmii and re-login. Open up Thunderbird and it's working alright. Eh, wait.. Thunderbird?! Where's the Alpine's stuff?! Whoa hold yer horses mate. That part will need another post.

Coming up next. Getting Alpine to work with DavMail. Or almost.

No comments:

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 ...