Add caDir and move serialDir into Config.Bind
[hcoop/domtool2.git] / lib / easy_domain.dtl
1 {{The most common kinds of domain configuration}}
2
3 val default_node : (node) = "navajos";
4 val web_node : (web_node) = "navajos";
5 val web_ip = ip_of_node (web_node_to_node web_node);
6
7 val webAt =
8 \ n : (web_node) ->
9 \ host : (host) ->
10 \\ config : Vhost -> begin
11 dns (dnsA (literal host) (ip_of_node (web_node_to_node n)));
12
13 vhost host where
14 WebPlaces = [web_place_default n]
15 with
16 config
17 end
18 end;
19
20 val web = \ host -> \\ config : Vhost -> begin
21 n <- DefaultWebNode;
22 webAt n host with config end;
23 end;
24
25 val webAtIp =
26 \ ip : (your_ip) ->
27 \ host : (host) ->
28 \\ config : Vhost -> begin
29 dns (dnsA (literal host) (your_ip_to_ip ip));
30
31 vhost host where
32 WebPlaces = [web_place web_node ip]
33 with
34 config
35 end
36 end;
37
38 val addDefaultAlias = begin
39 mailbox <- Mailbox;
40 source <- DefaultAliasSource;
41 aliasPrim source (addressTarget mailbox)
42 end;
43
44 val addWww = begin
45 web "www" with
46 serverAliasDefault;
47 www : [Vhost] <- WWW;
48 www
49 end
50 end;
51
52 val dom =
53 \ d : (your_domain) ->
54 \\ config : Domain ->
55 domain d with
56 dns (dnsNS "ns1.hcoop.net");
57 dns (dnsNS "ns2.hcoop.net");
58
59 user_web_node <- DefaultWebNode;
60
61 defa : bool <- DefaultA;
62 if defa then
63 dns (dnsA default (ip_of_node (web_node_to_node user_web_node)))
64 else
65 Skip
66 end;
67
68 hmail : bool <- HandleMail;
69 if hmail then
70 handleMail
71 else
72 Skip
73 end;
74
75 amx : bool <- AddMX;
76 if amx then
77 dns (dnsMX 1 "mail.hcoop.net")
78 else
79 Skip
80 end;
81
82 createWWW : bool <- CreateWWW;
83 if createWWW then
84 addWww
85 else
86 Skip
87 end;
88
89 defAl : bool <- DefaultAlias;
90 if defAl then
91 addDefaultAlias
92 else
93 Skip
94 end;
95
96 config
97 end;
98
99 val nameserver = \host -> dns (dnsNS host);
100 val dnsIP = \from -> \to -> dns (dnsA (literal from) to);
101 val dnsIPv6 = \from -> \to -> dns (dnsAAAA (literal from) to);
102 val dnsMail = \num -> \host -> dns (dnsMX num host);
103 val dnsAlias = \from -> \to -> dns (dnsCNAME (literal from) to);
104 val dnsDefault = \to -> dns (dnsA default to);
105 val dnsDefaultv6 = \to -> dns (dnsAAAA default to);
106 val dnsText = \from -> \to -> dns (dnsTXT (srv_literal from) to);
107 val dnsDefaultText = \to -> dns (dnsTXT srv_default to);
108
109 val dnsWildcardIP = \to -> dns (dnsA wildcard to);
110
111 val addDefaultSPF = dnsDefaultText "v=spf1 mx -all";