fix(email-options):
This commit is contained in:
17
module.nix
17
module.nix
@@ -98,13 +98,13 @@ in
|
||||
# services.postfix.config = {
|
||||
# smtp_sasl_auth_enable = "yes";
|
||||
# smtp_sasl_security_options = "";
|
||||
# smtp_sasl_password_maps = "texthash:/run/postfix/mastodon.cf";
|
||||
# virtual_mailbox_maps = [ "hash:/run/postfix/mastodon.cf" ];
|
||||
# smtp_sasl_password_maps = "texthash:/run/keys/mastodon/hashed_email_password";
|
||||
# virtual_mailbox_maps = [ "hash:/run/keys/mastodon/hashed_email_password" ];
|
||||
# };
|
||||
# mailserver.loginAccounts."noreply.mastodon@${sp.domain}" = {
|
||||
# mailserver.loginAccounts."mastodon@${sp.domain}" = {
|
||||
selfprivacy.emails."noreply.mastodon" = {
|
||||
hashedPasswordFile = "/run/postfix/mastodon.cf";
|
||||
hashedPasswordFile = "/run/keys/mastodon/hashed_email_password";
|
||||
systemdTargets = [ "mastodon-email-password-setup.service" ];
|
||||
sendOnly = false; # TODO
|
||||
};
|
||||
@@ -117,19 +117,18 @@ in
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "gen-mastodon-email-password" ''
|
||||
export password=$(head -c 32 /dev/urandom | base64 | sed 's/[+=\\/A-Z]//g')
|
||||
mkdir /run/keys/mastodon/ || true # Create /run/keys/mastodon if it doesn't exist
|
||||
|
||||
rm -f /run/keys/mastodon/email_password || true
|
||||
mkdir /run/keys/mastodon/ || true # Create /run/keys/mastodon if it doesn't exist
|
||||
echo $password > /run/keys/mastodon/email_password
|
||||
chmod 400 /run/keys/mastodon/email_password
|
||||
chown ${config.services.mastodon.user}:${config.services.mastodon.group} /run/keys/mastodon/email_password
|
||||
|
||||
rm -f /run/postfix/mastodon.cf || true
|
||||
mkdir /run/postfix/ || true # Create /run/postfix if it doesn't exist
|
||||
rm -f /run/keys/mastodon/hashed_email_password || true
|
||||
export hashedPassword=$(${lib.getExe pkgs.mkpasswd} -sm bcrypt "$password")
|
||||
echo "$hashedPassword" > /run/postfix/mastodon.cf
|
||||
chmod 440 /run/postfix/mastodon.cf
|
||||
chown ${config.services.postfix.user}:${config.services.postfix.group} /run/postfix/mastodon.cf
|
||||
echo "$hashedPassword" > /run/keys/mastodon/hashed_email_password
|
||||
chmod 440 /run/keys/mastodon/hashed_email_password
|
||||
chown ${config.services.postfix.user}:${config.services.postfix.group} /run/keys/mastodon/hashed_email_password
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user