mirror of
https://github.com/chatmail/relay.git
synced 2026-05-18 14:08:57 +00:00
Compare commits
3 Commits
quota_expi
...
j4n/initen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd542ada40 | ||
|
|
df4ff92133 | ||
|
|
825831ee81 |
@@ -150,18 +150,40 @@ class UnboundDeployer(Deployer):
|
|||||||
self.need_restart = False
|
self.need_restart = False
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
# Run local DNS resolver `unbound`. `resolvconf` takes care of
|
|
||||||
# setting up /etc/resolv.conf to use 127.0.0.1 as the resolver.
|
|
||||||
|
|
||||||
# On an IPv4-only system, if unbound is started but not configured,
|
# On an IPv4-only system, if unbound is started but not configured,
|
||||||
# it causes subsequent steps to fail to resolve hosts.
|
# it causes subsequent steps to fail to resolve hosts.
|
||||||
with blocked_service_startup():
|
with blocked_service_startup():
|
||||||
apt.packages(
|
apt.packages(
|
||||||
name="Install unbound",
|
name="Install unbound",
|
||||||
packages=["unbound", "unbound-anchor", "dnsutils", "resolvconf"],
|
packages=["unbound", "unbound-anchor", "dnsutils"],
|
||||||
)
|
)
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
|
# Remove dynamic resolver managers that compete for /etc/resolv.conf.
|
||||||
|
apt.packages(
|
||||||
|
name="Purge resolvconf",
|
||||||
|
packages=["resolvconf"],
|
||||||
|
present=False,
|
||||||
|
extra_uninstall_args="--purge",
|
||||||
|
)
|
||||||
|
# systemd-resolved can't be purged due to dependencies; stop and mask.
|
||||||
|
server.shell(
|
||||||
|
name="Stop and mask systemd-resolved",
|
||||||
|
commands=[
|
||||||
|
"systemctl stop systemd-resolved.service || true",
|
||||||
|
"systemctl mask systemd-resolved.service",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
# Configure unbound resolver with Quad9 fallback and a trailing newline
|
||||||
|
# (SolusVM bug).
|
||||||
|
files.put(
|
||||||
|
name="Write static resolv.conf",
|
||||||
|
src=BytesIO(b"nameserver 127.0.0.1\nnameserver 9.9.9.9\n"),
|
||||||
|
dest="/etc/resolv.conf",
|
||||||
|
user="root",
|
||||||
|
group="root",
|
||||||
|
mode="644",
|
||||||
|
)
|
||||||
server.shell(
|
server.shell(
|
||||||
name="Generate root keys for validating DNSSEC",
|
name="Generate root keys for validating DNSSEC",
|
||||||
commands=[
|
commands=[
|
||||||
@@ -568,14 +590,6 @@ def deploy_chatmail(config_path: Path, disable_mail: bool, website_only: bool) -
|
|||||||
Deployment().perform_stages([WebsiteDeployer(config)])
|
Deployment().perform_stages([WebsiteDeployer(config)])
|
||||||
return
|
return
|
||||||
|
|
||||||
if host.get_fact(Port, port=53) != "unbound":
|
|
||||||
files.line(
|
|
||||||
name="Add 9.9.9.9 to resolv.conf",
|
|
||||||
path="/etc/resolv.conf",
|
|
||||||
# Guard against resolv.conf missing a trailing newline (SolusVM bug).
|
|
||||||
line="\nnameserver 9.9.9.9",
|
|
||||||
)
|
|
||||||
|
|
||||||
# Check if mtail_address interface is available (if configured)
|
# Check if mtail_address interface is available (if configured)
|
||||||
if config.mtail_address and config.mtail_address not in ('127.0.0.1', '::1', 'localhost'):
|
if config.mtail_address and config.mtail_address not in ('127.0.0.1', '::1', 'localhost'):
|
||||||
ipv4_addrs = host.get_fact(hardware.Ipv4Addrs)
|
ipv4_addrs = host.get_fact(hardware.Ipv4Addrs)
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ def _configure_dovecot(config: Config, debug: bool = False) -> tuple[bool, bool]
|
|||||||
can_modify = not is_in_container()
|
can_modify = not is_in_container()
|
||||||
for name in ("max_user_instances", "max_user_watches"):
|
for name in ("max_user_instances", "max_user_watches"):
|
||||||
key = f"fs.inotify.{name}"
|
key = f"fs.inotify.{name}"
|
||||||
value = host.get_fact(Sysctl)[key]
|
value = host.get_fact(Sysctl).get(key, 0)
|
||||||
if value > 65534:
|
if value > 65534:
|
||||||
continue
|
continue
|
||||||
if not can_modify:
|
if not can_modify:
|
||||||
|
|||||||
@@ -18,8 +18,15 @@ if command -v lsb_release 2>&1 >/dev/null; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python3 -m venv --upgrade-deps venv
|
if command -v uv >/dev/null 2>&1; then
|
||||||
|
echo "Using uv for faster environment setup..."
|
||||||
venv/bin/pip install -e chatmaild
|
uv venv venv
|
||||||
venv/bin/pip install -e cmdeploy
|
uv pip install --python venv/bin/python -e chatmaild
|
||||||
venv/bin/pip install sphinx sphinxcontrib-mermaid sphinx-autobuild furo # for building the docs
|
uv pip install --python venv/bin/python -e cmdeploy
|
||||||
|
uv pip install --python venv/bin/python sphinx sphinxcontrib-mermaid sphinx-autobuild furo
|
||||||
|
else
|
||||||
|
python3 -m venv --upgrade-deps venv
|
||||||
|
venv/bin/pip install -e chatmaild
|
||||||
|
venv/bin/pip install -e cmdeploy
|
||||||
|
venv/bin/pip install sphinx sphinxcontrib-mermaid sphinx-autobuild furo
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user