:: krowemoh

Tuesday | 01 APR 2025
Posts Links Other About Now

previous
next

Himalaya

2025-03-18
rust, mail

I really want to get himalaya working so that I could get my outlook mail from BASIC and having a CLI tool is the best way of doing that. However himalaya is proving to be quite difficult.

Keyrings

The first issue I ran into was with keyrings and secrets. I'm not sure why but I'm guessing for security reasons, himalaya is relying on the system keyrings to manage passwords. This is great in theory but it looks like there is still much to be desired from it. There is an issue with gnome-keyring which I would have guessed was a gnome only utility but it doesn't appear to be. Instead it seems to be the defacto password manager on linux. I guess?

I had to kill gnome-keyring-daemon and then restart it to get the secret-tool to work properly. Not sure what the relationship between the two us but secret-tool looks to be the CLI tool while gnome-keyring is the database of passwords. I also restarted dbus which was a bad idea as it broke my ssh logins badly. It had caused it to lag up quite a bit.

Himalaya

Once I had the keyring stuff sorted, I could finally run himalaya and actually get some relevant errors.

The first issue is that outlook seems to have deprecated the basic login so you can't use just username and password. I may be incorrect about this as it's just a vague recall of something I may have read.

Possibly relevant links:

https://github.com/pimalaya/himalaya/issues/501

https://techcommunity.microsoft.com/blog/exchange/basic-authentication-deprecation-in-exchange-online-%e2%80%93-september-2022-update/3609437

I decided to try setting up oauth and so I went through the flow of setting up my application and giving the permissions through Entra.

https://entra.microsoft.com

Once I had the application set up with permissions, I could then generate a secret and save that. The client id is also important.

Make sure to setup a redirect URL as well in entra as we will need that.

Armed with these two things, the next step was to actually build out a himalaya configuration. This was also a pain as it looks like URLs for microsoft have changed and so the example ones don't work anymore.

I got the URLs switched to the new ones and I could finally trigger the auth flow.

Another large issue was that I was trying to use localhost while trying to set things up on a server. This meant the redirects were all sorts of screwed up.

I ultimately ended up using caddy on my machine so that the localhost redirect would hit my local server. This will then forward it to nginx which would in turn pass it to himalaya.

Why is nginx in the middle? Fuck if I know, himalaya wasn't getting the messages, I had already opened up the firewall and everything look good. However requests weren't going through.

I did see that himalaya was binding to tcp6 but I don't think that was the problem though it might be. Regardless, I didn't want to deal with that so I tossed nginx into the mix.

After all that I got an Authentication Success! message which was great. Then I checked himalaya and saw that it had thrown an error and hadn't finished the flow. I'm not sure if the message is accurate and it failed to save or it had broke much earlier and was just giving me a bad message.

I've opened a github issue so hopefully I can get this working.

Once I do, the plan is to write some documentation as I think there is some logic in this madness and that it's only complex because I'm trying to discover things as I go.

A proper guide would do a lot to simplify this mess.