2018-10-31 19:17:23 +02:00
|
|
|
#!/usr/bin/python3
|
2017-11-10 15:48:13 +02:00
|
|
|
|
|
|
|
import os
|
|
|
|
import glob
|
2019-01-07 23:49:10 +02:00
|
|
|
import logging as log
|
|
|
|
import sys
|
2019-07-25 10:33:57 +02:00
|
|
|
from socrate import system, conf
|
2017-11-10 15:48:13 +02:00
|
|
|
|
2019-01-08 05:16:05 +02:00
|
|
|
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
|
2019-01-07 23:49:10 +02:00
|
|
|
|
|
|
|
# Actual startup script
|
2019-05-07 11:42:08 +02:00
|
|
|
|
2019-08-23 08:43:59 +02:00
|
|
|
os.environ["REDIS_ADDRESS"] = system.get_host_address_from_environment("REDIS", "redis")
|
2018-10-22 16:02:43 +02:00
|
|
|
|
2019-08-22 12:08:43 +02:00
|
|
|
if os.environ.get("ANTIVIRUS") == 'clamav':
|
2019-08-23 08:43:59 +02:00
|
|
|
os.environ["ANTIVIRUS_ADDRESS"] = system.get_host_address_from_environment("ANTIVIRUS", "antivirus:3310")
|
2017-11-10 15:48:13 +02:00
|
|
|
|
|
|
|
for rspamd_file in glob.glob("/conf/*"):
|
2019-07-25 10:33:57 +02:00
|
|
|
conf.jinja(rspamd_file, os.environ, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))
|
2017-11-10 15:48:13 +02:00
|
|
|
|
|
|
|
# Run rspamd
|
|
|
|
os.execv("/usr/sbin/rspamd", ["rspamd", "-i", "-f"])
|