Closed phdoerfler closed 7 years ago
You are right, it should be taken care of by the "hashedPassword" option. Thanks for the detailed report, I'll try to reproduce the bug as soon as I find some time.
Ok I tried, but I cannot reproduce this. Here is my config on a clean Virtual Box
{
network.description = "mail server";
mailserver =
{ config, pkgs, ... }:
{
imports = [
./../default.nix
];
mailserver = {
enable = true;
domain = "example.com";
hostPrefix = "mail";
loginAccounts = {
user1 = {
hashedPassword = "$6$/z4n8AQl6K$kiOkBTWlZfBd7PvF5GsJ8PmPgdZsFGN1jPGZufxxr60PoR0oUsrvzm2oQiflyz5ir9fFJ.d/zKm/NgLXNUsNX/";
};
};
virtualAliases = {
info = "user1";
postmaster = "user1";
abuse = "user1";
};
};
};
}
(the password is user1
). After deploying I log in with the same openssl command you use, to get
.
.
.
Verify return code: 18 (self signed certificate)
Extended master secret: no
---
. OK Pre-login capabilities listed, post-login capabilities have more.
a login user1@example.com user1
* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SPECIAL-USE
a OK Logged in
I think once the user1@example.com
user is created, Nixos
will not update the password anymore if you change the hashPassword value. To test if this is the problem, maybe try to define a new user (user2
) and see if it works for that. If you can still reproduce, can you check /etc/shadow
if it contains the correct password?
Interesting. I shall try this. FYI @Infinisil was able to reproduce this issue as well.
I've added a test (tests/userPassword.nix
) to ensure that the user is created and password is set correctly.
Just tried it: A new user with a user name not previously used does have the password correctly set. I can not reproduce the issue there.
Does the test get called automatically or does it have to be invoked manually?
Ok, so I guess you can also fix it by manually deleting the user before rebuilding. Since I'm always testing on fresh Virtual Box images, I don't run into this much. On the other hand there is not much we can do, since this is how Nixos handles user passwords.
Unfortunately the tests have to be run manually so far, because I have no idea how to integrate them with a CI solution. I guess I'd need to set up a hydra instance for that.
Just installed this module and found that I had to invoke
to allow "user1" to actually log in via IMAP. Shouldn't this be covered by the nix files already?
The error message (as given from dovecot to the IMAP client):
I tested this with
Showing up in the logs was this (after I set various logging options in dovecot) (faithfully reproduction):
A faithful reproduction of my config: