49 lines
1.4 KiB
Python
Executable File
49 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# This program is free software, licensed under the terms of the GNU GPL.
|
|
# See the Bongo COPYING file for full details.
|
|
# Copyright (c) 2026 Bongo Project contributors
|
|
|
|
"""Install a disposable configuration for protocol/sanitizer sessions."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from bongo.configuration.model import Scenario, apply_scenario
|
|
from bongo.configuration.storage import ConfigurationStore
|
|
|
|
|
|
def value(name: str, default: str) -> str:
|
|
return os.environ.get(name, default)
|
|
|
|
|
|
password = os.environ["BONGO_TEST_PASSWORD"]
|
|
hostname = value("BONGO_TEST_HOSTNAME", "sanitizer.bongo.test")
|
|
domain = value("BONGO_TEST_DOMAIN", "bongo.test")
|
|
address = value("BONGO_TEST_BIND_ADDRESS", "127.0.0.1")
|
|
store = ConfigurationStore()
|
|
scenario = Scenario(
|
|
hostname=hostname,
|
|
bind_address=address,
|
|
domains=[domain],
|
|
admin_password=password,
|
|
tls_hostnames=[hostname],
|
|
web_mode="direct",
|
|
web_public_url=value("BONGO_TEST_WEB_URL", "http://127.0.0.1:8080"),
|
|
submission_enabled=True,
|
|
imap_enabled=True,
|
|
pop3_enabled=True,
|
|
sieve_enabled=True,
|
|
antispam_enabled=False,
|
|
antivirus_enabled=False,
|
|
)
|
|
configurations = apply_scenario(store.templates, scenario)
|
|
store.install(
|
|
configurations,
|
|
scenario.hostname,
|
|
scenario.bind_address,
|
|
scenario.domains,
|
|
scenario.admin_password,
|
|
scenario.tls_hostnames,
|
|
)
|