-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_domain_edit.html
More file actions
171 lines (153 loc) · 8.17 KB
/
Copy pathadmin_domain_edit.html
File metadata and controls
171 lines (153 loc) · 8.17 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
{{define "content"}}
<div class="admin-panel">
<div class="admin-header">
<h2>{{if .IsNew}}Add Domain{{else}}Edit Domain: {{.Domain.Domain}}{{end}}</h2>
<a href="/admin/domains" class="btn">← Back to Domains</a>
</div>
{{if .Message}}
<div class="alert alert-success">{{.Message}}</div>
{{end}}
{{if .Error}}
<div class="alert alert-error">{{.Error}}</div>
{{end}}
<form method="POST" class="admin-form">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<div class="form-group">
<label for="domain">Domain Name</label>
<input type="text" id="domain" name="domain" value="{{.Domain.Domain}}"
placeholder="example.com" required {{if not .IsNew}}readonly{{end}}>
{{if not .IsNew}}<small>Domain name cannot be changed after creation.</small>{{end}}
</div>
<div class="form-row">
<div class="form-group">
<label for="dkim_selector">DKIM Selector</label>
<input type="text" id="dkim_selector" name="dkim_selector"
value="{{.Domain.DKIMSelector}}" placeholder="mail">
</div>
<div class="form-group">
<label for="dkim_algorithm">DKIM Algorithm</label>
<select id="dkim_algorithm" name="dkim_algorithm">
<option value="ed25519" {{if eq .Domain.DKIMAlgorithm "ed25519"}}selected{{end}}>Ed25519 (recommended)</option>
<option value="rsa" {{if eq .Domain.DKIMAlgorithm "rsa"}}selected{{end}}>RSA-2048</option>
</select>
</div>
</div>
<div class="form-group">
<label>
<input type="checkbox" name="is_active" value="1" {{if .Domain.IsActive}}checked{{end}}>
Domain is active (accepts and sends mail)
</label>
</div>
<div class="form-group">
<label>
<input type="checkbox" name="require_tls" value="1" {{if .Domain.RequireTLS}}checked{{end}}>
Require TLS for outbound mail (enforce STARTTLS with remote servers)
</label>
</div>
<div class="form-group">
<label for="dane_enforcement">DANE Verification (RFC 6698)</label>
<select id="dane_enforcement" name="dane_enforcement">
<option value="disabled" {{if eq .Domain.DANEEnforcement "disabled"}}selected{{end}}>Disabled (standard TLS only)</option>
<option value="optional" {{if eq .Domain.DANEEnforcement "optional"}}selected{{end}}>Optional (log warnings if TLSA records exist but don't match)</option>
<option value="required" {{if eq .Domain.DANEEnforcement "required"}}selected{{end}}>Required (fail delivery if TLSA records don't match)</option>
</select>
<small>DANE provides additional security by validating TLS certificates against DNS TLSA records. See <a href="https://tools.ietf.org/html/rfc6698" target="_blank">RFC 6698</a>.</small>
</div>
<div class="form-group">
<label>
<input type="checkbox" id="greylisting_enabled" name="greylisting_enabled" value="1" {{if .Domain.GreylistingEnabled}}checked{{end}}>
Enable Greylisting (spam mitigation)
</label>
<small>Greylisting temporarily rejects mail from unknown sender/IP combinations, allowing legitimate senders to retry after a delay while blocking most spam bots.</small>
</div>
<div class="form-group" id="greylisting_delay_group" {{if not .Domain.GreylistingEnabled}}style="display:none;"{{end}}>
<label for="greylisting_delay_minutes">Greylisting Delay (minutes)</label>
<input type="number" id="greylisting_delay_minutes" name="greylisting_delay_minutes" min="5" max="480" value="{{.Domain.GreylistingDelayMins}}" placeholder="15">
<small>How long to wait before accepting mail from new sender/IP combinations (5-480 minutes, default 15 minutes).</small>
</div>
<div class="form-group">
<label>
<input type="checkbox" id="tarpitting_enabled" name="tarpitting_enabled" value="1" {{if .Domain.TarpittingEnabled}}checked{{end}}>
Enable Tarpitting (spam bot slowdown)
</label>
<small>Tarpitting introduces artificial delays on repeated invalid SMTP commands, making spam campaigns inefficient while not affecting legitimate mail servers.</small>
</div>
<div class="form-group" id="tarpitting_delay_group" {{if not .Domain.TarpittingEnabled}}style="display:none;"{{end}}>
<label for="tarpitting_max_delay_seconds">Tarpitting Max Delay (seconds)</label>
<input type="number" id="tarpitting_max_delay_seconds" name="tarpitting_max_delay_seconds" min="1" max="30" value="{{.Domain.TarpittingMaxDelaySecs}}" placeholder="8">
<small>Maximum delay to apply (1-30 seconds, default 8 seconds). Progressive delays: 0s → 1s → 2s → 4s → max.</small>
</div>
<script>
document.getElementById('greylisting_enabled').addEventListener('change', function() {
document.getElementById('greylisting_delay_group').style.display = this.checked ? 'block' : 'none';
});
document.getElementById('tarpitting_enabled').addEventListener('change', function() {
document.getElementById('tarpitting_delay_group').style.display = this.checked ? 'block' : 'none';
});
</script>
<button type="submit" class="btn btn-primary">{{if .IsNew}}Create Domain{{else}}Save Changes{{end}}</button>
</form>
{{if not .IsNew}}
<!-- DKIM Key Management -->
<div class="admin-section">
<h3>DKIM Keys</h3>
{{if .Domain.DKIMPublicKey}}
<div class="alert alert-success">DKIM keys are configured.</div>
{{else}}
<div class="alert alert-warning">No DKIM keys generated. Click below to generate.</div>
{{end}}
<form method="POST" action="/admin/domain/dkim/{{.Domain.ID}}" class="inline-form">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<button type="submit" class="btn btn-primary"
{{if .Domain.DKIMPublicKey}}onclick="return confirm('This will replace existing DKIM keys. Are you sure?')"{{end}}>
{{if .Domain.DKIMPublicKey}}Regenerate DKIM Keys{{else}}Generate DKIM Keys{{end}}
</button>
</form>
</div>
<!-- DNS Records -->
<div class="admin-section">
<h3>DNS Records</h3>
<p>Configure these DNS records for <strong>{{.Domain.Domain}}</strong> at your DNS provider:</p>
<table class="dns-table">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Value</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{{range .DNSRecords}}
<tr>
<td><code>{{.Type}}</code></td>
<td><code class="dns-name">{{.Name}}</code></td>
<td>
<div class="dns-value-wrap">
<code class="dns-value">{{.Value}}</code>
<button type="button" class="btn btn-sm copy-btn" onclick="copyToClipboard(this, '{{.Value}}')">Copy</button>
</div>
</td>
<td class="dns-comment">{{.Comment}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<!-- Accounts quick link -->
<div class="admin-section">
<h3>Accounts</h3>
<a href="/admin/accounts?domain={{.Domain.ID}}" class="btn">Manage Accounts for {{.Domain.Domain}}</a>
<a href="/admin/account/edit/new?domain={{.Domain.ID}}" class="btn btn-primary">+ Add Account</a>
</div>
{{end}}
</div>
<script>
function copyToClipboard(btn, text) {
navigator.clipboard.writeText(text).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 2000);
});
}
</script>
{{end}}