blob: 1a28776cf3885636fb1ae71f6cd19f228c7dac3a [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
3
4if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admin") {
5require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
6$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
7$tfa_data = get_tfa();
8$fido2_data = fido2(array("action" => "get_friendly_names"));
9if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CACHE')) {
10 $_SESSION['gal'] = json_decode($license_cache, true);
11}
12?>
13<div class="container">
14
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020015 <ul class="nav nav-tabs responsive-tabs" role="tablist">
16 <li class="dropdown active">
17 <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['access'];?><span class="caret"></span></a>
18 <ul class="dropdown-menu">
19 <li class="active" data-dont-remember="1" role="presentation"><a href="#tab-config-admins" aria-controls="tab-config-admins" role="tab" data-toggle="tab"><?=$lang['admin']['admins'];?></a></li>
20 <!-- <li role="presentation"><a href="#tab-config-ldap-admins" aria-controls="tab-config-ldap-admins" role="tab" data-toggle="tab"><?=$lang['admin']['admins_ldap'];?></a></li> -->
21 <li role="presentation"><a href="#tab-config-oauth2" aria-controls="tab-config-oauth2" role="tab" data-toggle="tab"><?=$lang['admin']['oauth2_apps'];?></a></li>
22 <li role="presentation"><a href="#tab-config-rspamd" aria-controls="tab-config-rspamd" role="tab" data-toggle="tab">Rspamd UI</a></li>
23 </ul>
24 </li>
25
26 <li class="dropdown">
27 <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['configuration'];?><span class="caret"></span></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010028 <ul class="dropdown-menu">
29 <li role="presentation"><a href="#tab-config-dkim" aria-controls="tab-config-dkim" role="tab" data-toggle="tab"><?=$lang['admin']['dkim_keys'];?></a></li>
30 <li role="presentation"><a href="#tab-config-fwdhosts" aria-controls="tab-config-fwdhosts" role="tab" data-toggle="tab"><?=$lang['admin']['forwarding_hosts'];?></a></li>
31 <li role="presentation"><a href="#tab-config-f2b" aria-controls="tab-config-f2b" role="tab" data-toggle="tab"><?=$lang['admin']['f2b_parameters'];?></a></li>
32 <li role="presentation"><a href="#tab-config-quarantine" aria-controls="tab-config-quarantine" role="tab" data-toggle="tab"><?=$lang['admin']['quarantine'];?></a></li>
33 <li role="presentation"><a href="#tab-config-quota" aria-controls="tab-config-quota" role="tab" data-toggle="tab"><?=$lang['admin']['quota_notifications'];?></a></li>
34 <li role="presentation"><a href="#tab-config-rsettings" aria-controls="tab-config-rsettings" role="tab" data-toggle="tab"><?=$lang['admin']['rspamd_settings_map'];?></a></li>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020035 <li role="presentation"><a href="#tab-config-password-policy" aria-controls="tab-config-password-policy" role="tab" data-toggle="tab"><?=$lang['admin']['password_policy'];?></a></li>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010036 <li role="presentation"><a href="#tab-config-customize" aria-controls="tab-config-customize" role="tab" data-toggle="tab"><?=$lang['admin']['customize'];?></a></li>
37 </ul>
38 </li>
39 <li role="presentation"><a href="#tab-routing" aria-controls="tab-routing" role="tab" data-toggle="tab"><?=$lang['admin']['routing'];?></a></li>
40 <li role="presentation"><a href="#tab-sys-mails" aria-controls="tab-sys-mails" role="tab" data-toggle="tab"><?=$lang['admin']['sys_mails'];?></a></li>
41 <li role="presentation"><a href="#tab-mailq" aria-controls="tab-mailq" role="tab" data-toggle="tab"><?=$lang['admin']['queue_manager'];?></a></li>
42 <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['rspamd_global_filters'];?>
43 <span class="caret"></span></a>
44 <ul class="dropdown-menu">
45 <li role="presentation"><a href="#tab-globalfilter-regex" aria-controls="tab-globalfilter-regex" role="tab" data-toggle="tab"><?=$lang['admin']['regex_maps'];?></a></li>
46 </ul>
47 </li>
48 </ul>
49
50 <div class="row">
51 <div class="col-md-12">
52 <div class="tab-content" style="padding-top:20px">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020053 <div role="tabpanel" class="tab-pane active" id="tab-config-admins">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010054 <div class="panel panel-danger">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020055 <div class="panel-heading xs-show"><?=$lang['admin']['admin_details'];?></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010056 <div class="panel-body">
57 <div class="table-responsive">
58 <table class="table table-striped table-condensed" id="adminstable"></table>
59 </div>
60 <div class="mass-actions-admin">
61 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020062 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" id="toggle_multi_select_all" data-id="admins" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>
63 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
64 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010065 <ul class="dropdown-menu">
66 <li><a data-action="edit_selected" data-id="admins" data-api-url='edit/admin' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
67 <li><a data-action="edit_selected" data-id="admins" data-api-url='edit/admin' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
68 <li role="separator" class="divider"></li>
69 <li><a data-action="edit_selected" data-id="admins" data-api-url='edit/admin' data-api-attr='{"disable_tfa":"1"}' href="#"><?=$lang['tfa']['disable_tfa'];?></a></li>
70 <li role="separator" class="divider"></li>
71 <li><a data-action="delete_selected" data-id="admins" data-api-url='delete/admin' href="#"><?=$lang['mailbox']['remove'];?></a></li>
72 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020073 <a class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-id="add_admin" data-toggle="modal" data-target="#addAdminModal" href="#"><i class="bi bi-person-plus-fill"></i> <?=$lang['admin']['add_admin'];?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010074 </div>
75 </div>
76
77 <? // TFA ?>
78 <legend style="margin-top:20px">
79 <?=$lang['tfa']['tfa'];?>
80 </legend>
81 <div class="row">
82 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['tfa']['tfa'];?>:</div>
83 <div class="col-sm-9 col-xs-7">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020084 <p id="tfa_pretty"><?=(isset($tfa_data['pretty'])) ? $tfa_data['pretty'] : '';?></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010085 <div id="tfa_keys">
86 <?php
87 if (!empty($tfa_data['additional'])) {
88 foreach ($tfa_data['additional'] as $key_info) {
89 ?>
90 <form style="display:inline;" method="post">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020091 <input type="hidden" name="unset_tfa_key" value="<?=$key_info['id'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010092 <div style="padding:4px;margin:4px" class="label label-keys label-<?=($_SESSION['tfa_id'] == $key_info['id']) ? 'success' : 'default'; ?>">
93 <?=$key_info['key_id'];?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020094 <a href="#" style="font-weight:bold;color:white" onClick="$(this).closest('form').submit()">[<?=$lang['admin']['remove'];?>]</a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010095 </div>
96 </form>
97 <?php
98 }
99 }
100 ?>
101 </div>
102 <br>
103 </div>
104 </div>
105 <div class="row">
106 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['tfa']['set_tfa'];?>:</div>
107 <div class="col-sm-9 col-xs-7">
108 <select data-style="btn btn-sm dropdown-toggle bs-placeholder btn-default" data-width="fit" id="selectTFA" class="selectpicker" title="<?=$lang['tfa']['select'];?>">
109 <option value="yubi_otp"><?=$lang['tfa']['yubi_otp'];?></option>
110 <option value="u2f"><?=$lang['tfa']['u2f'];?></option>
111 <option value="totp"><?=$lang['tfa']['totp'];?></option>
112 <option value="none"><?=$lang['tfa']['none'];?></option>
113 </select>
114 </div>
115 </div>
116
117 <? // FIDO2 ?>
118 <legend style="margin-top:20px">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200119 <i class="bi bi-shield-fill-check"></i>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100120 <?=$lang['fido2']['fido2_auth'];?></legend>
121 <div class="row">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200122 <div class="col-sm-3 col-xs-12 text-right text-xs-left space20"><?=$lang['fido2']['known_ids'];?>:</div>
123 <div class="col-sm-9 col-xs-12">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100124 <div class="table-responsive">
125 <table class="table table-striped table-hover table-condensed" id="fido2_keys">
126 <tr>
127 <th>ID</th>
128 <th style="min-width:240px;text-align: right"><?=$lang['admin']['action'];?></th>
129 </tr>
130 <?php
131 if (!empty($fido2_data)) {
132 foreach ($fido2_data as $key_info) {
133 ?>
134 <tr>
135 <td>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200136 <?=(isset($_SESSION['fido2_cid']) && $_SESSION['fido2_cid'] == $key_info['cid']) ? '<i class="bi bi-unlock-fill"></i> ' : NULL; ?><?=(!empty($key_info['fn']))?$key_info['fn']:$key_info['subject'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100137 </td>
138 <td style="min-width:240px;text-align: right">
139 <form style="display:inline;" method="post">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200140 <input type="hidden" name="unset_fido2_key" value="<?=$key_info['cid'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100141 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200142 <a href="#" class="btn btn-xs btn-default" data-cid="<?=$key_info['cid'];?>" data-subject="<?=base64_encode($key_info['subject']);?>" data-toggle="modal" data-target="#fido2ChangeFn"><i class="bi bi-pencil-fill"></i> <?=$lang['fido2']['rename'];?></a>
143 <a href="#" onClick='return confirm("<?=$lang['admin']['ays'];?>")?$(this).closest("form").submit():"";' class="btn btn-xs btn-danger"><i class="bi bi-trash"></i> <?=$lang['admin']['remove'];?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100144 </form>
145 </div>
146 </td>
147 </tr>
148 <?php
149 }
150 }
151 ?>
152 </table>
153 </div>
154 <br>
155 </div>
156 </div>
157 <div class="row">
158 <div class="col-sm-offset-3 col-sm-9">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200159 <button class="btn btn-sm btn-primary visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline" id="register-fido2"><?=$lang['fido2']['set_fido2'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100160 </div>
161 </div>
162 <br>
163 <div class="row" id="status-fido2">
164 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['fido2']['register_status'];?>:</div>
165 <div class="col-sm-9 col-xs-7">
166 <div id="fido2-alerts">-</div>
167 </div>
168 <br>
169 </div>
170
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200171 <legend style="cursor:pointer;margin-top:40px" data-target="#license" unselectable="on" data-toggle="collapse">
172 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['guid_and_license'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100173 </legend>
174 <div id="license" class="collapse">
175 <form class="form-horizontal" autocapitalize="none" autocorrect="off" role="form" method="post">
176 <div class="form-group">
177 <label class="control-label col-sm-3" for="guid"><?=$lang['admin']['guid'];?>:</label>
178 <div class="col-sm-9">
179 <div class="input-group">
180 <span class="input-group-addon">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200181 <i class="bi bi-suit-heart<?=(isset($_SESSION['gal']['valid']) && $_SESSION['gal']['valid'] === "true") ? '-fill text-danger' : '';?>"></i>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100182 </span>
183 <input type="text" id="guid" class="form-control" value="<?=license('guid');?>" readonly>
184 </div>
185 <p class="help-block">
186 <?=$lang['admin']['customer_id'];?>: <?=(isset($_SESSION['gal']['c'])) ? $_SESSION['gal']['c'] : '?';?> -
187 <?=$lang['admin']['service_id'];?>: <?=(isset($_SESSION['gal']['s'])) ? $_SESSION['gal']['s'] : '?';?> -
188 <?=$lang['admin']['sal_level'];?>: <?=(isset($_SESSION['gal']['m'])) ? $_SESSION['gal']['m'] : '?';?>
189 </p>
190 </div>
191 </div>
192 <div class="form-group">
193 <div class="col-sm-offset-3 col-sm-9">
194 <p class="help-block"><?=$lang['admin']['license_info'];?></p>
195 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200196 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" name="license_validate_now" type="submit" href="#"><?=$lang['admin']['validate_license_now'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100197 </div>
198 </div>
199 </div>
200 </form>
201 </div>
202
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200203 <legend style="cursor:pointer;" data-target="#admin_api" unselectable="on" data-toggle="collapse">
204 <i style="font-size:10pt;" class="bi bi-plus-square"></i> API
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100205 </legend>
206 <div id="admin_api" class="collapse">
207 <div class="row">
208 <?php
209 $api_ro = admin_api('ro', 'get');
210 $api_rw = admin_api('rw', 'get');
211 ?>
212 <div class="col-lg-12">
213 <p class="help-block"><?=$lang['admin']['api_info'];?></p>
214 </div>
215 <div class="col-lg-6">
216 <div class="panel panel-default">
217 <div class="panel-heading">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200218 <h4 class="panel-title"><i class="bi bi-file-earmark-arrow-down"></i> <?=$lang['admin']['api_read_only'];?></h4>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100219 </div>
220 <div class="panel-body">
221 <form class="form-horizontal" autocapitalize="none" autocorrect="off" role="form" method="post">
222 <div class="form-group">
223 <label class="control-label col-sm-3" for="allow_from_ro"><?=$lang['admin']['api_allow_from'];?>:</label>
224 <div class="col-sm-9">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200225 <textarea class="form-control textarea-code" rows="7" name="allow_from" id="allow_from_ro" <?=(isset($api_ro['skip_ip_check']) && $api_ro['skip_ip_check'] == 1) ? 'disabled' : null;?> required><?=(isset($api_ro['allow_from'])) ? htmlspecialchars($api_ro['allow_from']) : '';?></textarea>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100226 </div>
227 </div>
228 <div class="form-group">
229 <div class="col-sm-offset-3 col-sm-9">
230 <label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200231 <input type="checkbox" name="skip_ip_check" id="skip_ip_check_ro" <?=(isset($api_ro['skip_ip_check']) && $api_ro['skip_ip_check'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['api_skip_ip_check'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100232 </label>
233 </div>
234 </div>
235 <div class="form-group">
236 <label class="control-label col-sm-3"><?=$lang['admin']['api_key'];?>:</label>
237 <div class="col-sm-9">
238 <pre><?=(empty($api_ro['api_key'])) ? '-' : htmlspecialchars($api_ro['api_key']);?></pre>
239 </div>
240 </div>
241 <div class="form-group">
242 <div class="col-sm-offset-3 col-sm-9">
243 <label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200244 <input type="checkbox" name="active" <?=(isset($api_ro['active']) && $api_ro['active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['activate_api'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100245 </label>
246 </div>
247 </div>
248 <div class="form-group">
249 <div class="col-sm-offset-3 col-sm-9">
250 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200251 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" name="admin_api[ro]" type="submit" href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
252 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default admin-ays-dialog" name="admin_api_regen_key[ro]" type="submit" href="#" <?=(!empty($api_ro['api_key'])) ?: 'disabled';?>><?=$lang['admin']['regen_api_key'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100253 </div>
254 </div>
255 </div>
256 </form>
257 </div>
258 </div>
259 </div>
260 <div class="col-lg-6">
261 <div class="panel panel-default">
262 <div class="panel-heading">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200263 <h4 class="panel-title"><i class="bi bi-file-earmark-diff"></i> <?=$lang['admin']['api_read_write'];?></h4>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100264 </div>
265 <div class="panel-body">
266 <form class="form-horizontal" autocapitalize="none" autocorrect="off" role="form" method="post">
267 <div class="form-group">
268 <label class="control-label col-sm-3" for="allow_from_rw"><?=$lang['admin']['api_allow_from'];?>:</label>
269 <div class="col-sm-9">
270 <textarea class="form-control textarea-code" rows="7" name="allow_from" id="allow_from_rw" <?=($api_rw['skip_ip_check'] == 1) ? 'disabled' : null;?> required><?=htmlspecialchars($api_rw['allow_from']);?></textarea>
271 </div>
272 </div>
273 <div class="form-group">
274 <div class="col-sm-offset-3 col-sm-9">
275 <label>
276 <input type="checkbox" name="skip_ip_check" id="skip_ip_check_rw" <?=($api_rw['skip_ip_check'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['api_skip_ip_check'];?>
277 </label>
278 </div>
279 </div>
280 <div class="form-group">
281 <label class="control-label col-sm-3" for="admin_api_key"><?=$lang['admin']['api_key'];?>:</label>
282 <div class="col-sm-9">
283 <pre><?=(empty($api_rw['api_key'])) ? '-' : htmlspecialchars($api_rw['api_key']);?></pre>
284 </div>
285 </div>
286 <div class="form-group">
287 <div class="col-sm-offset-3 col-sm-9">
288 <label>
289 <input type="checkbox" name="active" <?=($api_rw['active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['activate_api'];?>
290 </label>
291 </div>
292 </div>
293 <div class="form-group">
294 <div class="col-sm-offset-3 col-sm-9">
295 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200296 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" name="admin_api[rw]" type="submit" href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
297 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default admin-ays-dialog" name="admin_api_regen_key[rw]" type="submit" <?=(!empty($api_rw['api_key'])) ?: 'disabled';?> href="#"><?=$lang['admin']['regen_api_key'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100298 </div>
299 </div>
300 </div>
301 </form>
302 </div>
303 </div>
304 </div>
305 </div>
306 </div>
307 </div>
308 </div>
309
310 <div class="panel panel-default">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200311 <div class="panel-heading xs-show"><?=$lang['admin']['domain_admins'];?></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100312 <div class="panel-body">
313 <div class="table-responsive">
314 <table class="table table-striped table-condensed" id="domainadminstable"></table>
315 </div>
316 <div class="mass-actions-admin">
317 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200318 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" id="toggle_multi_select_all" data-id="domain_admins" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>
319 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100320 <ul class="dropdown-menu">
321 <li><a data-action="edit_selected" data-id="domain_admins" data-api-url='edit/domain-admin' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
322 <li><a data-action="edit_selected" data-id="domain_admins" data-api-url='edit/domain-admin' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
323 <li role="separator" class="divider"></li>
324 <li><a data-action="edit_selected" data-id="domain_admins" data-api-url='edit/domain-admin' data-api-attr='{"disable_tfa":"1"}' href="#"><?=$lang['tfa']['disable_tfa'];?></a></li>
325 <li role="separator" class="divider"></li>
326 <li><a data-action="delete_selected" data-id="domain_admins" data-api-url='delete/domain-admin' href="#"><?=$lang['mailbox']['remove'];?></a></li>
327 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200328 <div class="clearfix visible-xs"></div>
329 <a class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-id="add_domain_admin" data-toggle="modal" data-target="#addDomainAdminModal" href="#"><i class="bi bi-person-plus-fill"></i> <?=$lang['admin']['add_domain_admin'];?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100330 </div>
331 </div>
332 </div>
333 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200334 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100335
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200336 <div role="tabpanel" class="tab-pane" id="tab-config-ldap-admins">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100337 <div class="panel panel-default">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200338 <div class="panel-heading"><?=$lang['admin']['admins_ldap'];?></div>
339 <div class="panel-body">
340 </div>
341 </div>
342 </div>
343
344 <div role="tabpanel" class="tab-pane" id="tab-config-oauth2">
345 <div class="panel panel-default">
346 <div class="panel-heading"><?=$lang['admin']['oauth2_apps'];?></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100347 <div class="panel-body">
348 <p><?=$lang['admin']['oauth2_info'];?></p>
349 <div class="table-responsive">
350 <table class="table table-striped" id="oauth2clientstable"></table>
351 </div>
352 <div class="mass-actions-admin">
353 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200354 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" id="toggle_multi_select_all" data-id="oauth2_clients" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>
355 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100356 <ul class="dropdown-menu">
357 <li><a data-action="delete_selected" data-id="oauth2_clients" data-api-url='delete/oauth2-client' href="#"><?=$lang['mailbox']['remove'];?></a></li>
358 <li role="separator" class="divider"></li>
359 <li><a data-action="edit_selected" data-id="oauth2_clients" data-api-url='edit/oauth2-client' data-api-attr='{"revoke_tokens":"1"}' href="#"><?=$lang['admin']['oauth2_revoke_tokens'];?></a></li>
360 <li role="separator" class="divider"></li>
361 <li><a data-action="edit_selected" data-id="oauth2_clients" data-api-url='edit/oauth2-client' data-api-attr='{"renew_secret":"1"}' href="#"><?=$lang['admin']['oauth2_renew_secret'];?></a></li>
362 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200363 <div class="clearfix visible-xs"></div>
364 <a class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-id="add_oauth2_client" data-toggle="modal" data-target="#addOAuth2ClientModal" href="#"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['oauth2_add_client'];?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100365 </div>
366 </div>
367 </div>
368 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200369 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100370
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200371 <div role="tabpanel" class="tab-pane" id="tab-config-rspamd">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100372 <div class="panel panel-default">
373 <div class="panel-heading">
374 <h3 class="panel-title">Rspamd UI</h3>
375 </div>
376 <div class="panel-body">
377 <div class="row">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200378 <div class="col-xs-12 visible-xs">
379 <img class="img-responsive" src="/img/rspamd_logo.png" alt="Rspamd UI">
380 </div>
381 <div class="col-sm-9 col-xs-12">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100382 <form class="form-horizontal" autocapitalize="none" data-id="admin" autocorrect="off" role="form" method="post">
383 <div class="form-group">
384 <div class="col-sm-offset-3 col-sm-9">
385 <label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200386 <a href="/rspamd/" target="_blank"><i class="bi bi-window"></i> Rspamd UI</a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100387 </label>
388 </div>
389 </div>
390 <div class="form-group">
391 <label class="control-label col-sm-3" for="rspamd_ui_pass"><?=$lang['admin']['password'];?>:</label>
392 <div class="col-sm-9">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200393 <input type="password" class="form-control" id="rspamd_ui_pass" name="rspamd_ui_pass" autocomplete="new-password" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100394 </div>
395 </div>
396 <div class="form-group">
397 <label class="control-label col-sm-3" for="rspamd_ui_pass2"><?=$lang['admin']['password_repeat'];?>:</label>
398 <div class="col-sm-9">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200399 <input type="password" class="form-control" id="rspamd_ui_pass2" name="rspamd_ui_pass2" autocomplete="new-password" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100400 </div>
401 </div>
402 <div class="form-group">
403 <div class="col-sm-offset-3 col-sm-9">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200404 <button type="submit" class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" id="rspamd_ui" name="rspamd_ui" href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100405 </div>
406 </div>
407 </form>
408 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200409 <div class="col-sm-3 hidden-xs">
410 <img class="img-responsive" src="/img/rspamd_logo.png" alt="Rspamd UI">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100411 </div>
412 </div>
413 </div>
414 </div>
415 </div>
416
417 <div role="tabpanel" class="tab-pane" id="tab-routing">
418 <div class="panel panel-default">
419 <div class="panel-heading"><?=$lang['admin']['relayhosts'];?></div>
420 <div class="panel-body">
421 <p style="margin-bottom:40px"><?=$lang['admin']['relayhosts_hint'];?></p>
422 <div class="table-responsive">
423 <table class="table table-striped table-condensed" id="relayhoststable"></table>
424 </div>
425 <div class="mass-actions-admin">
426 <div class="btn-group btn-group-sm">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200427 <button type="button" id="toggle_multi_select_all" data-id="rlyhosts" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default"><?=$lang['mailbox']['toggle_all'];?></button>
428 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
429 <ul class="dropdown-menu top100">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100430 <li><a data-action="edit_selected" data-id="rlyhosts" data-api-url='edit/relayhost' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
431 <li><a data-action="edit_selected" data-id="rlyhosts" data-api-url='edit/relayhost' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
432 <li role="separator" class="divider"></li>
433 <li><a data-action="delete_selected" data-id="rlyhosts" data-api-url='delete/relayhost' href="#"><?=$lang['admin']['remove'];?></a></li>
434 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200435 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100436 </div>
437 </div>
438 <legend><?=$lang['admin']['add_relayhost'];?></legend>
439 <p class="help-block"><?=$lang['admin']['add_relayhost_hint'];?></p>
440 <div class="row">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200441 <div class="col-md-8">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100442 <form class="form" data-id="rlyhost" role="form" method="post">
443 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200444 <label for="rlyhost_hostname"><?=$lang['admin']['host'];?></label>
445 <input class="form-control" id="rlyhost_hostname" name="hostname" placeholder='[0.0.0.0], [0.0.0.0]:25, host:25, host, [host]:25' required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100446 </div>
447 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200448 <label for="rlyhost_username"><?=$lang['admin']['username'];?></label>
449 <input class="form-control" id="rlyhost_username" name="username">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100450 </div>
451 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200452 <label for="rlyhost_password"><?=$lang['admin']['password'];?></label>
453 <input class="form-control" id="rlyhost_password" name="password">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100454 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200455 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="add_item" data-id="rlyhost" data-api-url='add/relayhost' data-api-attr='{}' href="#"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['add'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100456 </form>
457 </div>
458 </div>
459 </div>
460 </div>
461
462 <div class="panel panel-default">
463 <div class="panel-heading"><?=$lang['admin']['transport_maps'];?></div>
464 <div class="panel-body">
465 <p style="margin-bottom:40px"><?=$lang['admin']['transports_hint'];?></p>
466 <div class="table-responsive">
467 <table class="table table-striped table-condensed" id="transportstable"></table>
468 </div>
469 <div class="mass-actions-admin">
470 <div class="btn-group btn-group-sm">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200471 <button type="button" id="toggle_multi_select_all" data-id="transports" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default"><?=$lang['mailbox']['toggle_all'];?></button>
472 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
473 <ul class="dropdown-menu top100">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100474 <li><a data-action="edit_selected" data-id="transports" data-api-url='edit/transport' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
475 <li><a data-action="edit_selected" data-id="transports" data-api-url='edit/transport' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
476 <li role="separator" class="divider"></li>
477 <li><a data-action="delete_selected" data-id="transports" data-api-url='delete/transport' href="#"><?=$lang['admin']['remove'];?></a></li>
478 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200479 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100480 </div>
481 </div>
482 <legend><?=$lang['admin']['add_transport'];?></legend>
483 <p class="help-block"><?=$lang['admin']['add_transports_hint'];?></p>
484 <div class="row">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200485 <div class="col-md-8">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100486 <form class="form" data-id="transport" role="form" method="post">
487 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200488 <label for="transport_destination"><?=$lang['admin']['destination'];?></label>
489 <input class="form-control" id="transport_destination" name="destination" placeholder='<?=$lang['admin']['transport_dest_format'];?>' required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100490 </div>
491 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200492 <label for="transport_nexthop"><?=$lang['admin']['nexthop'];?></label>
493 <input class="form-control" id="transport_nexthop" name="nexthop" placeholder='host:25, host, [host]:25, [0.0.0.0]:25' required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100494 </div>
495 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200496 <label for="transport_username"><?=$lang['admin']['username'];?></label>
497 <input class="form-control" id="transport_username" name="username">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100498 </div>
499 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200500 <label for="transport_password"><?=$lang['admin']['password'];?></label>
501 <input class="form-control" id="transport_password" name="password">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100502 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200503 <div class="form-group">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100504 <label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200505 <input type="checkbox" name="is_mx_based" value="1"> <?=$lang['admin']['lookup_mx'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100506 </label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200507 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100508 <div class="form-group">
509 <label>
510 <input type="checkbox" name="active" value="1"> <?=$lang['admin']['active'];?>
511 </label>
512 </div>
513 <p class="help-block"><?=$lang['admin']['credentials_transport_warning'];?></p>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200514 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="add_item" data-id="transport" data-api-url='add/transport' data-api-attr='{}' href="#"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['add'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100515 </form>
516 </div>
517 </div>
518 </div>
519 </div>
520 </div>
521
522 <div role="tabpanel" class="tab-pane" id="tab-config-dkim">
523 <div class="panel panel-default">
524 <div class="panel-heading"><?=$lang['admin']['dkim_keys'];?></div>
525 <div class="panel-body">
526 <div class="btn-group" data-toggle="button" style="margin-bottom: 20px;">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200527 <a class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default active" href="#" data-toggle="collapse" data-target=".dkim_key_valid"><?=$lang['admin']['dkim_key_valid'];?></a>
528 <a class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default active" href="#" data-toggle="collapse" data-target=".dkim_key_unused"><?=$lang['admin']['dkim_key_unused'];?></a>
529 <a class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default active" href="#" data-toggle="collapse" data-target=".dkim_key_missing"><?=$lang['admin']['dkim_key_missing'];?></a>
530 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100531 </div>
532 <?php
533 foreach(mailbox('get', 'domains') as $domain) {
534 if (!empty($dkim = dkim('details', $domain))) {
535 $dkim_domains[] = $domain;
536 ($GLOBALS['SHOW_DKIM_PRIV_KEYS'] === true) ?: $dkim['privkey'] = base64_encode('Please set $SHOW_DKIM_PRIV_KEYS to true to show DKIM private keys.');
537 ?>
538 <div class="row collapse in dkim_key_valid">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200539 <div class="col-md-1"><input type="checkbox" data-id="dkim" name="multi_select" value="<?=$domain;?>"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100540 <div class="col-md-3">
541 <p><?=$lang['admin']['domain'];?>: <strong><?=htmlspecialchars($domain);?></strong>
542 <p class="dkim-label"><span class="label label-success"><?=$lang['admin']['dkim_key_valid'];?></span></p>
543 <p class="dkim-label"><span class="label label-primary"><?=$lang['admin']['dkim_domains_selector'];?> '<?=$dkim['dkim_selector'];?>'</span></p>
544 <p class="dkim-label"><span class="label label-info"><?=$dkim['length'];?> bit</span></p>
545 </p>
546 </div>
547 <div class="col-md-8">
548 <pre><?=$dkim['dkim_txt'];?></pre>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200549 <p data-toggle="modal" data-target="#showDKIMprivKey" id="dkim_priv" style="cursor:pointer;margin-top:-8pt" data-priv-key="<?=$dkim['privkey'];?>"><small><i class="bi bi-arrow-return-right"></i> <?=$lang['admin']['dkim_private_key'];?></small></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100550 </div>
551 <hr class="visible-xs visible-sm">
552 </div>
553 <?php
554 }
555 else {
556 ?>
557 <div class="row collapse in dkim_key_missing">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200558 <div class="col-md-1"><input class="dkim_missing" type="checkbox" data-id="dkim" name="multi_select" value="<?=$domain;?>" disabled></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100559 <div class="col-md-3">
560 <p><?=$lang['admin']['domain'];?>: <strong><?=htmlspecialchars($domain);?></strong><br><span class="label label-danger"><?=$lang['admin']['dkim_key_missing'];?></span></p>
561 </div>
562 <div class="col-md-8"><pre>-</pre></div>
563 <hr class="visible-xs visible-sm">
564 </div>
565 <?php
566 }
567 foreach(mailbox('get', 'alias_domains', $domain) as $alias_domain) {
568 if (!empty($dkim = dkim('details', $alias_domain))) {
569 $dkim_domains[] = $alias_domain;
570 ($GLOBALS['SHOW_DKIM_PRIV_KEYS'] === true) ?: $dkim['privkey'] = base64_encode('Please set $SHOW_DKIM_PRIV_KEYS to true to show DKIM private keys.');
571 ?>
572 <div class="row collapse in dkim_key_valid">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200573 <div class="col-md-1"><input type="checkbox" data-id="dkim" name="multi_select" value="<?=$alias_domain;?>"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100574 <div class="col-md-2 col-md-offset-1">
575 <p><small>↳ Alias-Domain: <strong><?=htmlspecialchars($alias_domain);?></strong></small>
576 <p class="dkim-label"><span class="label label-success"><?=$lang['admin']['dkim_key_valid'];?></span></p>
577 <p class="dkim-label"><span class="label label-primary">Selector '<?=$dkim['dkim_selector'];?>'</span></p>
578 <p class="dkim-label"><span class="label label-info"><?=$dkim['length'];?> bit</span></p>
579 </p>
580 </div>
581 <div class="col-md-8">
582 <pre><?=$dkim['dkim_txt'];?></pre>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200583 <p data-toggle="modal" data-target="#showDKIMprivKey" id="dkim_priv" style="cursor:pointer;margin-top:-8pt" data-priv-key="<?=$dkim['privkey'];?>"><small><i class="bi bi-arrow-return-right"></i> Private key</small></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100584 </div>
585 <hr class="visible-xs visible-sm">
586 </div>
587 <?php
588 }
589 else {
590 ?>
591 <div class="row collapse in dkim_key_missing">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200592 <div class="col-md-1"><input class="dkim_missing" type="checkbox" data-id="dkim" name="multi_select" value="<?=$alias_domain;?>" disabled></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100593 <div class="col-md-2 col-md-offset-1">
594 <p><small>↳ Alias-Domain: <strong><?=htmlspecialchars($alias_domain);?></strong><br></small><span class="label label-danger"><?=$lang['admin']['dkim_key_missing'];?></span></p>
595 </div>
596 <div class="col-md-8"><pre>-</pre></div>
597 <hr class="visible-xs visible-sm">
598 </div>
599 <?php
600 }
601 }
602 }
603 foreach(dkim('blind') as $blind) {
604 if (!empty($dkim = dkim('details', $blind))) {
605 $dkim_domains[] = $blind;
606 ($GLOBALS['SHOW_DKIM_PRIV_KEYS'] === true) ?: $dkim['privkey'] = base64_encode('Please set $SHOW_DKIM_PRIV_KEYS to true to show DKIM private keys.');
607 ?>
608 <div class="row collapse in dkim_key_unused">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200609 <div class="col-md-1"><input type="checkbox" data-id="dkim" name="multi_select" value="<?=$blind;?>"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100610 <div class="col-md-3">
611 <p><?=$lang['admin']['domain'];?>: <strong><?=htmlspecialchars($blind);?></strong>
612 <p class="dkim-label"><span class="label label-warning"><?=$lang['admin']['dkim_key_unused'];?></span></p>
613 <p class="dkim-label"><span class="label label-primary">Selector '<?=$dkim['dkim_selector'];?>'</span></p>
614 <p class="dkim-label"><span class="label label-info"><?=$dkim['length'];?> bit</span></p>
615 </p>
616 </div>
617 <div class="col-md-8">
618 <pre><?=$dkim['dkim_txt'];?></pre>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200619 <p data-toggle="modal" data-target="#showDKIMprivKey" id="dkim_priv" style="cursor:pointer;margin-top:-8pt" data-priv-key="<?=$dkim['privkey'];?>"><small><i class="bi bi-arrow-return-right"></i> Private key</small></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100620 </div>
621 <hr class="visible-xs visible-sm">
622 </div>
623 <?php
624 }
625 }
626 ?>
627 <div class="mass-actions-admin">
628 <div class="btn-group btn-group-sm">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200629 <button type="button" id="toggle_multi_select_all" data-id="dkim" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></button>
630 <button type="button" data-action="delete_selected" name="delete_selected" data-id="dkim" data-api-url="delete/dkim" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-danger"><i class="bi bi-trash"></i> <?=$lang['admin']['remove'];?></button>
631 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100632 </div>
633 </div>
634
635 <legend style="margin-top:40px"><?=$lang['admin']['dkim_add_key'];?></legend>
636 <form class="form" data-id="dkim" role="form" method="post">
637 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200638 <label for="dkim_add_domains"><?=$lang['admin']['domain_s'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100639 <input class="form-control input-sm" id="dkim_add_domains" name="domains" placeholder="example.org, example.com" required>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200640 <small><i class="bi bi-arrow-return-right"></i> <a href="#" id="dkim_missing_keys"><?=$lang['admin']['dkim_domains_wo_keys'];?></a></small>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100641 </div>
642 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200643 <label for="dkim_selector"><?=$lang['admin']['dkim_domains_selector'];?></label>
644 <input class="form-control input-sm" id="dkim_selector" name="dkim_selector" value="dkim" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100645 </div>
646 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200647 <select data-style="btn btn-default btn-sm" class="form-control" id="key_size" name="key_size" title="<?=$lang['admin']['dkim_key_length'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100648 <option data-subtext="bits">1024</option>
649 <option data-subtext="bits">2048</option>
650 </select>
651 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200652 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="add_item" data-id="dkim" data-api-url='add/dkim' data-api-attr='{}' href="#"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['add'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100653 </form>
654
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200655 <legend data-target="#import_dkim" style="margin-top:40px;cursor:pointer" unselectable="on" data-toggle="collapse">
656 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['import_private_key'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100657 </legend>
658 <div id="import_dkim" class="collapse">
659 <form class="form" data-id="dkim_import" role="form" method="post">
660 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200661 <label for="dkim_import_domain"><?=$lang['admin']['domain'];?>:</label>
662 <input class="form-control input-sm" id="dkim_import_domain" name="domain" placeholder="example.org" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100663 </div>
664 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200665 <label for="dkim_import_selector"><?=$lang['admin']['dkim_domains_selector'];?>:</label>
666 <input class="form-control input-sm" id="dkim_import_selector" name="dkim_selector" value="dkim" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100667 </div>
668 <div class="form-group">
669 <label for="private_key_file"><?=$lang['admin']['private_key'];?>: (RSA PKCS#8)</label>
670 <textarea class="form-control input-sm" rows="10" name="private_key_file" id="private_key_file" required placeholder="-----BEGIN RSA KEY-----"></textarea>
671 </div>
672 <div class="form-group">
673 <label>
674 <input type="checkbox" name="overwrite_existing" value="1"> <?=$lang['admin']['dkim_overwrite_key'];?>
675 </label>
676 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200677 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="add_item" data-id="dkim_import" data-api-url='add/dkim_import' data-api-attr='{}' href="#"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['import'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100678 </form>
679 </div>
680
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200681 <legend data-target="#duplicate_dkim" style="margin-top:40px;cursor:pointer" unselectable="on" data-toggle="collapse">
682 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['duplicate_dkim'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100683 </legend>
684 <div id="duplicate_dkim" class="collapse">
685 <form class="form-horizontal" data-id="dkim_duplicate" role="form" method="post">
686 <div class="form-group">
687 <label class="control-label col-sm-2" for="from_domain"><?=$lang['admin']['dkim_from'];?>:</label>
688 <div class="col-sm-10">
689 <select data-style="btn btn-default btn-sm"
690 data-live-search="true"
691 data-id="dkim_duplicate"
692 title="<?=$lang['admin']['dkim_from_title'];?>"
693 name="from_domain" id="from_domain" class="full-width-select form-control" required>
694 <?php
695 foreach ($dkim_domains as $dkim) {
696 ?>
697 <option value="<?=$dkim;?>"><?=$dkim;?></option>
698 <?php
699 }
700 ?>
701 </select>
702 </div>
703 </div>
704 <div class="form-group">
705 <label class="control-label col-sm-2" for="to_domain"><?=$lang['admin']['dkim_to'];?>:</label>
706 <div class="col-sm-10">
707 <select
708 data-live-search="true"
709 data-style="btn btn-default btn-sm"
710 data-id="dkim_duplicate"
711 title="<?=$lang['admin']['dkim_to_title'];?>"
712 name="to_domain" id="to_domain" class="full-width-select form-control" multiple required>
713 <?php
714 foreach (array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')) as $domain) {
715 ?>
716 <option value="<?=$domain;?>"><?=$domain;?></option>
717 <?php
718 }
719 ?>
720 </select>
721 </div>
722 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200723 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="add_item" data-id="dkim_duplicate" data-api-url='add/dkim_duplicate' data-api-attr='{}' href="#"><i class="bi bi-clipboard-plus"></i> <?=$lang['admin']['duplicate'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100724 </form>
725 </div>
726 </div>
727 </div>
728 </div>
729
730 <div role="tabpanel" class="tab-pane" id="tab-config-fwdhosts">
731 <div class="panel panel-default">
732 <div class="panel-heading"><?=$lang['admin']['forwarding_hosts'];?></div>
733 <div class="panel-body">
734 <p style="margin-bottom:40px"><?=$lang['admin']['forwarding_hosts_hint'];?></p>
735 <div class="table-responsive">
736 <table class="table table-striped table-condensed" id="forwardinghoststable"></table>
737 </div>
738 <div class="mass-actions-admin">
739 <div class="btn-group btn-group-sm">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200740 <button type="button" id="toggle_multi_select_all" data-id="fwdhosts" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default"><?=$lang['mailbox']['toggle_all'];?></button>
741 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
742 <ul class="dropdown-menu top100">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100743 <li><a data-action="edit_selected" data-id="fwdhosts" data-api-url='edit/fwdhost' data-api-attr='{"keep_spam":"0"}' href="#">Enable spam filter</a></li>
744 <li><a data-action="edit_selected" data-id="fwdhosts" data-api-url='edit/fwdhost' data-api-attr='{"keep_spam":"1"}' href="#">Disable spam filter</a></li>
745 <li role="separator" class="divider"></li>
746 <li><a data-action="delete_selected" data-id="fwdhosts" data-api-url='delete/fwdhost' href="#"><?=$lang['admin']['remove'];?></a></li>
747 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200748 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100749 </div>
750 </div>
751 <legend><?=$lang['admin']['add_forwarding_host'];?></legend>
752 <p class="help-block"><?=$lang['admin']['forwarding_hosts_add_hint'];?></p>
753 <form class="form" data-id="fwdhost" role="form" method="post">
754 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200755 <label for="fwdhost_hostname"><?=$lang['admin']['host'];?></label>
756 <input class="form-control" id="fwdhost_hostname" name="hostname" placeholder="example.org" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100757 </div>
758 <div class="form-group">
759 <select data-width="200px" class="form-control" id="filter_spam" name="filter_spam" title="<?=$lang['user']['spamfilter'];?>" required>
760 <option value="1"><?=$lang['admin']['active'];?></option>
761 <option value="0"><?=$lang['admin']['inactive'];?></option>
762 </select>
763 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200764 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="add_item" data-id="fwdhost" data-api-url='add/fwdhost' data-api-attr='{}' href="#"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['add'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100765 </form>
766 </div>
767 </div>
768 </div>
769
770 <div role="tabpanel" class="tab-pane" id="tab-config-f2b">
771 <div class="panel panel-default">
772 <div class="panel-heading"><?=$lang['admin']['f2b_parameters'];?></div>
773 <div class="panel-body">
774 <?php
775 $f2b_data = fail2ban('get');
776 ?>
777 <form class="form" data-id="f2b" role="form" method="post">
778 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200779 <label for="f2b_ban_time"><?=$lang['admin']['f2b_ban_time'];?>:</label>
780 <input type="number" class="form-control" id="f2b_ban_time" name="ban_time" value="<?=$f2b_data['ban_time'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100781 </div>
782 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200783 <label for="f2b_max_attempts"><?=$lang['admin']['f2b_max_attempts'];?>:</label>
784 <input type="number" class="form-control" id="f2b_max_attempts" name="max_attempts" value="<?=$f2b_data['max_attempts'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100785 </div>
786 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200787 <label for="f2b_retry_window"><?=$lang['admin']['f2b_retry_window'];?>:</label>
788 <input type="number" class="form-control" id="f2b_retry_window" name="retry_window" value="<?=$f2b_data['retry_window'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100789 </div>
790 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200791 <label for="f2b_netban_ipv4"><?=$lang['admin']['f2b_netban_ipv4'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100792 <div class="input-group">
793 <span class="input-group-addon">/</span>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200794 <input type="number" class="form-control" id="f2b_netban_ipv4" name="netban_ipv4" value="<?=$f2b_data['netban_ipv4'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100795 </div>
796 </div>
797 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200798 <label for="f2b_netban_ipv6"><?=$lang['admin']['f2b_netban_ipv6'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100799 <div class="input-group">
800 <span class="input-group-addon">/</span>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200801 <input type="number" class="form-control" id="f2b_netban_ipv6" name="netban_ipv6" value="<?=$f2b_data['netban_ipv6'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100802 </div>
803 </div>
804 <hr>
805 <p class="help-block"><?=$lang['admin']['f2b_list_info'];?></p>
806 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200807 <label for="f2b_whitelist"><?=$lang['admin']['f2b_whitelist'];?>:</label>
808 <textarea class="form-control" id="f2b_whitelist" name="whitelist" rows="5"><?=$f2b_data['whitelist'];?></textarea>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100809 </div>
810 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200811 <label for="f2b_blacklist"><?=$lang['admin']['f2b_blacklist'];?>:</label>
812 <textarea class="form-control" id="f2b_blacklist" name="blacklist" rows="5"><?=$f2b_data['blacklist'];?></textarea>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100813 </div>
814 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200815 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="self" data-id="f2b" data-api-url='edit/fail2ban' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
816 <a href="#" role="button" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-toggle="modal" data-container="netfilter-mailcow" data-target="#RestartContainer"><i class="bi bi-arrow-repeat"></i> <?= $lang['header']['restart_netfilter']; ?></a>
817 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100818 </div>
819 </form>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200820 <legend data-target="#f2b_regex_filters" style="margin-top:40px;cursor:pointer" unselectable="on" data-toggle="collapse">
821 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['f2b_filter'];?>
822 </legend>
823 <div id="f2b_regex_filters" class="collapse">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100824 <p class="help-block"><?=$lang['admin']['f2b_regex_info'];?></p>
825 <form class="form-inline" data-id="f2b_regex" role="form" method="post">
826 <table class="table table-condensed" id="f2b_regex_table">
827 <tr>
828 <th width="50px">ID</th>
829 <th>RegExp</th>
830 <th width="100px">&nbsp;</th>
831 </tr>
832 <?php
833 if (!empty($f2b_data['regex'])) {
834 foreach ($f2b_data['regex'] as $regex_id => $regex_val) {
835 ?>
836 <tr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200837 <td><input disabled class="input-sm input-xs-lg form-control" style="text-align:center" data-id="f2b_regex" type="text" name="app" required value="<?=$regex_id;?>"></td>
838 <td><input class="input-sm input-xs-lg form-control regex-input" data-id="f2b_regex" type="text" name="regex" required value="<?=htmlspecialchars($regex_val);?>"></td>
839 <td><a href="#" role="button" class="btn btn-xs btn-xs-lg btn-default" type="button"><?=$lang['admin']['remove_row'];?></a></td>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100840 </tr>
841 <?php
842 }
843 }
844 ?>
845 </table>
846 <p><div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200847 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="admin" data-id="f2b_regex" data-reload="no" data-api-url='edit/fail2ban' data-api-attr='{"action":"edit-regex"}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
848 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default admin-ays-dialog" data-action="edit_selected" data-item="self" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"reset-regex"}' href="#"><?=$lang['admin']['reset_default'];?></button>
849 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" type="button" id="add_f2b_regex_row"><i class="bi bi-plus-lg"></i> <?=$lang['admin']['add_row'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100850 </div></p>
851 </form>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200852 </div>
853
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100854 <p class="help-block"><?=$lang['admin']['ban_list_info'];?></p>
855 <?php
856 if (empty($f2b_data['active_bans']) && empty($f2b_data['perm_bans'])):
857 ?>
858 <i><?=$lang['admin']['no_active_bans'];?></i>
859 <?php
860 endif;
861 if (!empty($f2b_data['active_bans'])):
862 foreach ($f2b_data['active_bans'] as $active_bans):
863 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200864 <p><span class="label label-info" style="padding:4px;font-size:85%;"><i class="bi bi-funnel-fill"></i><a href="https://bgp.he.net/ip/<?=$active_bans['ip'];?>" target="_blank" style="color:white"> <?=$active_bans['network'];?></a>(<?=$active_bans['banned_until'];?>) -
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100865 <?php
866 if ($active_bans['queued_for_unban'] == 0):
867 ?>
868 <a data-action="edit_selected" data-item="<?=$active_bans['network'];?>" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"unban"}' href="#">[<?=$lang['admin']['queue_unban'];?>]</a>
869 <a data-action="edit_selected" data-item="<?=$active_bans['network'];?>" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"whitelist"}' href="#">[whitelist]</a>
870 <a data-action="edit_selected" data-item="<?=$active_bans['network'];?>" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"blacklist"}' href="#">[blacklist (<b>needs restart</b>)]</a>
871 <?php
872 else:
873 ?>
874 <i><?=$lang['admin']['unban_pending'];?></i>
875 <?php
876 endif;
877 ?>
878 </span></p>
879 <?php
880 endforeach;
881 ?>
882 <hr>
883 <?php
884 endif;
885 if (!empty($f2b_data['perm_bans'])):
886 foreach ($f2b_data['perm_bans'] as $perm_bans):
887 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200888 <span class="label label-danger" style="padding: 0.1em 0.4em 0.1em;"><i class="bi bi-funnel-fill"></i><a href="https://bgp.he.net/ip/<?=$perm_bans['ip'];?>" target="_blank" style="color:white"> <?=$perm_bans['network'];?></a></span>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100889 <?php
890 endforeach;
891 endif;
892 ?>
893 </div>
894 </div>
895 </div>
896
897 <div role="tabpanel" class="tab-pane" id="tab-config-quarantine">
898 <div class="panel panel-default">
899 <div class="panel-heading"><?=$lang['admin']['quarantine'];?></div>
900 <div class="panel-body">
901 <?php $q_data = quarantine('settings');
902 if (empty($q_data['retention_size']) || empty($q_data['max_size'])):
903 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200904 <div class="alert alert-info"><?=$lang['quarantine']['disabled_by_config'];?></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100905 <?php
906 endif;
907 ?>
908 <form class="form-horizontal" data-id="quarantine" role="form" method="post">
909 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200910 <label class="col-sm-4 control-label" for="quarantine_retention_size"><?=$lang['admin']['quarantine_retention_size'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100911 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200912 <input type="number" class="form-control" id="quarantine_retention_size" name="retention_size" value="<?=$q_data['retention_size'];?>" placeholder="0" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100913 </div>
914 </div>
915 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200916 <label class="col-sm-4 control-label" for="quarantine_max_size"><?=$lang['admin']['quarantine_max_size'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100917 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200918 <input type="number" class="form-control" id="quarantine_max_size" name="max_size" value="<?=$q_data['max_size'];?>" placeholder="0" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100919 </div>
920 </div>
921 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200922 <label class="col-sm-4 control-label" for="quarantine_max_score"><?=$lang['admin']['quarantine_max_score'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100923 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200924 <input type="number" class="form-control" id="quarantine_max_score" name="max_score" value="<?=$q_data['max_score'];?>" placeholder="9999.0">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100925 </div>
926 </div>
927 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200928 <label class="col-sm-4 control-label" for="quarantine_max_age"><?=$lang['admin']['quarantine_max_age'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100929 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200930 <input type="number" class="form-control" id="quarantine_max_age" name="max_age" value="<?=$q_data['max_age'];?>" min="1" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100931 </div>
932 </div>
933 <hr>
934 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200935 <label class="col-sm-4 control-label" for="quarantine_redirect"><i class="bi bi-box-arrow-right"></i> <?=$lang['admin']['quarantine_redirect'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100936 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200937 <input type="email" class="form-control" id="quarantine_redirect" name="redirect" value="<?=htmlspecialchars($q_data['redirect']);?>" placeholder="">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100938 </div>
939 </div>
940 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200941 <label class="col-sm-4 control-label" for="quarantine_bcc"><i class="bi bi-files"></i> <?=$lang['admin']['quarantine_bcc'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100942 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200943 <input type="email" class="form-control" id="quarantine_bcc" name="bcc" value="<?=htmlspecialchars($q_data['bcc']);?>" placeholder="">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100944 </div>
945 </div>
946 <hr>
947 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200948 <label class="col-sm-4 control-label" for="quarantine_sender"><?=$lang['admin']['quarantine_notification_sender'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100949 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200950 <input type="email" class="form-control" id="quarantine_sender" name="sender" value="<?=htmlspecialchars($q_data['sender']);?>" placeholder="quarantine@localhost">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100951 </div>
952 </div>
953 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200954 <label class="col-sm-4 control-label" for="quarantine_subject"><?=$lang['admin']['quarantine_notification_subject'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100955 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200956 <input type="text" class="form-control" id="quarantine_subject" name="subject" value="<?=htmlspecialchars($q_data['subject']);?>" placeholder="Spam Quarantine Notification">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100957 </div>
958 </div>
959 <hr>
960 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200961 <label class="col-sm-4 control-label" for="quarantine_release_format"><?=$lang['admin']['quarantine_release_format'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100962 <div class="col-sm-8">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200963 <select data-width="100%" id="quarantine_release_format" name="release_format" class="selectpicker" title="<?=$lang['tfa']['select'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100964 <option <?=($q_data['release_format'] == 'raw') ? 'selected' : null;?> value="raw"><?=$lang['admin']['quarantine_release_format_raw'];?></option>
965 <option <?=($q_data['release_format'] == 'attachment') ? 'selected' : null;?> value="attachment"><?=$lang['admin']['quarantine_release_format_att'];?></option>
966 </select>
967 </div>
968 </div>
969 <div class="form-group">
970 <label class="col-sm-4 control-label" for="exclude_domains"><?=$lang['admin']['quarantine_exclude_domains'];?>:</label>
971 <div class="col-sm-8">
972 <select data-width="100%" name="exclude_domains" class="selectpicker" title="<?=$lang['tfa']['select'];?>" multiple>
973 <?php
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200974 if (is_array($q_data['exclude_domains'])) {
975 foreach (array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')) as $domain) {
976 ?>
977 <option <?=(in_array($domain, $q_data['exclude_domains'])) ? 'selected' : null;?>><?=htmlspecialchars($domain);?></option>
978 <?php
979 }
980 }
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100981 ?>
982 </select>
983 </div>
984 </div>
985 <hr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200986 <legend data-target="#quarantine_template" style="cursor:pointer" unselectable="on" data-toggle="collapse">
987 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['quarantine_notification_html'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100988 </legend>
989 <div id="quarantine_template" class="collapse" >
990 <textarea autocorrect="off" spellcheck="false" autocapitalize="none" class="form-control textarea-code" rows="40" name="html_tmpl"><?=$q_data['html_tmpl'];?></textarea>
991 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200992 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="self" data-id="quarantine" data-api-url='edit/quarantine' data-api-attr='{"action":"settings"}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100993 </form>
994 </div>
995 </div>
996 </div>
997
998 <div role="tabpanel" class="tab-pane" id="tab-config-quota">
999 <div class="panel panel-default">
1000 <div class="panel-heading"><?=$lang['admin']['quota_notifications'];?></div>
1001 <div class="panel-body">
1002 <p><?=$lang['admin']['quota_notifications_info'];?></p>
1003 <?php $qw_data = quota_notification('get');?>
1004 <form class="form" role="form" data-id="quota_notification" method="post">
1005 <div class="row">
1006 <div class="col-sm-6">
1007 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001008 <label for="quota_notification_sender"><?=$lang['admin']['quota_notification_sender'];?>:</label>
1009 <input type="email" class="form-control" id="quota_notification_sender" name="sender" value="<?=htmlspecialchars($qw_data['sender']);?>" placeholder="quota-warning@localhost">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001010 </div>
1011 </div>
1012 <div class="col-sm-6">
1013 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001014 <label for="quota_notification_subject"><?=$lang['admin']['quota_notification_subject'];?>:</label>
1015 <input type="text" class="form-control" id="quota_notification_subject" name="subject" value="<?=htmlspecialchars($qw_data['subject']);?>" placeholder="Quota warning">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001016 </div>
1017 </div>
1018 </div>
1019 <div class="row">
1020 <div class="col-sm-12">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001021 <legend data-target="#quota_template" style="cursor:pointer" unselectable="on" data-toggle="collapse">
1022 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['quarantine_notification_html'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001023 </legend>
1024 <div id="quota_template" class="collapse" >
1025 <!-- <small><?=$lang['admin']['quota_notifications_vars'];?></small><br><br>-->
1026 <textarea autocorrect="off" spellcheck="false" autocapitalize="none" class="form-control textarea-code collapse in" rows="20" name="html_tmpl"><?=$qw_data['html_tmpl'];?></textarea>
1027 </div>
1028 </div>
1029 </div>
1030 <div class="row">
1031 <div class="col-sm-10">
1032 <div class="form-group">
1033 <br>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001034 <a type="button" class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected"
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001035 data-item="quota_notification"
1036 data-id="quota_notification"
1037 data-api-url='edit/quota_notification'
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001038 data-api-attr='{}'><i class="bi bi-check-lg"></i> <?=$lang['user']['save_changes'];?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001039 </div>
1040 </div>
1041 </div>
1042 </form>
1043 </div>
1044 </div>
1045 </div>
1046
1047 <div role="tabpanel" class="tab-pane" id="tab-config-rsettings">
1048 <div class="panel panel-default">
1049 <div class="panel-heading"><?=$lang['admin']['rspamd_settings_map'];?></div>
1050 <div class="panel-body">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001051 <legend data-target="#active_settings_map" style="cursor:pointer" unselectable="on" data-toggle="collapse">
1052 <i style="font-size:10pt;" class="bi bi-plus-square"></i> <?=$lang['admin']['active_rspamd_settings_map'];?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001053 </legend>
1054 <div id="active_settings_map" class="collapse" >
1055 <textarea autocorrect="off" spellcheck="false" autocapitalize="none" class="form-control textarea-code" rows="20" name="settings_map" readonly><?=file_get_contents('http://nginx:8081/settings.php');?></textarea>
1056 </div>
1057 <br>
1058 <?php $rsettings = rsettings('get'); ?>
1059 <form class="form" data-id="rsettings" role="form" method="post">
1060 <div class="row">
1061 <div class="col-sm-3">
1062 <div class="list-group">
1063 <?php
1064 if (empty($rsettings)):
1065 ?>
1066 <span class="list-group-item"><em><?=$lang['admin']['rsetting_none'];?></em></span>
1067 <?php
1068 else:
1069 foreach ($rsettings as $rsetting):
1070 $rsetting_details = rsettings('details', $rsetting['id']);
1071 ?>
1072 <a href="#<?=$rsetting_details['id'];?>" class="list-group-item list-group-item-<?=($rsetting_details['active'] == '1') ? 'success' : ''; ?>" data-dont-remember="1" data-toggle="tab"><?=$rsetting_details['desc'];?> (ID #<?=$rsetting['id'];?>)</a>
1073 <?php
1074 endforeach;
1075 endif;
1076 ?>
1077 <a href="#" class="list-group-item list-group-item-default"
1078 data-id="add_domain_admin"
1079 data-toggle="modal"
1080 data-dont-remember="1"
1081 data-target="#addRsettingModal"
1082 data-toggle="tab"><?=$lang['admin']['rsetting_add_rule'];?></a>
1083 </div>
1084 </div>
1085 <div class="col-sm-9">
1086 <div class="tab-content">
1087 <?php
1088 if (empty($rsettings)):
1089 ?>
1090 <div id="none" class="tab-pane active">
1091 <p class="help-block"><?=$lang['admin']['rsetting_none'];?></p>
1092 </div>
1093 <?php
1094 else:
1095 ?>
1096 <div id="none" class="tab-pane active">
1097 <p class="help-block"><?=$lang['admin']['rsetting_no_selection'];?></p>
1098 </div>
1099 <?php
1100 foreach ($rsettings as $rsetting):
1101 $rsetting_details = rsettings('details', $rsetting['id']);
1102 ?>
1103 <div id="<?=$rsetting_details['id'];?>" class="tab-pane">
1104 <form class="form" data-id="rsettings" role="form" method="post">
1105 <input type="hidden" name="active" value="0">
1106 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001107 <label for="rsettings_desc"><?=$lang['admin']['rsetting_desc'];?>:</label>
1108 <input type="text" class="form-control" id="rsettings_desc" name="desc" value="<?=htmlspecialchars($rsetting_details['desc']);?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001109 </div>
1110 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001111 <label for="rsettings_content"><?=$lang['admin']['rsetting_content'];?>:</label>
1112 <textarea class="form-control" id="rsettings_content" name="content" rows="10"><?=htmlspecialchars($rsetting_details['content']);?></textarea>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001113 </div>
1114 <div class="form-group">
1115 <label>
1116 <input type="checkbox" name="active" value="1" <?=($rsetting_details['active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['active'];?>
1117 </label>
1118 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001119 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="<?=$rsetting_details['id'];?>" data-id="rsettings" data-api-url='edit/rsetting' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001120 <button class="btn btn-sm btn-danger" data-action="delete_selected" data-item="<?=$rsetting_details['id'];?>" data-id="rsettings" data-api-url="delete/rsetting" data-api-attr='{}' href="#"><?=$lang['admin']['remove'];?></button>
1121 </form>
1122 </div>
1123 <?php
1124 endforeach;
1125 endif;
1126 ?>
1127 </div>
1128 </div>
1129 </div>
1130 </form>
1131 </div>
1132 </div>
1133 </div>
1134
1135 <div role="tabpanel" class="tab-pane" id="tab-config-customize">
1136 <div class="panel panel-default">
1137 <div class="panel-heading"><?=$lang['admin']['customize'];?></div>
1138 <div class="panel-body">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001139 <legend><i class="bi bi-file-image"></i> <?=$lang['admin']['change_logo'];?></legend>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001140 <p class="help-block"><?=$lang['admin']['logo_info'];?></p>
1141 <form class="form-inline" role="form" method="post" enctype="multipart/form-data">
1142 <p>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001143 <input type="file" name="main_logo" accept="image/gif, image/jpeg, image/pjpeg, image/x-png, image/png, image/svg+xml"><br>
1144 <button name="submit_main_logo" type="submit" class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default"><i class="bi bi-upload"></i> <?=$lang['admin']['upload'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001145 </p>
1146 </form>
1147 <?php
1148 if ($main_logo = customize('get', 'main_logo')) {
1149 $specs = customize('get', 'main_logo_specs');
1150 ?>
1151 <div class="row">
1152 <div class="col-sm-3">
1153 <div class="thumbnail">
1154 <img class="img-thumbnail" src="<?=$main_logo;?>" alt="mailcow logo">
1155 <div class="caption">
1156 <span class="label label-info"><?=$specs['geometry']['width'];?>x<?=$specs['geometry']['height'];?> px</span>
1157 <span class="label label-info"><?=$specs['mimetype'];?></span>
1158 <span class="label label-info"><?=$specs['fileSize'];?></span>
1159 </div>
1160 </div>
1161 <hr>
1162 <form class="form-inline" role="form" method="post">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001163 <p><button name="reset_main_logo" type="submit" class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default"><?=$lang['admin']['reset_default'];?></button></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001164 </form>
1165 </div>
1166 </div>
1167 <?php } ?>
1168 <legend><?=$lang['admin']['app_links'];?></legend>
1169 <p class="help-block"><?=$lang['admin']['merged_vars_hint'];?></p>
1170 <form class="form-inline" data-id="app_links" role="form" method="post">
1171 <table class="table table-condensed" style="white-space: nowrap;" id="app_link_table">
1172 <tr>
1173 <th><?=$lang['admin']['app_name'];?></th>
1174 <th><?=$lang['admin']['link'];?></th>
1175 <th>&nbsp;</th>
1176 </tr>
1177 <?php
1178 $app_links = customize('get', 'app_links');
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001179 if ($app_links) {
1180 foreach ($app_links as $row) {
1181 foreach ($row as $key => $val) {
1182 ?>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001183 <tr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001184 <td><input class="input-sm input-xs-lg form-control" data-id="app_links" type="text" name="app" required value="<?=$key;?>"></td>
1185 <td><input class="input-sm input-xs-lg form-control" data-id="app_links" type="text" name="href" required value="<?=$val;?>"></td>
1186 <td><a href="#" role="button" class="btn btn-sm btn-xs-lg btn-default" type="button"><?=$lang['admin']['remove_row'];?></a></td>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001187 </tr>
1188 <?php
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001189 }
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001190 }
1191 }
1192 foreach ($MAILCOW_APPS as $app) {
1193 ?>
1194 <tr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001195 <td><input class="input-sm input-xs-lg form-control" value="<?=htmlspecialchars($app['name']);?>" disabled></td>
1196 <td><input class="input-sm input-xs-lg form-control" value="<?=htmlspecialchars($app['link']);?>" disabled></td>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001197 <td>&nbsp;</td>
1198 </tr>
1199 <?php } ?>
1200 </table>
1201 <p><div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001202 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="admin" data-id="app_links" data-reload="no" data-api-url='edit/app_links' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
1203 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" type="button" id="add_app_link_row"><?=$lang['admin']['add_row'];?></button>
1204 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001205 </div></p>
1206 </form>
1207 <legend data-target="#ui_texts" style="padding-top:20px" unselectable="on"><?=$lang['admin']['ui_texts'];?></legend>
1208 <div id="ui_texts">
1209 <?php $ui_texts = customize('get', 'ui_texts'); ?>
1210 <form class="form" data-id="uitexts" role="form" method="post">
1211 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001212 <label for="uitests_title_name"><?=$lang['admin']['title_name'];?>:</label>
1213 <input type="text" class="form-control" id="uitests_title_name" name="title_name" placeholder="mailcow UI" value="<?=$ui_texts['title_name'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001214 </div>
1215 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001216 <label for="uitests_main_name"><?=$lang['admin']['main_name'];?>:</label>
1217 <input type="text" class="form-control" id="uitests_main_name" name="main_name" placeholder="mailcow UI" value="<?=$ui_texts['main_name'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001218 </div>
1219 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001220 <label for="uitests_apps_name"><?=$lang['admin']['apps_name'];?>:</label>
1221 <input type="text" class="form-control" id="uitests_apps_name" name="apps_name" placeholder="<?=$lang['header']['apps']?>" value="<?=$ui_texts['apps_name'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001222 </div>
1223 <div class="form-group">
1224 <label for="help_text"><?=$lang['admin']['help_text'];?>:</label>
1225 <textarea class="form-control" id="help_text" name="help_text" rows="7"><?=$ui_texts['help_text'];?></textarea>
1226 </div>
1227 <hr>
1228 <div class="form-group">
1229 <p class="help-block"><?=$lang['admin']['ui_header_announcement_help'];?></p>
1230 <label for="ui_announcement_type"><?=$lang['admin']['ui_header_announcement'];?>:</label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001231 <p><select multiple data-width="100%" id="ui_announcement_type" name="ui_announcement_type" class="selectpicker show-tick" data-max-options="1" title="<?=$lang['admin']['ui_header_announcement_select'];?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001232 <option <?=($ui_texts['ui_announcement_type'] == 'info') ? 'selected' : null;?> value="info"><?=$lang['admin']['ui_header_announcement_type_info'];?></option>
1233 <option <?=($ui_texts['ui_announcement_type'] == 'warning') ? 'selected' : null;?> value="warning"><?=$lang['admin']['ui_header_announcement_type_warning'];?></option>
1234 <option <?=($ui_texts['ui_announcement_type'] == 'danger') ? 'selected' : null;?> value="danger"><?=$lang['admin']['ui_header_announcement_type_danger'];?></option>
1235 </select></p>
1236 <p><textarea class="form-control" id="ui_announcement_text" name="ui_announcement_text" rows="7"><?=$ui_texts['ui_announcement_text'];?></textarea></p>
1237 <div class="checkbox">
1238 <label>
1239 <input type="checkbox" name="ui_announcement_active" class="form-check-input" <?=($ui_texts['ui_announcement_active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['ui_header_announcement_active'];?>
1240 </label>
1241 </div>
1242 </div>
1243 <hr>
1244 <div class="form-group">
1245 <label for="ui_footer"><?=$lang['admin']['ui_footer'];?>:</label>
1246 <textarea class="form-control" id="ui_footer" name="ui_footer" rows="7"><?=$ui_texts['ui_footer'];?></textarea>
1247 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001248 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="ui" data-id="uitexts" data-api-url='edit/ui_texts' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001249 </form>
1250 </div>
1251 </div>
1252 </div>
1253 </div>
1254
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001255 <div role="tabpanel" class="tab-pane" id="tab-config-password-policy">
1256 <div class="panel panel-default">
1257 <div class="panel-heading"><?=$lang['admin']['password_policy'];?></div>
1258 <div class="panel-body">
1259 <?php $password_complexity = password_complexity('get'); ?>
1260 <form class="form-horizontal" data-id="passwordpolicy" role="form" method="post">
1261 <?php
1262 foreach ($password_complexity as $name => $value) {
1263 if ($name == 'length') {
1264 ?>
1265 <div class="form-group">
1266 <label class="control-label col-sm-3" for="<?=$name;?>"><?=$lang['admin']['password_length'];?>:</label>
1267 <div class="col-sm-2">
1268 <input type="number" class="form-control" min="3" max="64" name="<?=$name;?>" id="<?=$name;?>" value="<?=$value;?>" required>
1269 </div>
1270 </div>
1271 <?php
1272 } else {
1273 ?>
1274 <input type="hidden" name="<?=$name;?>" value="0">
1275 <div class="form-group">
1276 <div class="col-sm-offset-3 col-sm-9">
1277 <label>
1278 <input type="checkbox" name="<?=$name;?>" id="<?=$name;?>" value="1" <?=($value == 1) ? 'checked' : null;?>> <?=$lang['admin']["password_policy_$name"];?>
1279 </label>
1280 </div>
1281 </div>
1282 <?php
1283 }
1284 }
1285 ?>
1286 <div class="form-group">
1287 <div class="col-sm-offset-3 col-sm-9">
1288 <div class="btn-group">
1289 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-item="passwordpolicy" data-action="edit_selected" data-id="passwordpolicy" data-api-url='edit/passwordpolicy' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['admin']['save'];?></button>
1290 </div>
1291 </div>
1292 </div>
1293 </form>
1294 </div>
1295 </div>
1296 </div>
1297
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001298 <div role="tabpanel" class="tab-pane" id="tab-sys-mails">
1299 <div class="panel panel-default">
1300 <div class="panel-heading"><?=$lang['admin']['sys_mails'];?></div>
1301 <div class="panel-body">
1302 <form class="form-horizontal" autocapitalize="none" data-id="admin" autocorrect="off" role="form" method="post">
1303 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001304 <label class="control-label col-sm-2" for="admin_mass_from"><?=$lang['admin']['from'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001305 <div class="col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001306 <input type="email" class="form-control" id="admin_mass_from" name="mass_from" value="noreply@<?=getenv('MAILCOW_HOSTNAME');;?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001307 </div>
1308 </div>
1309 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001310 <label class="control-label col-sm-2" for="admin_mass_subject"><?=$lang['admin']['subject'];?>:</label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001311 <div class="col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001312 <input type="text" class="form-control" id="admin_mass_subject" name="mass_subject" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001313 </div>
1314 </div>
1315 <?php
1316 $domains = array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains'));
1317 if (!empty($domains)) {
1318 foreach ($domains as $domain) {
1319 foreach (mailbox('get', 'mailboxes', $domain) as $mailbox) {
1320 $mailboxes[] = $mailbox;
1321 }
1322 }
1323 }
1324 ?>
1325 <div class="form-group">
1326 <label class="control-label col-sm-2" for="mass_subject"><?=$lang['admin']['include_exclude'];?>:
1327 <p class="help-block"><?=$lang['admin']['include_exclude_info'];?></p>
1328 </label>
1329 <div class="col-sm-5">
1330 <label class="control-label" for="mass_exclude"><?=$lang['admin']['excludes'];?>:</label>
1331 <select id="mass_exclude" name="mass_exclude[]" data-live-search="true" data-width="100%" size="30" multiple>
1332 <?php
1333 if (!empty($mailboxes)) {
1334 foreach (array_filter($mailboxes) as $mailbox) {
1335 ?>
1336 <option><?=htmlspecialchars($mailbox);?></option>
1337 <?php
1338 }
1339 }
1340 ?>
1341 </select>
1342 </div>
1343 <div class="col-sm-5">
1344 <label class="control-label" for="mass_include"><?=$lang['admin']['includes'];?>:</label>
1345 <select id="mass_include" name="mass_include[]" data-live-search="true" data-width="100%" size="30" multiple>
1346 <?php
1347 if (!empty($mailboxes)) {
1348 foreach (array_filter($mailboxes) as $mailbox) {
1349 ?>
1350 <option><?=htmlspecialchars($mailbox);?></option>
1351 <?php
1352 }
1353 }
1354 ?>
1355 </select>
1356 </div>
1357 </div>
1358 <div class="form-group">
1359 <label class="control-label col-sm-2" for="mass_text"><?=$lang['admin']['text'];?>:</label>
1360 <div class="col-sm-10">
1361 <textarea class="form-control" rows="10" name="mass_text" id="mass_text" required></textarea>
1362 </div>
1363 </div>
1364 <div class="form-group">
1365 <label class="control-label col-sm-2" for="mass_html"><?=$lang['admin']['html'];?> (<?=$lang['admin']['optional'];?>):</label>
1366 <div class="col-sm-10">
1367 <textarea class="form-control" rows="10" name="mass_html" id="mass_html"></textarea>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001368 <p class="small"><i class="bi bi-arrow-return-right"></i> <a target="_blank" href="https://templates.mailchimp.com/resources/html-to-text/"><?=$lang['admin']['convert_html_to_text'];?></a></p>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001369 </div>
1370 </div>
1371 <div class="form-group">
1372 <div class="col-sm-offset-2 col-sm-10">
1373 <label>
1374 <input type="checkbox" id="mass_disarm"> <?=$lang['admin']['activate_send'];?>
1375 </label>
1376 </div>
1377 </div>
1378 <div class="form-group">
1379 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001380 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" type="submit" id="mass_send" name="mass_send" disabled><i class="bi bi-envelope-fill"></i> <?=$lang['admin']['send'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001381 </div>
1382 </div>
1383 </form>
1384 </div>
1385 </div>
1386 </div>
1387
1388 <div role="tabpanel" class="tab-pane" id="tab-mailq">
1389 <div class="panel panel-default">
1390 <div class="panel-heading">
1391 <?=$lang['admin']['queue_manager'];?> <span class="badge badge-info table-lines"></span>
1392 <div class="btn-group pull-right">
1393 <button class="btn btn-xs btn-default refresh_table" data-draw="draw_queue" data-table="queuetable"><?=$lang['admin']['refresh'];?></button>
1394 </div>
1395 </div>
1396 <div class="panel-body">
1397 <div class="table-responsive">
1398 <table class="table table-striped table-condensed" id="queuetable"></table>
1399 </div>
1400 <div class="mass-actions-admin">
1401 <div class="btn-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001402 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" id="toggle_multi_select_all" data-id="mailqitems" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>
1403 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
1404 <ul class="dropdown-menu top33">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001405 <li><a data-toggle="tooltip" title="postqueue -i" data-action="edit_selected" data-id="mailqitems" data-api-url='edit/mailq' data-api-attr='{"action":"deliver"}' href="#"><?=$lang['admin']['queue_deliver_mail'];?></a></li>
1406 <li><a data-toggle="tooltip" title="postsuper -H" data-action="edit_selected" data-id="mailqitems" data-api-url='edit/mailq' data-api-attr='{"action":"unhold"}' href="#"><?=$lang['admin']['queue_unhold_mail'];?></a></li>
1407 <li><a data-toggle="tooltip" title="postsuper -h" data-action="edit_selected" data-id="mailqitems" data-api-url='edit/mailq' data-api-attr='{"action":"hold"}' href="#"><?=$lang['admin']['queue_hold_mail'];?></a></li>
1408 <li role="separator" class="divider"></li>
1409 <li><a data-toggle="tooltip" title="postsuper -d" data-action="delete_selected" data-id="mailqitems" data-api-url='delete/mailq' href="#"><?=$lang['mailbox']['remove'];?></a></li>
1410 </ul>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001411 <div class="clearfix visible-xs"></div>
1412 <a class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-primary"
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001413 data-action="edit_selected"
1414 data-item="mailqitems-all"
1415 data-api-url='edit/mailq'
1416 data-api-attr='{"action":"flush"}'
1417 data-toggle="tooltip" title="postqueue -f"
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001418 href="#"><i class="bi bi-check-all"></i> <?=$lang['admin']['flush_queue'];?></a>
1419 <a class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-danger"
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001420 id="super_delete"
1421 data-action="edit_selected"
1422 data-item="mailqitems-all"
1423 data-api-url='edit/mailq'
1424 data-api-attr='{"action":"super_delete"}'
1425 data-toggle="tooltip" title="postsuper -d ALL"
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001426 href="#"><i class="bi bi-trash"></i> <?=$lang['admin']['delete_queue'];?></a>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001427 </div>
1428 </div>
1429 </div>
1430 </div>
1431 </div>
1432
1433 <div role="tabpanel" class="tab-pane" id="tab-globalfilter-regex">
1434 <div class="panel panel-default">
1435 <div class="panel-heading">
1436 <?=$lang['admin']['rspamd_global_filters'];?>
1437 </div>
1438 <div class="panel-body">
1439 <p><?=$lang['admin']['rspamd_global_filters_info'];?></p>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001440 <div id="confirm_show_rspamd_global_filters" class="<?=(!isset($_SESSION['show_rspamd_global_filters']) || $_SESSION['show_rspamd_global_filters'] !== true) ? '' : 'hidden';?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001441 <div class="form-group">
1442 <div class="col-sm-offset-2 col-sm-10">
1443 <label>
1444 <input type="checkbox" id="show_rspamd_global_filters"> <?=$lang['admin']['rspamd_global_filters_agree'];?>
1445 </label>
1446 </div>
1447 </div>
1448 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001449 <div id="rspamd_global_filters" class="<?=(isset($_SESSION['show_rspamd_global_filters']) && $_SESSION['show_rspamd_global_filters'] === true) ? '' : 'hidden';?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001450 <hr>
1451 <span class="anchor" id="regexmaps"></span>
1452 <h4><?=$lang['admin']['regex_maps'];?></h4>
1453 <p><?=$lang['admin']['rspamd_global_filters_regex'];?></p>
1454 <ul>
1455 <?php
1456 foreach ($RSPAMD_MAPS['regex'] as $rspamd_regex_desc => $rspamd_regex_map):
1457 ?>
1458 <li><a href="#<?=$rspamd_regex_map;?>"><?=$rspamd_regex_desc;?></a> (<small><?=$rspamd_regex_map;?></small>)</li>
1459 <?php
1460 endforeach;
1461 ?>
1462 </ul>
1463 <?php
1464 foreach ($RSPAMD_MAPS['regex'] as $rspamd_regex_desc => $rspamd_regex_map):
1465 ?>
1466 <hr>
1467 <span class="anchor" id="<?=$rspamd_regex_map;?>"></span>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001468 <form class="form-horizontal" data-cached-form="false" data-id="<?=$rspamd_regex_map;?>" role="form" method="post">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001469 <div class="form-group">
1470 <label class="control-label col-sm-3" for="<?=$rspamd_regex_map;?>"><?=$rspamd_regex_desc;?><br><small><?=$rspamd_regex_map;?></small></label>
1471 <div class="col-sm-9">
1472 <textarea id="<?=$rspamd_regex_map;?>" spellcheck="false" autocorrect="off" autocapitalize="none" class="form-control textarea-code" rows="10" name="rspamd_map_data" required><?=file_get_contents('/rspamd_custom_maps/' . $rspamd_regex_map);?></textarea>
1473 </div>
1474 </div>
1475 <div class="form-group">
1476 <div class="col-sm-offset-3 col-sm-9">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001477 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default validate_rspamd_regex" data-regex-map="<?=$rspamd_regex_map;?>" href="#"><?=$lang['add']['validate'];?></button>
1478 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success submit_rspamd_regex" data-action="edit_selected" data-id="<?=$rspamd_regex_map;?>" data-item="<?=htmlspecialchars($rspamd_regex_map);?>" data-api-url='edit/rspamd-map' data-api-attr='{}' href="#" disabled><?=$lang['edit']['save'];?></button>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001479 </div>
1480 </div>
1481 </form>
1482 <?php
1483 endforeach;
1484 ?>
1485 </div>
1486 </div>
1487 </div>
1488 </div>
1489
1490 </div> <!-- /tab-content -->
1491 </div> <!-- /col-md-12 -->
1492 </div> <!-- /row -->
1493</div> <!-- /container -->
1494<?php
1495require_once $_SERVER['DOCUMENT_ROOT'] . '/modals/admin.php';
1496?>
1497<script type='text/javascript'>
1498<?php
1499$lang_admin = json_encode($lang['admin']);
1500echo "var lang = ". $lang_admin . ";\n";
1501echo "var admin_username = '". $_SESSION['mailcow_cc_username'] . "';\n";
1502echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n";
1503echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
1504echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
1505?>
1506</script>
1507<?php
1508$js_minifier->add('/web/js/site/admin.js');
1509$js_minifier->add('/web/js/presets/rspamd.js');
1510$js_minifier->add('/web/js/site/pwgen.js');
1511require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
1512} else {
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001513 header('Location: /');
1514 exit();
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001515}
1516?>