Merge branch 'dev'
commit
e6a0a7ff8f
|
@ -6,7 +6,7 @@ if [[ $(stat -c %U /data/dkim/) != "www-data" ]] ; then chown -R www-data:www-da
|
||||||
|
|
||||||
# Wait for containers
|
# Wait for containers
|
||||||
|
|
||||||
while ! mysqladmin ping --host mysql --silent; do
|
while ! mysqladmin ping --host mysql -u${DBUSER} -p${DBPASS} --silent; do
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Wait for MySQL to warm-up
|
# Wait for MySQL to warm-up
|
||||||
while mysqladmin ping --host 172.22.1.250 --silent; do
|
while mysqladmin ping --host mysql -u${DBUSER} -p${DBPASS}${DBPASS} --silent; do
|
||||||
|
|
||||||
# Wait until port becomes free and send sig
|
# Wait until port becomes free and send sig
|
||||||
until ! nc -z sogo-mailcow 20000;
|
until ! nc -z sogo-mailcow 20000;
|
||||||
|
|
|
@ -23,6 +23,7 @@ ssl_dh_parameters_length = 2048
|
||||||
log_timestamp = "%Y-%m-%d %H:%M:%S "
|
log_timestamp = "%Y-%m-%d %H:%M:%S "
|
||||||
recipient_delimiter = +
|
recipient_delimiter = +
|
||||||
auth_master_user_separator = *
|
auth_master_user_separator = *
|
||||||
|
mail_shared_explicit_inbox = yes
|
||||||
mail_prefetch_count = 30
|
mail_prefetch_count = 30
|
||||||
passdb {
|
passdb {
|
||||||
driver = passwd-file
|
driver = passwd-file
|
||||||
|
|
|
@ -138,7 +138,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
!empty($_GET["domain"])) {
|
!empty($_GET["domain"])) {
|
||||||
$domain = $_GET["domain"];
|
$domain = $_GET["domain"];
|
||||||
$result = mailbox('get', 'domain_details', $domain);
|
$result = mailbox('get', 'domain_details', $domain);
|
||||||
$rl = mailbox('get', 'domain_ratelimit', $domain);
|
$rl = mailbox('get', 'ratelimit', $domain);
|
||||||
$rlyhosts = relayhost('get');
|
$rlyhosts = relayhost('get');
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
?>
|
?>
|
||||||
|
@ -251,7 +251,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="btn btn-default" id="edit_selected" data-id="domratelimit" data-item="<?=$domain;?>" data-api-url='edit/domain-ratelimit' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
|
<button class="btn btn-default" id="edit_selected" data-id="domratelimit" data-item="<?=$domain;?>" data-api-url='edit/ratelimit' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -314,7 +314,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
!empty($_GET["aliasdomain"])) {
|
!empty($_GET["aliasdomain"])) {
|
||||||
$alias_domain = $_GET["aliasdomain"];
|
$alias_domain = $_GET["aliasdomain"];
|
||||||
$result = mailbox('get', 'alias_domain_details', $alias_domain);
|
$result = mailbox('get', 'alias_domain_details', $alias_domain);
|
||||||
$rl = mailbox('get', 'domain_ratelimit', $alias_domain);
|
$rl = mailbox('get', 'ratelimit', $alias_domain);
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
?>
|
?>
|
||||||
<h4><?=$lang['edit']['edit_alias_domain'];?></h4>
|
<h4><?=$lang['edit']['edit_alias_domain'];?></h4>
|
||||||
|
@ -353,7 +353,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="btn btn-default" id="edit_selected" data-id="domratelimit" data-item="<?=$alias_domain;?>" data-api-url='edit/domain-ratelimit' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
|
<button class="btn btn-default" id="edit_selected" data-id="domratelimit" data-item="<?=$alias_domain;?>" data-api-url='edit/ratelimit' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
@ -380,6 +380,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
elseif (isset($_GET['mailbox']) && filter_var($_GET["mailbox"], FILTER_VALIDATE_EMAIL) && !empty($_GET["mailbox"])) {
|
elseif (isset($_GET['mailbox']) && filter_var($_GET["mailbox"], FILTER_VALIDATE_EMAIL) && !empty($_GET["mailbox"])) {
|
||||||
$mailbox = $_GET["mailbox"];
|
$mailbox = $_GET["mailbox"];
|
||||||
$result = mailbox('get', 'mailbox_details', $mailbox);
|
$result = mailbox('get', 'mailbox_details', $mailbox);
|
||||||
|
$rl = mailbox('get', 'ratelimit', $mailbox);
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
?>
|
?>
|
||||||
<h4><?=$lang['edit']['mailbox'];?></h4>
|
<h4><?=$lang['edit']['mailbox'];?></h4>
|
||||||
|
@ -478,6 +479,23 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<hr>
|
||||||
|
<form data-id="mboxratelimit" class="form-inline well" method="post">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">Ratelimit</label>
|
||||||
|
<input name="rl_value" id="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" class="form-control" placeholder="disabled">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<select name="rl_frame" id="rl_frame" class="form-control">
|
||||||
|
<option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>
|
||||||
|
<option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>
|
||||||
|
<option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<button class="btn btn-default" id="edit_selected" data-id="mboxratelimit" data-item="<?=$mailbox;?>" data-api-url='edit/ratelimit' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1189,7 +1189,7 @@ function mailbox($_action, $_type, $_data = null) {
|
||||||
'msg' => sprintf($lang['success']['mailbox_modified'], implode(', ', $usernames))
|
'msg' => sprintf($lang['success']['mailbox_modified'], implode(', ', $usernames))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'domain_ratelimit':
|
case 'ratelimit':
|
||||||
$rl_value = intval($_data['rl_value']);
|
$rl_value = intval($_data['rl_value']);
|
||||||
$rl_frame = $_data['rl_frame'];
|
$rl_frame = $_data['rl_frame'];
|
||||||
if (!in_array($rl_frame, array('s', 'm', 'h'))) {
|
if (!in_array($rl_frame, array('s', 'm', 'h'))) {
|
||||||
|
@ -1199,24 +1199,38 @@ function mailbox($_action, $_type, $_data = null) {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!is_array($_data['domain'])) {
|
if (!is_array($_data['object'])) {
|
||||||
$domains = array();
|
$objects = array();
|
||||||
$domains[] = $_data['domain'];
|
$objects[] = $_data['object'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$domains = $_data['domain'];
|
$objects = $_data['object'];
|
||||||
}
|
}
|
||||||
foreach ($domains as $domain) {
|
foreach ($objects as $object) {
|
||||||
if (!is_valid_domain_name($domain) || !hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $domain)) {
|
if (is_valid_domain_name($object)) {
|
||||||
|
if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $object)) {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
'msg' => sprintf($lang['danger']['access_denied'])
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
elseif (filter_var($object, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
if (!hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $object)) {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (empty($rl_value)) {
|
if (empty($rl_value)) {
|
||||||
try {
|
try {
|
||||||
$redis->hDel('RL_VALUE', $domain);
|
$redis->hDel('RL_VALUE', $object);
|
||||||
}
|
}
|
||||||
catch (RedisException $e) {
|
catch (RedisException $e) {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
|
@ -1228,7 +1242,7 @@ function mailbox($_action, $_type, $_data = null) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
$redis->hSet('RL_VALUE', $domain, $rl_value . ' / 1' . $rl_frame);
|
$redis->hSet('RL_VALUE', $object, $rl_value . ' / 1' . $rl_frame);
|
||||||
}
|
}
|
||||||
catch (RedisException $e) {
|
catch (RedisException $e) {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
|
@ -1241,7 +1255,7 @@ function mailbox($_action, $_type, $_data = null) {
|
||||||
}
|
}
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
'type' => 'success',
|
'type' => 'success',
|
||||||
'msg' => sprintf($lang['success']['domain_modified'], implode(', ', $domains))
|
'msg' => sprintf($lang['success']['domain_modified'], implode(', ', $objects))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'syncjob':
|
case 'syncjob':
|
||||||
|
@ -2385,9 +2399,26 @@ function mailbox($_action, $_type, $_data = null) {
|
||||||
}
|
}
|
||||||
return $aliases;
|
return $aliases;
|
||||||
break;
|
break;
|
||||||
case 'domain_ratelimit':
|
case 'ratelimit':
|
||||||
$aliases = array();
|
if (is_valid_domain_name($_data)) {
|
||||||
if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $_data)) {
|
if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $_data)) {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (filter_var($_data, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
if (!hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $_data)) {
|
||||||
|
$_SESSION['return'] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'msg' => sprintf($lang['danger']['access_denied'])
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -3,7 +3,7 @@ function init_db_schema() {
|
||||||
try {
|
try {
|
||||||
global $pdo;
|
global $pdo;
|
||||||
|
|
||||||
$db_version = "31082017_0853";
|
$db_version = "12092017_2254";
|
||||||
|
|
||||||
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
||||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
@ -649,7 +649,7 @@ function init_db_schema() {
|
||||||
|
|
||||||
// Inject admin if not exists
|
// Inject admin if not exists
|
||||||
$stmt = $pdo->query("INSERT INTO `admin` (`username`, `password`, `superadmin`, `created`, `modified`, `active`)
|
$stmt = $pdo->query("INSERT INTO `admin` (`username`, `password`, `superadmin`, `created`, `modified`, `active`)
|
||||||
SELECT 'admin', '{SSHA256}K8eVJ6YsZbQCfuJvSUbaQRLr0HPLz5rC9IAp0PAFl0tmNDBkMDc0NDAyOTAxN2Rk', 1, NOW(), NOW(), 1
|
SELECT 'admin', '{SSHA256}K8eVJ6YsZbQCfuJvSUbaQRLr0HPLz5rC9IAp0PAFl0tmNDBkMDc0NDAyOTAxN2Rk', 1, NOW(), NOW(), 1 FROM `admin`
|
||||||
WHERE NOT EXISTS (SELECT * FROM `admin`);");
|
WHERE NOT EXISTS (SELECT * FROM `admin`);");
|
||||||
$stmt = $pdo->query("INSERT INTO `domain_admins` (`username`, `domain`, `created`, `active`)
|
$stmt = $pdo->query("INSERT INTO `domain_admins` (`username`, `domain`, `created`, `active`)
|
||||||
SELECT `username`, 'ALL', NOW(), 1 FROM `admin`
|
SELECT `username`, 'ALL', NOW(), 1 FROM `admin`
|
||||||
|
|
|
@ -2133,13 +2133,13 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "domain-ratelimit":
|
case "ratelimit":
|
||||||
if (isset($_POST['items']) && isset($_POST['attr'])) {
|
if (isset($_POST['items']) && isset($_POST['attr'])) {
|
||||||
$items = (array)json_decode($_POST['items'], true);
|
$items = (array)json_decode($_POST['items'], true);
|
||||||
$attr = (array)json_decode($_POST['attr'], true);
|
$attr = (array)json_decode($_POST['attr'], true);
|
||||||
$postarray = array_merge(array('domain' => $items), $attr);
|
$postarray = array_merge(array('object' => $items), $attr);
|
||||||
if (is_array($postarray['domain'])) {
|
if (is_array($postarray['object'])) {
|
||||||
if (mailbox('edit', 'domain_ratelimit', $postarray) === false) {
|
if (mailbox('edit', 'ratelimit', $postarray) === false) {
|
||||||
if (isset($_SESSION['return'])) {
|
if (isset($_SESSION['return'])) {
|
||||||
echo json_encode($_SESSION['return']);
|
echo json_encode($_SESSION['return']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@ services:
|
||||||
- unbound
|
- unbound
|
||||||
|
|
||||||
mysql-mailcow:
|
mysql-mailcow:
|
||||||
image: mariadb:10.1
|
image: mariadb:10.2
|
||||||
command: mysqld --max_allowed_packet=128M --max-connections=1500
|
command: mysqld --max_allowed_packet=192M --max-connections=1500 --innodb-strict-mode=0 --skip-host-cache --skip-name-resolve --log-warnings=0
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "--host", "localhost", "--silent"]
|
test: ["CMD", "mysqladmin", "-u$DBUSER", "-p$DBPASS", "ping", "-h", "localhost"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
|
@ -108,7 +108,7 @@ services:
|
||||||
- rspamd
|
- rspamd
|
||||||
|
|
||||||
php-fpm-mailcow:
|
php-fpm-mailcow:
|
||||||
image: mailcow/phpfpm:1.0
|
image: mailcow/phpfpm:1.1
|
||||||
build: ./data/Dockerfiles/phpfpm
|
build: ./data/Dockerfiles/phpfpm
|
||||||
command: "php-fpm -d date.timezone=${TZ}"
|
command: "php-fpm -d date.timezone=${TZ}"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -140,7 +140,7 @@ services:
|
||||||
- phpfpm
|
- phpfpm
|
||||||
|
|
||||||
sogo-mailcow:
|
sogo-mailcow:
|
||||||
image: mailcow/sogo:1.7
|
image: mailcow/sogo:1.8
|
||||||
build: ./data/Dockerfiles/sogo
|
build: ./data/Dockerfiles/sogo
|
||||||
depends_on:
|
depends_on:
|
||||||
unbound-mailcow:
|
unbound-mailcow:
|
||||||
|
|
|
@ -74,7 +74,7 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Are you sure you want to update mailcow: dockerized? All containers will be stopped. [y/N] " response
|
read -r -p "Are you sure you want to update mailcow: dockerized? [y/N] " response
|
||||||
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
||||||
echo "OK, exiting."
|
echo "OK, exiting."
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -92,6 +92,7 @@ git commit -am "Before update on ${DATE}" > /dev/null
|
||||||
echo -e "\e[32mFetching updated code from remote...\e[0m"
|
echo -e "\e[32mFetching updated code from remote...\e[0m"
|
||||||
git fetch origin ${BRANCH}
|
git fetch origin ${BRANCH}
|
||||||
echo -e "\e[32mMerging local with remote code (recursive, options: \"theirs\", \"patience\"...\e[0m"
|
echo -e "\e[32mMerging local with remote code (recursive, options: \"theirs\", \"patience\"...\e[0m"
|
||||||
|
git config merge.defaultToUpstream true
|
||||||
git merge -Xtheirs -Xpatience -m "After update on ${DATE}"
|
git merge -Xtheirs -Xpatience -m "After update on ${DATE}"
|
||||||
# Need to use a variable to not pass return codes of if checks
|
# Need to use a variable to not pass return codes of if checks
|
||||||
MERGE_RETURN=$?
|
MERGE_RETURN=$?
|
||||||
|
|
Loading…
Reference in New Issue