|
|
@ -3,7 +3,9 @@
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import glob
|
|
|
|
import glob
|
|
|
|
import logging as log
|
|
|
|
import logging as log
|
|
|
|
|
|
|
|
import requests
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import time
|
|
|
|
from socrate import system, conf
|
|
|
|
from socrate import system, conf
|
|
|
|
|
|
|
|
|
|
|
|
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
|
|
|
|
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
|
|
|
@ -19,5 +21,16 @@ if os.environ.get("ANTIVIRUS") == 'clamav':
|
|
|
|
for rspamd_file in glob.glob("/conf/*"):
|
|
|
|
for rspamd_file in glob.glob("/conf/*"):
|
|
|
|
conf.jinja(rspamd_file, os.environ, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))
|
|
|
|
conf.jinja(rspamd_file, os.environ, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Admin may not be up just yet
|
|
|
|
|
|
|
|
healthcheck = f'http://{os.environ["ADMIN_ADDRESS"]}/internal/rspamd/local_domains'
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if requests.get(healthcheck,timeout=2).ok:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
print("Admin is not up just yet, retrying in 1 second")
|
|
|
|
|
|
|
|
|
|
|
|
# Run rspamd
|
|
|
|
# Run rspamd
|
|
|
|
os.execv("/usr/sbin/rspamd", ["rspamd", "-i", "-f"])
|
|
|
|
os.execv("/usr/sbin/rspamd", ["rspamd", "-i", "-f"])
|
|
|
|