commit
5a9a9d4e9c
|
@ -1,17 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Go in a 5 minute loop
|
# Recreate view
|
||||||
while true; do
|
|
||||||
|
|
||||||
# Wait for MySQL to warm-up
|
mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "DROP VIEW IF EXISTS sogo_view"
|
||||||
while ! mysqladmin ping --host mysql --silent; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
mkdir -p /var/lib/sogo/GNUstep/Defaults/
|
mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} << EOF
|
||||||
|
CREATE VIEW sogo_view (c_uid, domain, c_name, c_password, c_cn, mail, aliases, ad_aliases, senderacl, home) AS
|
||||||
|
SELECT mailbox.username, mailbox.domain, mailbox.username, mailbox.password, mailbox.name, mailbox.username, IFNULL(ga.aliases, ''), IFNULL(gda.ad_alias, ''), IFNULL(gs.send_as, ''), CONCAT('/var/vmail/', maildir) FROM mailbox
|
||||||
|
LEFT OUTER JOIN grouped_mail_aliases ga ON ga.username = mailbox.username
|
||||||
|
LEFT OUTER JOIN grouped_sender_acl gs ON gs.username = mailbox.username
|
||||||
|
LEFT OUTER JOIN grouped_domain_alias_address gda ON gda.username = mailbox.username
|
||||||
|
WHERE mailbox.active = '1';
|
||||||
|
EOF
|
||||||
|
|
||||||
# Generate plist header with timezone data
|
# Wait for MySQL to warm-up
|
||||||
cat <<EOF > /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
while ! mysqladmin ping --host mysql --silent; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p /var/lib/sogo/GNUstep/Defaults/
|
||||||
|
|
||||||
|
# Generate plist header with timezone data
|
||||||
|
cat <<EOF > /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//GNUstep//DTD plist 0.9//EN" "http://www.gnustep.org/plist-0_9.xml">
|
<!DOCTYPE plist PUBLIC "-//GNUstep//DTD plist 0.9//EN" "http://www.gnustep.org/plist-0_9.xml">
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
|
@ -22,6 +32,8 @@ while true; do
|
||||||
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_cache_folder</string>
|
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_cache_folder</string>
|
||||||
<key>OCSEMailAlarmsFolderURL</key>
|
<key>OCSEMailAlarmsFolderURL</key>
|
||||||
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_alarms_folder</string>
|
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_alarms_folder</string>
|
||||||
|
<key>DomainFieldName</key>
|
||||||
|
<string>domain</string>
|
||||||
<key>OCSFolderInfoURL</key>
|
<key>OCSFolderInfoURL</key>
|
||||||
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_folder_info</string>
|
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_folder_info</string>
|
||||||
<key>OCSSessionsFolderURL</key>
|
<key>OCSSessionsFolderURL</key>
|
||||||
|
@ -36,14 +48,14 @@ while true; do
|
||||||
<dict>
|
<dict>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Generate multi-domain setup
|
# Generate multi-domain setup
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
DOMAIN_SANE=$(echo ${line} | tr '-' 'b' | tr '.' 'p' | tr -cd '[[:alnum:]]')
|
DOMAIN_SANE=$(echo ${line} | tr '-' 'b' | tr '.' 'p' | tr -cd '[[:alnum:]]')
|
||||||
echo " <key>${line}</key>
|
echo " <key>${line}</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>SOGoMailDomain</key>
|
<key>SOGoMailDomain</key>
|
||||||
<string>$(echo ${line} | tr '-' 'b' | tr '.' 'p')</string>
|
<string>${DOMAIN_SANE}</string>
|
||||||
<key>SOGoUserSources</key>
|
<key>SOGoUserSources</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -72,30 +84,19 @@ EOF
|
||||||
<key>userPasswordAlgorithm</key>
|
<key>userPasswordAlgorithm</key>
|
||||||
<string>ssha256</string>
|
<string>ssha256</string>
|
||||||
<key>viewURL</key>
|
<key>viewURL</key>
|
||||||
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_view_${DOMAIN_SANE}</string>
|
<string>mysql://${DBUSER}:${DBPASS}@mysql:3306/${DBNAME}/sogo_view</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>" >> /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
</dict>" >> /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
||||||
mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "DROP VIEW IF EXISTS sogo_view_${DOMAIN_SANE}"
|
|
||||||
mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} << EOF
|
|
||||||
CREATE VIEW sogo_view_${DOMAIN_SANE} (c_uid, c_name, c_password, c_cn, mail, aliases, ad_aliases, senderacl, home) AS
|
|
||||||
SELECT mailbox.username, mailbox.username, mailbox.password, mailbox.name, mailbox.username, IFNULL(ga.aliases, ''), IFNULL(gda.ad_alias, ''), IFNULL(gs.send_as, ''), CONCAT('/var/vmail/', maildir) FROM mailbox
|
|
||||||
LEFT OUTER JOIN grouped_mail_aliases ga ON ga.username = mailbox.username
|
|
||||||
LEFT OUTER JOIN grouped_sender_acl gs ON gs.username = mailbox.username
|
|
||||||
LEFT OUTER JOIN grouped_domain_alias_address gda ON gda.username = mailbox.username
|
|
||||||
WHERE mailbox.active = '1' AND domain = '${line}';
|
|
||||||
EOF
|
|
||||||
done < <(mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT domain FROM domain;" -B -N)
|
done < <(mysql --host mysql -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT domain FROM domain;" -B -N)
|
||||||
|
|
||||||
# Generate footer
|
# Generate footer
|
||||||
echo ' </dict>
|
echo ' </dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>' >> /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
</plist>' >> /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
||||||
|
|
||||||
# Fix permissions
|
# Fix permissions
|
||||||
chown sogo:sogo -R /var/lib/sogo/
|
chown sogo:sogo -R /var/lib/sogo/
|
||||||
chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
chmod 600 /var/lib/sogo/GNUstep/Defaults/sogod.plist
|
||||||
|
|
||||||
sleep 300
|
sleep infinite
|
||||||
|
|
||||||
done
|
|
||||||
|
|
|
@ -27,6 +27,10 @@ server {
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
fastcgi_param PHP_VALUE "max_execution_time = 1200
|
||||||
|
max_input_time = 1200
|
||||||
|
memory_limit = 64M";
|
||||||
|
fastcgi_read_timeout 1200;
|
||||||
}
|
}
|
||||||
|
|
||||||
rewrite ^(/save.+)$ /rspamd$1 last;
|
rewrite ^(/save.+)$ /rspamd$1 last;
|
||||||
|
|
|
@ -6,12 +6,12 @@ if ($_SESSION['mailcow_cc_role'] == "admin"):
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 class="modal-title">Restart SOGo</h4>
|
<h4 class="modal-title"><?=$lang['footer']['restart_sogo'];?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>Some tasks, e.g. adding a domain, require you to restart SOGo to catch changes made in the mailcow UI.</p>
|
<p><?=$lang['footer']['restart_sogo_info'];?></p>
|
||||||
<hr />
|
<hr />
|
||||||
<button class="btn btn-md btn-primary" id="triggerRestartSogo">Restart SOGo</button>
|
<button class="btn btn-md btn-primary" id="triggerRestartSogo"><?=$lang['footer']['restart_now'];?></button>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<div id="statusTriggerRestartSogo"></div>
|
<div id="statusTriggerRestartSogo"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,11 +8,12 @@ function hasDomainAccess($username, $role, $domain) {
|
||||||
if (!filter_var($username, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $username))) {
|
if (!filter_var($username, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $username))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_valid_domain_name($domain)) {
|
if (!is_valid_domain_name($domain)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($role != 'admin' && $role != 'domainadmin' && $role != 'user') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$stmt = $pdo->prepare("SELECT `domain` FROM `domain_admins`
|
$stmt = $pdo->prepare("SELECT `domain` FROM `domain_admins`
|
||||||
WHERE (
|
WHERE (
|
||||||
|
@ -2192,6 +2193,9 @@ function delete_domain_admin($postarray) {
|
||||||
function get_spam_score($username) {
|
function get_spam_score($username) {
|
||||||
global $pdo;
|
global $pdo;
|
||||||
$default = "5, 15";
|
$default = "5, 15";
|
||||||
|
if ($_SESSION['mailcow_cc_role'] != "user") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
@ -2235,6 +2239,13 @@ function get_spam_score($username) {
|
||||||
function set_spam_score($postarray) {
|
function set_spam_score($postarray) {
|
||||||
global $lang;
|
global $lang;
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
if ($_SESSION['mailcow_cc_role'] != "user") {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$username = $_SESSION['mailcow_cc_username'];
|
$username = $_SESSION['mailcow_cc_username'];
|
||||||
$lowspamlevel = explode(',', $postarray['score'])[0];
|
$lowspamlevel = explode(',', $postarray['score'])[0];
|
||||||
$highspamlevel = explode(',', $postarray['score'])[1];
|
$highspamlevel = explode(',', $postarray['score'])[1];
|
||||||
|
@ -2288,7 +2299,15 @@ function set_spam_score($postarray) {
|
||||||
function set_policy_list($postarray) {
|
function set_policy_list($postarray) {
|
||||||
global $lang;
|
global $lang;
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
if ($_SESSION['mailcow_cc_role'] != "admin" &&
|
||||||
|
$_SESSION['mailcow_cc_role'] != "domainadmin" &&
|
||||||
|
$_SESSION['mailcow_cc_role'] != "user") {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
(isset($postarray['domain'])) ? $object = $postarray['domain'] : $object = $_SESSION['mailcow_cc_username'];
|
(isset($postarray['domain'])) ? $object = $postarray['domain'] : $object = $_SESSION['mailcow_cc_username'];
|
||||||
($postarray['object_list'] == "bl") ? $object_list = "blacklist_from" : $object_list = "whitelist_from";
|
($postarray['object_list'] == "bl") ? $object_list = "blacklist_from" : $object_list = "whitelist_from";
|
||||||
$object_from = preg_replace('/\.+/', '.', rtrim(preg_replace("/\.\*/", "*", trim(strtolower($postarray['object_from']))), '.'));
|
$object_from = preg_replace('/\.+/', '.', rtrim(preg_replace("/\.\*/", "*", trim(strtolower($postarray['object_from']))), '.'));
|
||||||
|
@ -2389,6 +2408,13 @@ function set_policy_list($postarray) {
|
||||||
function set_tls_policy($postarray) {
|
function set_tls_policy($postarray) {
|
||||||
global $lang;
|
global $lang;
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
if ($_SESSION['mailcow_cc_role'] != "user") {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
isset($postarray['tls_in']) ? $tls_in = '1' : $tls_in = '0';
|
isset($postarray['tls_in']) ? $tls_in = '1' : $tls_in = '0';
|
||||||
isset($postarray['tls_out']) ? $tls_out = '1' : $tls_out = '0';
|
isset($postarray['tls_out']) ? $tls_out = '1' : $tls_out = '0';
|
||||||
$username = $_SESSION['mailcow_cc_username'];
|
$username = $_SESSION['mailcow_cc_username'];
|
||||||
|
@ -2422,6 +2448,9 @@ function set_tls_policy($postarray) {
|
||||||
function get_tls_policy($username) {
|
function get_tls_policy($username) {
|
||||||
global $lang;
|
global $lang;
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
if ($_SESSION['mailcow_cc_role'] != "user") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
|
|
|
@ -226,7 +226,7 @@ endif;
|
||||||
<?php
|
<?php
|
||||||
if ($_SESSION['mailcow_cc_role'] == "admin"):
|
if ($_SESSION['mailcow_cc_role'] == "admin"):
|
||||||
?>
|
?>
|
||||||
<li><a href data-toggle="modal" data-target="#RestartSOGo"><span style="font-size:12px" class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Restart SOGo</a></li>
|
<li><a href data-toggle="modal" data-target="#RestartSOGo"><span style="font-size:12px" class="glyphicon glyphicon-refresh" aria-hidden="true"></span> <?=$lang['header']['restart_sogo'];?></a></li>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
//
|
//
|
||||||
*/
|
*/
|
||||||
$lang['footer']['loading'] = 'Einen Moment bitte...';
|
$lang['footer']['loading'] = 'Einen Moment bitte...';
|
||||||
$lang['getmail']['no_status'] = 'Keinen letzten Vorgang festgestellt.';
|
$lang['header']['restart_sogo'] = 'SOGo neustarten';
|
||||||
|
$lang['footer']['restart_sogo'] = 'SOGo neustarten';
|
||||||
|
$lang['footer']['restart_now'] = 'Jetzt neustarten';
|
||||||
|
$lang['footer']['restart_sogo_info'] = 'Einige Änderungen an Domains benötigen einen Neustart SOGos. Hier können Sie SOGo neustarten.<br /><br /><b>Wichtig:</b> Ein korrekter Neustart SOGos kann eine Weile in Anspruch nehmen, bitte warten Sie, bis der Prozess vollständig beendet wurde.';
|
||||||
$lang['dkim']['confirm'] = 'Sind Sie sicher?';
|
$lang['dkim']['confirm'] = 'Sind Sie sicher?';
|
||||||
$lang['danger']['dkim_not_found'] = 'DKIM-Record nicht gefunden';
|
$lang['danger']['dkim_not_found'] = 'DKIM-Record nicht gefunden';
|
||||||
$lang['danger']['dkim_remove_failed'] = 'Kann DKIM-Record nicht entfernen';
|
$lang['danger']['dkim_remove_failed'] = 'Kann DKIM-Record nicht entfernen';
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
//
|
//
|
||||||
*/
|
*/
|
||||||
$lang['footer']['loading'] = "Please wait...";
|
$lang['footer']['loading'] = "Please wait...";
|
||||||
$lang['getmail']['no_status'] = "No previous status found.";
|
$lang['header']['restart_sogo'] = 'Restart SOGo';
|
||||||
|
$lang['footer']['restart_sogo'] = 'Restart SOGo';
|
||||||
|
$lang['footer']['restart_now'] = 'Restart now';
|
||||||
|
$lang['footer']['restart_sogo_info'] = 'Some tasks, e.g. adding a domain, require you to restart SOGo to catch changes made in the mailcow UI.<br /><br /><b>Important:</b> A graceful restart may take a while to complete, please wait for it to finish.';
|
||||||
$lang['dkim']['confirm'] = "Are you sure?";
|
$lang['dkim']['confirm'] = "Are you sure?";
|
||||||
$lang['danger']['dkim_not_found'] = "DKIM record not found";
|
$lang['danger']['dkim_not_found'] = "DKIM record not found";
|
||||||
$lang['danger']['dkim_remove_failed'] = "Cannot remove selected DKIM record";
|
$lang['danger']['dkim_remove_failed'] = "Cannot remove selected DKIM record";
|
||||||
|
|
|
@ -58,6 +58,7 @@ services:
|
||||||
- ./data/conf/rspamd/local.d/:/etc/rspamd/local.d:ro
|
- ./data/conf/rspamd/local.d/:/etc/rspamd/local.d:ro
|
||||||
- ./data/conf/rspamd/lua/:/etc/rspamd/lua/:ro
|
- ./data/conf/rspamd/lua/:/etc/rspamd/lua/:ro
|
||||||
- dkim-vol-1:/data/dkim
|
- dkim-vol-1:/data/dkim
|
||||||
|
- rspamd-vol-1:/var/lib/rspamd
|
||||||
restart: always
|
restart: always
|
||||||
dns:
|
dns:
|
||||||
- 172.22.1.254
|
- 172.22.1.254
|
||||||
|
@ -234,3 +235,4 @@ volumes:
|
||||||
mysql-vol-1:
|
mysql-vol-1:
|
||||||
dkim-vol-1:
|
dkim-vol-1:
|
||||||
redis-vol-1:
|
redis-vol-1:
|
||||||
|
rspamd-vol-1:
|
||||||
|
|
Loading…
Reference in New Issue