I want to use dovecot as a local IMAP server to serve my offlineimap synced mails to gnus. I have installed the dovecot package via my configuration.nix. however I am having trouble configuring it, seeing where the log files are, etc. I copy the configuration files (dovecot.conf and config.d) from /nix/store/dovecot/share/doc/dovecot/example-config. I can then modify slightly the files to allow plain login (no ssl required) just to test.I can start dovecot (as root). I see the process running, the relevant ports are open and listening, e.g. 143. Everything looks OK. No crashes. However when I telnet localhost 143 (for imap) to test, I am connected and then immediately the connection is closed by foreign host. This is not what I expect from the Dovecot Wiki. I should get a statement that Dovecot is ready …
Additionally, the command doveadm log find responds with:
Looking for log files from /var/log
Debug: Not found
Info: Not found
etc.
So there seem to be no log files. journalctl -u dovecot2.service shows logs begin …, end at …
No entries, so no issues ? I cannot find a log file which tells me why the connection on 143 is immediately closed.
I am at a loss what is going on. Is it to do with users needed, etc ? Appreciate any help. Can post doveconf -n if needed.
How about configuring services.dovecot in configuration.nix instead of trying to run it manually? It’s supposed to be the correct way to run a service.
(I don’t have any experience with this software, inside or outside of Nixos. So I don’t know of any specifics.)
Yes, I was starting to understand that would be the better way to start dovecot. I am new to nixos so I see that that is the standard way to run a service.
However, I think that the problem is more to do with configuring the software rather than how I start it. It may be though that I am not getting error logging in, e.g. /var/log/mail.log because it is not started with systemd ?
NixOS tends to configure server software in a way that differs considerably from upstream defaults. So possibly your system just doesn’t have the necessary environment (users, directories, filesystem access rights, etc.) to properly run your configuration; the dovecot2 module (activated via services.dovecot2) would provide the necessary environment and the necessary configuration.
That is very useful rasendubi, thanks. And that relates to pvgoran’s second comment. I also think that the problem is that I don’t have the necessary environment set up (users, directories, etc). I will setup using the dovecot2 module as in rasendubi’s link and see from there if I have more problems.
Thanks everyone. I have a setup working now. It needs some refinement but basically works. The key was, of course, setting up the dovecot2 module as a service in my configuration.nix. Then the environment was established for me. Clearly I need to understand better the nixos approach (I have been using arch and ubuntu up to now).
I managed to have thunderbird connect to my local dovecot imap server with @taohansen configuration.nix example, but I’m wondering if I should activate ssl. For now, I set up an new account in thunderbird connecting to “localhost:143” with “Connection security: None” and “Authentication method: Password, transmitted insecurely”.
Since I’m only connecting to localhost, is there any security problem with this setup? Should I use ssl, and if so, could someone point me to a configuration example?