
| Current Path : /proc/thread-self/root/usr/local/lib/python2.7/site-packages/iftlib/mailsystem/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //proc/thread-self/root/usr/local/lib/python2.7/site-packages/iftlib/mailsystem/restart_postfix.py |
import re,sys,os
uid=""
gid=""
for zeile in open("/etc/passwd").read().split("\n"):
m = re.search(r"^(.*?)\:(.*?)\:(.*?)\:(.*?)\:",zeile)
if m:
uid = uid + "/\\/" + m.group(1) + "\\//" + " " + m.group(3) + "\n"
gid = gid + "/\\/" + m.group(1) + "\\//" + " " + m.group(4) + "\n"
# uid = uid + "/" + m.group(1) + "/" + " " + m.group(3) + "\n"
# gid = gid + "/" + m.group(1) + "/" + " " + m.group(4) + "\n"
open("/etc/postfix/uid","w").write(uid)
open("/etc/postfix/gid","w").write(gid)
# for opendkim:
trustedhosts = '''
localhost
127.0.0.1
85.214.96.57
ift-intern.de
'''
keytable = ""
signingtable = ""
for zeile in open("vdomains".read():
m = re.search(r"^ *(\S+) +OK",zeile)
if not m:
continue
domain = m.group(1)
trustedhosts = trustedhosts + domain + "\n"
keytable = keytable + "default._domainkey." + (domain + " "*30)[0:30] + " " + domain + ":default:/etc/opendkim/keys/" + domain + "\n"
signingtable = signingtable + (domain + " "*30)[0:30] + " default._domainkey." + domain
open("/etc/opendkim/TrustedHosts","w").write(trustedhosts)
open("/etc/opendkim/KeyTable" ,"w").write(keytable)
open("/etc/opendkim/SigningTable","w").write(signingtable)
os.system("/etc/init.d/opendkim restart")
os.system("/etc/init.d/saslauthd restart")
os.system("/etc/init.d/postfix restart")
os.system("/etc/init.d/amavis restart")
os.system("/etc/init.d/clamav-daemon restart")
os.system("/etc/init.d/spamassassin restart")
os.system("/etc/init.d/dovecot restart")