mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-26 03:52:50 +02:00
postfix: wrap IPv6 CIDRs in square brackets for RELAYNETS
The RELAYNETS environment variable is used for configuring both postfix `mynetworks` and rspamd `local_networks`. Postfix requires IPv6 addresses to be wrapped in square brackets (eg. [2001:db8::]/64).
This commit is contained in:
parent
9743639693
commit
d495052b52
@ -6,6 +6,7 @@ import shutil
|
|||||||
import multiprocessing
|
import multiprocessing
|
||||||
import logging as log
|
import logging as log
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
from podop import run_server
|
from podop import run_server
|
||||||
from pwd import getpwnam
|
from pwd import getpwnam
|
||||||
@ -50,6 +51,10 @@ os.environ["LMTP_ADDRESS"] = system.get_host_address_from_environment("LMTP", "i
|
|||||||
os.environ["POSTFIX_LOG_SYSLOG"] = os.environ.get("POSTFIX_LOG_SYSLOG","local")
|
os.environ["POSTFIX_LOG_SYSLOG"] = os.environ.get("POSTFIX_LOG_SYSLOG","local")
|
||||||
os.environ["POSTFIX_LOG_FILE"] = os.environ.get("POSTFIX_LOG_FILE", "")
|
os.environ["POSTFIX_LOG_FILE"] = os.environ.get("POSTFIX_LOG_FILE", "")
|
||||||
|
|
||||||
|
# Postfix requires IPv6 addresses to be wrapped in square brackets
|
||||||
|
if 'RELAYNETS' in os.environ:
|
||||||
|
os.environ["RELAYNETS"] = re.sub(r'([0-9a-fA-F]+:[0-9a-fA-F:]+)/', '[\\1]/', os.environ["RELAYNETS"])
|
||||||
|
|
||||||
for postfix_file in glob.glob("/conf/*.cf"):
|
for postfix_file in glob.glob("/conf/*.cf"):
|
||||||
conf.jinja(postfix_file, os.environ, os.path.join("/etc/postfix", os.path.basename(postfix_file)))
|
conf.jinja(postfix_file, os.environ, os.path.join("/etc/postfix", os.path.basename(postfix_file)))
|
||||||
|
|
||||||
|
1
towncrier/newsfragments/2325.bugfix
Normal file
1
towncrier/newsfragments/2325.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
postfix: wrap IPv6 CIDRs in square brackets for RELAYNETS
|
Loading…
x
Reference in New Issue
Block a user