A bunch of Ubuntu specific changes for DKIM and lscpd

This commit is contained in:
rperper
2018-11-13 10:04:16 -05:00
parent 18c47de0e5
commit 776b74f6f9

View File

@@ -1904,7 +1904,7 @@ class preFlightsChecks:
while(1): while(1):
command = 'systemctl start postfix.service' command = 'systemctl start postfix.service'
cmd = shlex.split(command) cmd = shlex.split(command)
@@ -2380,7 +2380,31 @@ class preFlightsChecks:
os.chdir(self.cwd) os.chdir(self.cwd)
shutil.copy("lscpd/lscpd.service","/etc/systemd/system/lscpd.service") if self.distro == ubuntu:
fd = open('/etc/systemd/system/lscpd.service','w')
fd.write('[Unit]\n')
fd.write('Description = LSCPD Daemon\n')
fd.write('After=network.target remote-fs.target nss-lookup.target\n')
fd.write('\n')
fd.write('[Service]\n')
fd.write('Type=forking\n')
fd.write('ExecStart = /usr/local/lscp/bin/lscpdctrl start\n')
fd.write('ExecStop = /usr/local/lscp/bin/lscpdctrl stop\n')
fd.write('#ExecReload = /usr/local/lscp/bin/lscpdctrl restart\n')
fd.write('\n')
fd.write('KillMode=none\n')
fd.write('PrivateTmp=false\n')
fd.write('\n')
fd.write('# Do not want to be limited in any way\n')
fd.write('CPUAccounting=false\n')
fd.write('TasksAccounting=false\n')
fd.write('MemoryAccounting=false\n')
fd.write('\n')
fd.write('[Install]\n')
fd.write('WantedBy=default.target\n')
fd.close()
else:
shutil.copy("lscpd/lscpd.service","/etc/systemd/system/lscpd.service")
shutil.copy("lscpd/lscpdctrl","/usr/local/lscp/bin/lscpdctrl") shutil.copy("lscpd/lscpdctrl","/usr/local/lscp/bin/lscpdctrl")
## ##
@@ -2408,7 +2432,6 @@ class preFlightsChecks:
count = 1 count = 1
while(1): while(1):
command = 'systemctl enable lscpd.service' command = 'systemctl enable lscpd.service'
cmd = shlex.split(command) cmd = shlex.split(command)
res = subprocess.call(cmd) res = subprocess.call(cmd)
@@ -2885,10 +2908,6 @@ class preFlightsChecks:
command = 'mkdir -p /etc/opendkim/keys/' command = 'mkdir -p /etc/opendkim/keys/'
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
command = "sed -i 's/Socket local:/var/run/opendkim/opendkim.sock/Socket inet:8891@localhost/g' /etc/opendkim.conf"
subprocess.call(shlex.split(command))
except OSError, msg: except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [installOpenDKIM]") logging.InstallLog.writeToFile(str(msg) + " [installOpenDKIM]")
return 0 return 0
@@ -2916,6 +2935,8 @@ InternalHosts refile:/etc/opendkim/TrustedHosts
writeToFile = open(openDKIMConfigurePath,'a') writeToFile = open(openDKIMConfigurePath,'a')
writeToFile.write(configData) writeToFile.write(configData)
if self.distro == ubuntu:
writeToFile.write('Socket inet:8891@127.0.0.1\n')
writeToFile.close() writeToFile.close()
@@ -2933,6 +2954,17 @@ milter_default_action = accept
writeToFile.write(configData) writeToFile.write(configData)
writeToFile.close() writeToFile.close()
if self.distro == ubuntu:
writeToFile = open('/etc/default/opendkim','r')
lines = writeToFile.readlines()
writeToFile.close()
writeToFile = open('/etc/default/opendkim','w')
for line in lines:
if line[:6] == "SOCKET":
line = '#' + line
writeToFile.write(line)
writeToFile.write('SOCKET="inet:8891@127.0.0.1"\n')
writeToFile.close()
#### Restarting Postfix and OpenDKIM #### Restarting Postfix and OpenDKIM
@@ -2947,8 +2979,6 @@ milter_default_action = accept
command = "systemctl start postfix" command = "systemctl start postfix"
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
except OSError, msg: except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [configureOpenDKIM]") logging.InstallLog.writeToFile(str(msg) + " [configureOpenDKIM]")
return 0 return 0