Add random created master at each startup to handle SOGo features

master
andryyy 2016-12-21 08:25:47 +01:00
parent ed9d64bab4
commit eef81c58ae
8 changed files with 20 additions and 6 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
rebuild-images.sh
data/conf/sogo/sieve.creds
data/conf/dovecot/dovecot-master.passwd

View File

@ -13,4 +13,10 @@ chown -R vmail:vmail /var/vmail/sieve
# Do not do this every start-up, it may take a very long time. So we use a stat check here.
if [[ $(stat -c %U /var/vmail/) != "vmail" ]] ; then chown -R vmail:vmail /var/vmail ; fi
# Create random master for SOGo sieve features
RAND_USER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
RAND_PASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
echo ${RAND_USER}:$(doveadm pw -s PBKDF2 -p ${RAND_PASSWD}) > /etc/dovecot/dovecot-master.passwd
echo ${RAND_USER}:${RAND_PASS} > /etc/sogo/sieve.creds
exec "$@"

View File

@ -5,5 +5,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
while true; do
/usr/sbin/sogo-tool expire-sessions 60
/usr/sbin/sogo-ealarms-notify
/usr/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.creds
sleep 60
done

View File

@ -80,6 +80,7 @@ if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "adm
<button type="submit" name="trigger_mailbox_action" value="adddomain" class="btn btn-success"><?=$lang['add']['save'];?></button>
</div>
</div>
<p><span class="glyphicon glyphicon-exclamation-sign text-danger"></span> <?=$lang['add']['restart_sogo_hint'];?></p>
</form>
<?php
}

View File

@ -328,12 +328,12 @@ function mailbox_add_domain($postarray) {
':modified' => date('Y-m-d H:i:s'),
':relay_all_recipients' => $relay_all_recipients
));
/*
PoC for a restart with supervisord unix socket
* $sock = stream_socket_client("unix:///var/run/controller/supervisord.sock", $errno, $errstr, 30);
* fwrite($sock, "GET ?processname=sogo&action=restart HTTP/1.0\r\nAccept: */*\r\n\r\n");
* fclose($sock);
*/
//
// PoC for a restart with supervisord unix socket
// * $sock = stream_socket_client("unix:///var/run/controller/supervisord.sock", $errno, $errstr, 30);
// * fwrite($sock, "GET ?processname=sogo&action=restart HTTP/1.0\r\nAccept: */*\r\n\r\n");
// * fclose($sock);
//
$_SESSION['return'] = array(
'type' => 'success',
'msg' => sprintf($lang['success']['domain_added'], htmlspecialchars($domain))

View File

@ -283,6 +283,7 @@ $lang['add']['select_domain'] = 'Bitte zuerst eine Domain auswählen';
$lang['add']['password'] = 'Passwort:';
$lang['add']['password_repeat'] = 'Passwort (Wiederholung):';
$lang['add']['previous'] = 'Vorherige Seite';
$lang['add']['restart_sogo_hint'] = 'Der SOGo Container muss nach dem Hinzufügen einer neuen Domain neugestartet werden!';
$lang['login']['title'] = 'Anmeldung';
$lang['login']['administration'] = 'Administration';

View File

@ -283,6 +283,7 @@ $lang['add']['select_domain'] = 'Please select a domain first';
$lang['add']['password'] = 'Password:';
$lang['add']['password_repeat'] = 'Confirmation password (repeat):';
$lang['add']['previous'] = 'Previous page';
$lang['add']['restart_sogo_hint'] = 'You will need to restart the SOGo service container after adding a new domain!';
$lang['login']['title'] = 'Login';
$lang['login']['administration'] = 'Administration';

View File

@ -134,6 +134,8 @@ services:
- ./data/conf/dovecot:/etc/dovecot
- ./data/assets/ssl:/etc/ssl/mail/:ro
- vmail-vol-1:/var/vmail
volumes_from:
- sogo-mailcow
environment:
- DBNAME=${DBNAME}
- DBUSER=${DBUSER}