summaryrefslogtreecommitdiff
path: root/hosts/cloud/bkk/jmap.nix
blob: bb1fd90493815206a477c69f7103c74d528326d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
  config,
  pkgs,
  ...
}: let
  domain = "mail.urbit.men";
in {
  services.stalwart-mail = {
    enable = true;
    settings = {
      authentication.fallback-admin = {
        user = "admin";
        secret = "xdxdxdxd";
      };
      server = {
        hostname = domain;
        # run-as = {
        #   user = "y";
        #   group = "users";
        # };
        http.use-x-forwarded = true;
        tls = {
          enable = true;
          certificate = "default";
          implicit = false;
        };

        listener = {
          "imap" = {
            bind = ["[::]:143"];
            protocol = "imap";
            tls.implicit = false;
          };
          "imaps" = {
            bind = ["[::]:993"];
            protocol = "imap";
            tls.implicit = true;
          };
          "smtp" = {
            bind = ["[::]:25"];
            protocol = "smtp";
            tls.implicit = false;
          };
          "smtp-sub" = {
            bind = ["[::]:587"];
            protocol = "smtp";
            tls.implicit = false;
          };
          "smtps-sub" = {
            bind = ["[::]:465"];
            protocol = "smtp";
            tls.implicit = true;
          };
          "http" = {
            bind = ["127.0.0.1:8080"];
            protocol = "http";
            # tls.implicit = true;
          };
          "sieve" = {
            bind = ["[::]:4190"];
            protocol = "managesieve";
            tls.implicit = true;
          };
        };
        session = {
          rcpt.directory = "in-memory";
          auth = {
            mechanisms = ["PLAIN"];
            directory = "in-memory";
          };
        };
        jmap.directory = "in-memory";
        directory."in-memory" = {
          type = "memory";
          users = [
            {
              name = "alice";
              secret = "foobar";
              email = ["alice@urbit.men"];
            }
            {
              name = "bob";
              secret = "foobar";
              email = ["bob@urbit.men"];
            }
          ];
        };
      };
    };
  };
}