From f51811b2368c9e908f762add1f295ed5214fe5ba Mon Sep 17 00:00:00 2001 From: Robin Raymond Date: Sun, 13 Aug 2017 15:51:41 +0200 Subject: [PATCH] add password hashes --- README.md | 4 ++-- mail-config.nix | 16 ++++++++++++++-- mail-server/users.nix | 3 ++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index de8fe6c..21942d0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - [x] receive email on submission port 587 - [x] lmtp with dovecot * Dovecot - - [x] lmpto with postfix + - [x] lmtp with postfix - [x] creates maildir folders, saves mails - [x] imap retrieval - [x] pop3 retrieval @@ -27,7 +27,7 @@ - [ ] TODO: Implement * User Management - [x] Creates Users - - [ ] TODO: Set Passwords in config file + - [x] Set Passwords in config file ### How to Test diff --git a/mail-config.nix b/mail-config.nix index d3e0f14..7e990dd 100644 --- a/mail-config.nix +++ b/mail-config.nix @@ -31,9 +31,21 @@ let # # The login account of the domain. Every account is mapped to a unix user, - # e.g. `user1@example.com`. + # e.g. `user1@example.com`. To generate the passwords use `mkpasswd` as + # follows # - login_accounts = [ "user1" "user2" ]; + # ``` + # mkpasswd -m sha-512 "super secret password" + # ``` + # + login_accounts = [ + { name = "user1"; + password = "$6$evQJs5CFQyPAW09S$Cn99Y8.QjZ2IBnSu4qf1vBxDRWkaIZWOtmu1Ddsm3.H3CFpeVc0JU4llIq8HQXgeatvYhh5O33eWG3TSpjzu6/"; + } + { name = "user2"; + password = "$6$oE0ZNv2n7Vk9gOf$9xcZWCCLGdMflIfuA0vR1Q1Xblw6RZqPrP94mEit2/81/7AKj2bqUai5yPyWE.QYPyv6wLMHZvjw3Rlg7yTCD/"; + } + ]; # # Virtual Aliases. A virtual alias { from = "info"; to = "user1"; } means that diff --git a/mail-server/users.nix b/mail-server/users.nix index 3697c6f..e84de1b 100644 --- a/mail-server/users.nix +++ b/mail-server/users.nix @@ -29,9 +29,10 @@ let # accountsToUser :: String -> UserRecord accountsToUser = x: { - name = x + "@" + domain; + name = x.name + "@" + domain; isNormalUser = false; group = vmail_group_name; + hashedPassword = x.password; }; # mail_user :: [ UserRecord ]