mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-18 21:42:06 +01:00
bug fix rspamd + dkim https://github.com/usmannasir/cyberpanel/issues/1176
This commit is contained in:
@@ -1450,15 +1450,12 @@ def fetchRspamdSettings(request):
|
||||
postdata = ProcessUtilities.outputExecutioner(command).splitlines()
|
||||
for i in postdata:
|
||||
if i.find('smtpd_milters=') > -1 and i.find('non_smtpd_milters') < 0:
|
||||
tempData = i.split(' ')
|
||||
x = tempData[0]
|
||||
y = x.split('=')
|
||||
smtpd_milters = y[1]
|
||||
### non_smtpd_milters = inet:127.0.0.1:8891, inet:127.0.0.1:11332
|
||||
tempData = i.split(',')
|
||||
smtpd_milters = tempData[1].lstrip(' ')
|
||||
if i.find('non_smtpd_milters=') > -1:
|
||||
tempData = i.split(' ')
|
||||
x = tempData[0]
|
||||
y = x.split('=')
|
||||
non_smtpd_milters = y[1]
|
||||
tempData = i.split('=')
|
||||
non_smtpd_milters = tempData[1].lstrip(' ')
|
||||
|
||||
###Redis
|
||||
Redispath = "/etc/rspamd/local.d/redis.conf"
|
||||
|
||||
@@ -716,8 +716,6 @@ clamav {
|
||||
WriteToFile.close()
|
||||
|
||||
|
||||
|
||||
|
||||
appendpath = "/etc/postfix/main.cf"
|
||||
|
||||
lines = open(appendpath, 'r').readlines()
|
||||
@@ -728,6 +726,7 @@ clamav {
|
||||
if line.find('inet:127.0.0.1:8891') > -1:
|
||||
cLine = line
|
||||
content = f'{cLine}, inet:127.0.0.1:11332\n'
|
||||
WriteToFile.write('### Please do not edit this line, editing this line could break configurations\n')
|
||||
WriteToFile.write(content)
|
||||
elif line.find('non_smtpd_milters') > -1:
|
||||
WriteToFile.write('non_smtpd_milters = $smtpd_milters\n')
|
||||
@@ -1030,11 +1029,11 @@ LogFile /var/log/clamav/clamav.log
|
||||
writeDataToFile = open(postfixpath, "w")
|
||||
for i in data:
|
||||
if i.find('smtpd_milters=') > -1 and i.find('non_smtpd_milters') < 0:
|
||||
newitem = 'smtpd_milters=%s' % smtpd_milters
|
||||
newitem = f'non_smtpd_milters = inet:127.0.0.1:8891, {smtpd_milters}\n'
|
||||
writeDataToFile.writelines(newitem + '\n')
|
||||
elif i.find('non_smtpd_milters=') > -1:
|
||||
newitem = 'non_smtpd_milters=%s' % non_smtpd_milters
|
||||
writeDataToFile.writelines(newitem + '\n')
|
||||
#newitem = 'non_smtpd_milters=%s' % non_smtpd_milters
|
||||
writeDataToFile.writelines('non_smtpd_milters = $smtpd_milters\n')
|
||||
else:
|
||||
writeDataToFile.writelines(i + '\n')
|
||||
|
||||
|
||||
@@ -2250,6 +2250,55 @@ CREATE TABLE `websiteFunctions_backupsv2` (`id` integer AUTO_INCREMENT NOT NULL
|
||||
except BaseException as msg:
|
||||
Upgrade.stdOut(str(msg) + " [installLSCPD]")
|
||||
|
||||
### disable dkim signing in rspamd in ref to https://github.com/usmannasir/cyberpanel/issues/1176
|
||||
@staticmethod
|
||||
def FixRSPAMDConfig():
|
||||
RSPAMDConf = '/etc/rspamd'
|
||||
postfixConf = '/etc/postfix/main.cf'
|
||||
|
||||
if os.path.exists(RSPAMDConf):
|
||||
DKIMPath = '/etc/rspamd/local.d/dkim_signing.conf'
|
||||
|
||||
WriteToFile = open(DKIMPath, 'w')
|
||||
WriteToFile.write('enabled = false;\n')
|
||||
WriteToFile.close()
|
||||
|
||||
|
||||
if os.path.exists(postfixConf):
|
||||
appendpath = "/etc/postfix/main.cf"
|
||||
|
||||
lines = open(appendpath, 'r').readlines()
|
||||
|
||||
WriteToFile = open(appendpath, 'w')
|
||||
|
||||
for line in lines:
|
||||
|
||||
if line.find('smtpd_milters') > -1:
|
||||
continue
|
||||
elif line.find('non_smtpd_milters') > -1:
|
||||
continue
|
||||
elif line.find('milter_default_action') > -1:
|
||||
continue
|
||||
else:
|
||||
WriteToFile.write(line)
|
||||
|
||||
|
||||
RSPAMDConfContent = '''
|
||||
### Please do not edit this line, editing this line could break configurations
|
||||
smtpd_milters = inet:127.0.0.1:8891, inet:127.0.0.1:11332
|
||||
non_smtpd_milters = $smtpd_milters
|
||||
milter_default_action = accept
|
||||
'''
|
||||
WriteToFile.write(RSPAMDConfContent)
|
||||
|
||||
WriteToFile.close()
|
||||
|
||||
command = 'systemctl restart postfix && systemctl restart rspamd'
|
||||
Upgrade.executioner(command, 'postfix and rspamd restart', 0, True)
|
||||
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def fixPermissions():
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user