mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-04-04 20:58:51 +00:00
Compare commits
4 Commits
2025-12a
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d371293e0 | ||
|
|
215a8addff | ||
|
|
8f58ba8bc8 | ||
|
|
70affa0f69 |
@@ -139,9 +139,13 @@ docker_daemon_edit(){
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}User declined Docker update – please insert these changes manually:${NC}"
|
echo -e "${YELLOW}User declined Docker update – skipping Docker daemon configuration.${NC}"
|
||||||
|
echo -e "${YELLOW}IPv6 will be disabled for mailcow.${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${YELLOW}If you change your mind later, please insert these changes manually to $DOCKER_DAEMON_CONFIG:${NC}"
|
||||||
echo "${MISSING[*]}"
|
echo "${MISSING[*]}"
|
||||||
exit 1
|
echo ""
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -185,9 +189,23 @@ EOF
|
|||||||
(command -v systemctl &>/dev/null && systemctl restart docker) || service docker restart
|
(command -v systemctl &>/dev/null && systemctl restart docker) || service docker restart
|
||||||
echo "Docker restarted."
|
echo "Docker restarted."
|
||||||
else
|
else
|
||||||
echo "User declined to create daemon.json – please manually merge the docker daemon with these configs:"
|
echo -e "${YELLOW}User declined to create daemon.json – skipping Docker daemon configuration.${NC}"
|
||||||
echo "${MISSING[*]}"
|
echo -e "${YELLOW}IPv6 will be disabled for mailcow.${NC}"
|
||||||
exit 1
|
echo ""
|
||||||
|
echo -e "${YELLOW}If you change your mind later, please create $DOCKER_DAEMON_CONFIG with these settings:${NC}"
|
||||||
|
if [[ -n "$DOCKER_MAJOR" && "$DOCKER_MAJOR" -lt 27 ]]; then
|
||||||
|
echo ' "ipv6": true,'
|
||||||
|
echo ' "fixed-cidr-v6": "fd00:dead:beef:c0::/80",'
|
||||||
|
echo ' "ip6tables": true,'
|
||||||
|
echo ' "experimental": true'
|
||||||
|
elif [[ -n "$DOCKER_MAJOR" && "$DOCKER_MAJOR" -lt 28 ]]; then
|
||||||
|
echo ' "ipv6": true,'
|
||||||
|
echo ' "fixed-cidr-v6": "fd00:dead:beef:c0::/80"'
|
||||||
|
else
|
||||||
|
echo ' "ipv6": true'
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -223,7 +241,22 @@ configure_ipv6() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker_daemon_edit
|
if ! docker_daemon_edit; then
|
||||||
|
# User declined Docker daemon configuration
|
||||||
|
# When called from update.sh, MAILCOW_CONF is set and we modify the existing file
|
||||||
|
# When called from generate_config.sh, MAILCOW_CONF is not set and we export IPV6_BOOL
|
||||||
|
if [[ -n "$MAILCOW_CONF" && -f "$MAILCOW_CONF" ]]; then
|
||||||
|
if grep -q '^ENABLE_IPV6=' "$MAILCOW_CONF"; then
|
||||||
|
sed -i 's/^ENABLE_IPV6=.*/ENABLE_IPV6=false/' "$MAILCOW_CONF"
|
||||||
|
else
|
||||||
|
echo "ENABLE_IPV6=false" >> "$MAILCOW_CONF"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
export IPV6_BOOL=false
|
||||||
|
fi
|
||||||
|
echo "IPv6 configuration complete: ENABLE_IPV6=false"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "$MAILCOW_CONF" && -f "$MAILCOW_CONF" ]]; then
|
if [[ -n "$MAILCOW_CONF" && -f "$MAILCOW_CONF" ]]; then
|
||||||
if grep -q '^ENABLE_IPV6=' "$MAILCOW_CONF"; then
|
if grep -q '^ENABLE_IPV6=' "$MAILCOW_CONF"; then
|
||||||
|
|||||||
@@ -814,32 +814,6 @@ function verify_hash($hash, $password) {
|
|||||||
$hash = $components[4];
|
$hash = $components[4];
|
||||||
return hash_equals(hash_pbkdf2('sha1', $password, $salt, $rounds), $hash);
|
return hash_equals(hash_pbkdf2('sha1', $password, $salt, $rounds), $hash);
|
||||||
|
|
||||||
case "PBKDF2-SHA512":
|
|
||||||
// Handle FreeIPA-style hash: {PBKDF2-SHA512}10000$<base64_salt>$<base64_hash>
|
|
||||||
$components = explode('$', $hash);
|
|
||||||
if (count($components) !== 3) return false;
|
|
||||||
|
|
||||||
// 1st part: iteration count (integer)
|
|
||||||
$iterations = intval($components[0]);
|
|
||||||
if ($iterations <= 0) return false;
|
|
||||||
|
|
||||||
// 2nd part: salt (base64-encoded)
|
|
||||||
$salt = $components[1];
|
|
||||||
// 3rd part: hash (base64-encoded)
|
|
||||||
$stored_hash_b64 = $components[2];
|
|
||||||
|
|
||||||
// Decode salt and hash from base64
|
|
||||||
$salt_bin = base64_decode($salt, true);
|
|
||||||
$hash_bin = base64_decode($stored_hash_b64, true);
|
|
||||||
if ($salt_bin === false || $hash_bin === false) return false;
|
|
||||||
// Get length of hash in bytes
|
|
||||||
$hash_len = strlen($hash_bin);
|
|
||||||
if ($hash_len === 0) return false;
|
|
||||||
|
|
||||||
// Calculate PBKDF2-SHA512 hash for provided password
|
|
||||||
$test_hash = hash_pbkdf2('sha512', $password, $salt_bin, $iterations, $hash_len, true);
|
|
||||||
return hash_equals($hash_bin, $test_hash);
|
|
||||||
|
|
||||||
case "PLAIN-MD4":
|
case "PLAIN-MD4":
|
||||||
return hash_equals(hash('md4', $password), $hash);
|
return hash_equals(hash('md4', $password), $hash);
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
<form action="/" method="post" id="logout"><input type="hidden" name="logout"></form>
|
<form action="/" method="post" id="logout"><input type="hidden" name="logout"></form>
|
||||||
|
|
||||||
{% if ui_texts.ui_announcement_text and ui_texts.ui_announcement_active and not is_root_uri and mailcow_cc_username %}
|
{% if ui_texts.ui_announcement_text and ui_texts.ui_announcement_active and not is_root_uri %}
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<div class="alert alert-{{ ui_texts.ui_announcement_type }}">{{ ui_texts.ui_announcement_text }}</div>
|
<div class="alert alert-{{ ui_texts.ui_announcement_type }}">{{ ui_texts.ui_announcement_text }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ services:
|
|||||||
ofelia.job-exec.dovecot_clean_q_aged.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu vmail /usr/local/bin/clean_q_aged.sh || exit 0\""
|
ofelia.job-exec.dovecot_clean_q_aged.command: "/bin/bash -c \"[[ $${MASTER} == y ]] && /usr/local/bin/gosu vmail /usr/local/bin/clean_q_aged.sh || exit 0\""
|
||||||
ofelia.job-exec.dovecot_maildir_gc.schedule: "0 */30 * * * *"
|
ofelia.job-exec.dovecot_maildir_gc.schedule: "0 */30 * * * *"
|
||||||
ofelia.job-exec.dovecot_maildir_gc.command: "/bin/bash -c \"source /source_env.sh ; /usr/local/bin/gosu vmail /usr/local/bin/maildir_gc.sh\""
|
ofelia.job-exec.dovecot_maildir_gc.command: "/bin/bash -c \"source /source_env.sh ; /usr/local/bin/gosu vmail /usr/local/bin/maildir_gc.sh\""
|
||||||
ofelia.job-exec.dovecot_sarules.schedule: "@every 24h"
|
ofelia.job-exec.dovecot_sarules.schedule: "0 0 0 * * *"
|
||||||
ofelia.job-exec.dovecot_sarules.command: "/bin/bash -c \"/usr/local/bin/sa-rules.sh\""
|
ofelia.job-exec.dovecot_sarules.command: "/bin/bash -c \"/usr/local/bin/sa-rules.sh\""
|
||||||
ofelia.job-exec.dovecot_fts.schedule: "0 0 0 * * *"
|
ofelia.job-exec.dovecot_fts.schedule: "0 0 0 * * *"
|
||||||
ofelia.job-exec.dovecot_fts.command: "/bin/bash -c \"/usr/local/bin/gosu vmail /usr/local/bin/optimize-fts.sh\""
|
ofelia.job-exec.dovecot_fts.command: "/bin/bash -c \"/usr/local/bin/gosu vmail /usr/local/bin/optimize-fts.sh\""
|
||||||
|
|||||||
@@ -91,44 +91,6 @@ if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add image prefetch function
|
|
||||||
function prefetch_image() {
|
|
||||||
echo "Checking Docker image: ${DEBIAN_DOCKER_IMAGE}"
|
|
||||||
|
|
||||||
# Get local image digest if it exists
|
|
||||||
local local_digest=$(docker image inspect ${DEBIAN_DOCKER_IMAGE} --format='{{index .RepoDigests 0}}' 2>/dev/null | cut -d'@' -f2)
|
|
||||||
|
|
||||||
# Get remote image digest without pulling
|
|
||||||
local remote_digest=$(docker manifest inspect ${DEBIAN_DOCKER_IMAGE} 2>/dev/null | grep -oP '"digest":\s*"\K[^"]+' | head -1)
|
|
||||||
|
|
||||||
if [[ -z "${remote_digest}" ]]; then
|
|
||||||
echo "Warning: Unable to check remote image"
|
|
||||||
if [[ -n "${local_digest}" ]]; then
|
|
||||||
echo "Using cached version"
|
|
||||||
echo
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "Error: Image ${DEBIAN_DOCKER_IMAGE} not found locally or remotely"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${local_digest}" != "${remote_digest}" ]]; then
|
|
||||||
echo "Image update available, pulling ${DEBIAN_DOCKER_IMAGE}"
|
|
||||||
if docker pull ${DEBIAN_DOCKER_IMAGE} 2>/dev/null; then
|
|
||||||
echo "Successfully pulled ${DEBIAN_DOCKER_IMAGE}"
|
|
||||||
else
|
|
||||||
echo "Error: Failed to pull ${DEBIAN_DOCKER_IMAGE}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Image is up to date (${remote_digest:0:12}...)"
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prefetch the image early in the script
|
|
||||||
prefetch_image
|
|
||||||
|
|
||||||
function backup() {
|
function backup() {
|
||||||
DATE=$(date +"%Y-%m-%d-%H-%M-%S")
|
DATE=$(date +"%Y-%m-%d-%H-%M-%S")
|
||||||
|
|||||||
Reference in New Issue
Block a user