mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-13 08:46:09 +01:00
DKIM Support.
This commit is contained in:
38
install/FileManager/.idea/workspace.xml
generated
38
install/FileManager/.idea/workspace.xml
generated
@@ -112,6 +112,7 @@
|
|||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
<pane id="Scratches" />
|
<pane id="Scratches" />
|
||||||
|
<pane id="Scope" />
|
||||||
<pane id="ProjectPane">
|
<pane id="ProjectPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
<expand>
|
<expand>
|
||||||
@@ -128,7 +129,6 @@
|
|||||||
<select />
|
<select />
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<pane id="Scope" />
|
|
||||||
</panes>
|
</panes>
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
@@ -166,11 +166,12 @@
|
|||||||
<workItem from="1523948661253" duration="7874000" />
|
<workItem from="1523948661253" duration="7874000" />
|
||||||
<workItem from="1524303326266" duration="7000" />
|
<workItem from="1524303326266" duration="7000" />
|
||||||
<workItem from="1524730597265" duration="8000" />
|
<workItem from="1524730597265" duration="8000" />
|
||||||
|
<workItem from="1525085664919" duration="10000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="36382000" />
|
<option name="totallyTimeSpent" value="36392000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="1466" y="-4" width="1303" height="780" extended-state="6" />
|
<frame x="1466" y="-4" width="1303" height="780" extended-state="6" />
|
||||||
@@ -179,12 +180,12 @@
|
|||||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||||
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
@@ -286,6 +287,35 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/php/caller.php">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="558">
|
||||||
|
<caret line="31" column="23" lean-forward="false" selection-start-line="31" selection-start-column="23" selection-end-line="31" selection-end-column="23" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="0">
|
||||||
|
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
|
<folding>
|
||||||
|
<element signature="n#listForTable#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#readFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#writeFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#createNewFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#createNewFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#deleteFolderOrFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#compress#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#extract#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#moveFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#copyFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#renameFileOrFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
<element signature="n#cleanInput#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="0">
|
<state relative-caret-position="0">
|
||||||
|
|||||||
@@ -2514,6 +2514,96 @@ class preFlightsChecks:
|
|||||||
logging.InstallLog.writeToFile(str(msg) + " [installTLDExtract]")
|
logging.InstallLog.writeToFile(str(msg) + " [installTLDExtract]")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def installOpenDKIM(self):
|
||||||
|
try:
|
||||||
|
count = 0
|
||||||
|
while (1):
|
||||||
|
|
||||||
|
command = 'yum -y install opendkim'
|
||||||
|
cmd = shlex.split(command)
|
||||||
|
res = subprocess.call(cmd)
|
||||||
|
|
||||||
|
if res == 1:
|
||||||
|
count = count + 1
|
||||||
|
preFlightsChecks.stdOut("Trying to install opendkim, trying again, try number: " + str(count))
|
||||||
|
if count == 3:
|
||||||
|
logging.InstallLog.writeToFile("Unable to install opendkim, your mail may not end up in inbox. [installOpenDKIM]")
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
logging.InstallLog.writeToFile("Succcessfully installed opendkim!")
|
||||||
|
preFlightsChecks.stdOut("Succcessfully installed opendkim!")
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
except OSError, msg:
|
||||||
|
logging.InstallLog.writeToFile(str(msg) + " [installOpenDKIM]")
|
||||||
|
return 0
|
||||||
|
except ValueError, msg:
|
||||||
|
logging.InstallLog.writeToFile(str(msg) + " [installOpenDKIM]")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def configureOpenDKIM(self):
|
||||||
|
try:
|
||||||
|
|
||||||
|
## Configure OpenDKIM specific settings
|
||||||
|
|
||||||
|
openDKIMConfigurePath = "/etc/opendkim.conf"
|
||||||
|
|
||||||
|
configData = """
|
||||||
|
Mode sv
|
||||||
|
Canonicalization relaxed/simple
|
||||||
|
KeyTable refile:/etc/opendkim/KeyTable
|
||||||
|
SigningTable refile:/etc/opendkim/SigningTable
|
||||||
|
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
|
||||||
|
InternalHosts refile:/etc/opendkim/TrustedHosts
|
||||||
|
"""
|
||||||
|
|
||||||
|
writeToFile = open(openDKIMConfigurePath,'a')
|
||||||
|
writeToFile.write(configData)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
|
||||||
|
## Configure postfix specific settings
|
||||||
|
|
||||||
|
postfixFilePath = "/etc/postfix/main.cf"
|
||||||
|
|
||||||
|
configData = """
|
||||||
|
smtpd_milters = inet:127.0.0.1:8891
|
||||||
|
non_smtpd_milters = $smtpd_milters
|
||||||
|
milter_default_action = accept
|
||||||
|
"""
|
||||||
|
|
||||||
|
writeToFile = open(postfixFilePath,'a')
|
||||||
|
writeToFile.write(configData)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
|
||||||
|
#### Restarting Postfix and OpenDKIM
|
||||||
|
|
||||||
|
command = "systemctl start opendkim"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
command = "systemctl enable opendkim"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
command = "systemctl start postfix"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
except OSError, msg:
|
||||||
|
logging.InstallLog.writeToFile(str(msg) + " [configureOpenDKIM]")
|
||||||
|
return 0
|
||||||
|
except ValueError, msg:
|
||||||
|
logging.InstallLog.writeToFile(str(msg) + " [configureOpenDKIM]")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -2588,6 +2678,12 @@ def main():
|
|||||||
checks.download_install_CyberPanel(installCyberPanel.InstallCyberPanel.mysqlPassword)
|
checks.download_install_CyberPanel(installCyberPanel.InstallCyberPanel.mysqlPassword)
|
||||||
checks.setup_cron()
|
checks.setup_cron()
|
||||||
checks.installTLDExtract()
|
checks.installTLDExtract()
|
||||||
|
|
||||||
|
## Install and Configure OpenDKIM.
|
||||||
|
|
||||||
|
checks.installOpenDKIM()
|
||||||
|
checks.configureOpenDKIM()
|
||||||
|
|
||||||
checks.modSecPreReqs()
|
checks.modSecPreReqs()
|
||||||
checks.installation_successfull()
|
checks.installation_successfull()
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,91 @@ class mailUtilities:
|
|||||||
print "0," + str(msg)
|
print "0," + str(msg)
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def setupDKIM(virtualHostName):
|
||||||
|
try:
|
||||||
|
## Generate DKIM Keys
|
||||||
|
|
||||||
|
if os.path.exists("/etc/opendkim/keys/" + virtualHostName):
|
||||||
|
return 1, "None"
|
||||||
|
|
||||||
|
os.mkdir("/etc/opendkim/keys/" + virtualHostName)
|
||||||
|
|
||||||
|
## Generate keys
|
||||||
|
|
||||||
|
command = "opendkim-genkey -D /etc/opendkim/keys/" + virtualHostName + " -d " + virtualHostName + " -s default"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
## Fix permissions
|
||||||
|
|
||||||
|
command = "chown -R root:opendkim /etc/opendkim/keys/" + virtualHostName
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
command = "chmod 640 /etc/opendkim/keys/" + virtualHostName + "/default.private"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
command = "chmod 644 /etc/opendkim/keys/" + virtualHostName + "/default.txt"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
## Edit key file
|
||||||
|
|
||||||
|
keyTable = "/etc/opendkim/KeyTable"
|
||||||
|
configToWrite = "default._domainkey." + virtualHostName + " " + virtualHostName + ":default:/etc/opendkim/keys/" + virtualHostName + "/default.private\n"
|
||||||
|
|
||||||
|
writeToFile = open(keyTable, 'a')
|
||||||
|
writeToFile.write(configToWrite)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
## Edit signing table
|
||||||
|
|
||||||
|
signingTable = "/etc/opendkim/SigningTable"
|
||||||
|
configToWrite = "*@" + virtualHostName + " default._domainkey." + virtualHostName + "\n"
|
||||||
|
|
||||||
|
writeToFile = open(signingTable, 'a')
|
||||||
|
writeToFile.write(configToWrite)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
## Trusted hosts
|
||||||
|
|
||||||
|
trustedHosts = "/etc/opendkim/TrustedHosts"
|
||||||
|
configToWrite = virtualHostName + "\n"
|
||||||
|
|
||||||
|
writeToFile = open(trustedHosts, 'a')
|
||||||
|
writeToFile.write(configToWrite)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
|
## Restart postfix and OpenDKIM
|
||||||
|
|
||||||
|
command = "systemctl restart opendkim"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
command = "systemctl restart postfix"
|
||||||
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
return 1, "None"
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
str(msg) + " [setupDKIM]")
|
||||||
|
return 0, str(msg)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def checkIfDKIMInstalled():
|
||||||
|
try:
|
||||||
|
|
||||||
|
path = "/etc/opendkim.conf"
|
||||||
|
|
||||||
|
if os.path.exists(path):
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
str(msg) + " [checkIfDKIMInstalled]")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
import tldextract
|
|
||||||
|
|
||||||
ext = tldextract.extract('http://forums.bbc.co.uk')
|
|
||||||
|
|
||||||
print ext.subdomain
|
|
||||||
print ext.domain
|
|
||||||
print ext.suffix
|
|
||||||
@@ -11,6 +11,7 @@ from os.path import join
|
|||||||
from os import listdir, rmdir
|
from os import listdir, rmdir
|
||||||
from shutil import move
|
from shutil import move
|
||||||
import randomPassword as randomPassword
|
import randomPassword as randomPassword
|
||||||
|
from mailUtilities import mailUtilities
|
||||||
|
|
||||||
|
|
||||||
class virtualHostUtilities:
|
class virtualHostUtilities:
|
||||||
@@ -726,8 +727,6 @@ class virtualHostUtilities:
|
|||||||
str(msg) + " [IO Error with per host config file [changePHP]]")
|
str(msg) + " [IO Error with per host config file [changePHP]]")
|
||||||
return [0,str(msg) + " [IO Error with per host config file [changePHP]]"]
|
return [0,str(msg) + " [IO Error with per host config file [changePHP]]"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getDiskUsage(path, totalAllowed):
|
def getDiskUsage(path, totalAllowed):
|
||||||
try:
|
try:
|
||||||
@@ -904,12 +903,21 @@ class virtualHostUtilities:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|
||||||
|
|
||||||
def createVirtualHost(virtualHostName,administratorEmail,phpVersion,virtualHostUser,numberOfSites,ssl,sslPath):
|
def createVirtualHost(virtualHostName,administratorEmail,phpVersion,virtualHostUser,numberOfSites,ssl,sslPath,dkimCheck):
|
||||||
try:
|
try:
|
||||||
if virtualHostUtilities.checkIfVirtualHostExists(virtualHostName) == 1:
|
if virtualHostUtilities.checkIfVirtualHostExists(virtualHostName) == 1:
|
||||||
print "0,Virtual Host Directory already exists!"
|
print "0,Virtual Host Directory already exists!"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if dkimCheck == 1:
|
||||||
|
if mailUtilities.checkIfDKIMInstalled() == 0:
|
||||||
|
print "0,OpenDKIM is not installed, install OpenDKIM from DKIM Manager."
|
||||||
|
return
|
||||||
|
|
||||||
|
result = mailUtilities.setupDKIM(virtualHostName)
|
||||||
|
if result[0] == 0:
|
||||||
|
raise BaseException(result[1])
|
||||||
|
|
||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
|
|
||||||
retValues = virtualHostUtilities.createDirectoryForVirtualHost(virtualHostName, administratorEmail,virtualHostUser, phpVersion)
|
retValues = virtualHostUtilities.createDirectoryForVirtualHost(virtualHostName, administratorEmail,virtualHostUser, phpVersion)
|
||||||
@@ -944,6 +952,8 @@ def createVirtualHost(virtualHostName,administratorEmail,phpVersion,virtualHostU
|
|||||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd,stdout=FNULL, stderr=subprocess.STDOUT)
|
subprocess.call(cmd,stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
|
|
||||||
|
|
||||||
@@ -953,6 +963,8 @@ def createVirtualHost(virtualHostName,administratorEmail,phpVersion,virtualHostU
|
|||||||
str(msg) + " [createVirtualHost]")
|
str(msg) + " [createVirtualHost]")
|
||||||
print "0,"+str(msg)
|
print "0,"+str(msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createDomain(masterDomain, virtualHostName, phpVersion, path,administratorEmail,virtualHostUser,restart,numberOfSites,ssl):
|
def createDomain(masterDomain, virtualHostName, phpVersion, path,administratorEmail,virtualHostUser,restart,numberOfSites,ssl):
|
||||||
try:
|
try:
|
||||||
if virtualHostUtilities.checkIfVirtualHostExists(virtualHostName) == 1:
|
if virtualHostUtilities.checkIfVirtualHostExists(virtualHostName) == 1:
|
||||||
@@ -1761,6 +1773,7 @@ def main():
|
|||||||
parser.add_argument("--numberOfSites", help="Number of sites!")
|
parser.add_argument("--numberOfSites", help="Number of sites!")
|
||||||
parser.add_argument("--ssl", help="Weather to activate SSL")
|
parser.add_argument("--ssl", help="Weather to activate SSL")
|
||||||
parser.add_argument("--sslPath", help="Path to website document root!")
|
parser.add_argument("--sslPath", help="Path to website document root!")
|
||||||
|
parser.add_argument('--dkimCheck', help='To enable or disable DKIM support for domain.')
|
||||||
|
|
||||||
|
|
||||||
## arguments for creation child domains
|
## arguments for creation child domains
|
||||||
@@ -1803,7 +1816,11 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.function == "createVirtualHost":
|
if args.function == "createVirtualHost":
|
||||||
createVirtualHost(args.virtualHostName,args.administratorEmail,args.phpVersion,args.virtualHostUser,int(args.numberOfSites),int(args.ssl),args.sslPath)
|
try:
|
||||||
|
dkimCheck = int(args.dkimCheck)
|
||||||
|
except:
|
||||||
|
dkimCheck = 0
|
||||||
|
createVirtualHost(args.virtualHostName,args.administratorEmail,args.phpVersion,args.virtualHostUser,int(args.numberOfSites),int(args.ssl),args.sslPath,dkimCheck)
|
||||||
elif args.function == "deleteVirtualHostConfigurations":
|
elif args.function == "deleteVirtualHostConfigurations":
|
||||||
virtualHostUtilities.deleteVirtualHostConfigurations(args.virtualHostName,int(args.numberOfSites))
|
virtualHostUtilities.deleteVirtualHostConfigurations(args.virtualHostName,int(args.numberOfSites))
|
||||||
elif args.function == "createDomain":
|
elif args.function == "createDomain":
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ app.controller('createWebsite', function($scope,$http) {
|
|||||||
var ssl = 0
|
var ssl = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($scope.dkimCheck === true){
|
||||||
|
var dkimCheck = 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var dkimCheck = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#webSiteCreation").fadeIn();
|
$("#webSiteCreation").fadeIn();
|
||||||
|
|
||||||
@@ -39,6 +46,7 @@ app.controller('createWebsite', function($scope,$http) {
|
|||||||
phpSelection: phpSelection,
|
phpSelection: phpSelection,
|
||||||
ssl:ssl,
|
ssl:ssl,
|
||||||
websiteOwner:websiteOwner,
|
websiteOwner:websiteOwner,
|
||||||
|
dkimCheck:dkimCheck
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ app.controller('createWebsite', function($scope,$http) {
|
|||||||
var ssl = 0
|
var ssl = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($scope.dkimCheck === true){
|
||||||
|
var dkimCheck = 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var dkimCheck = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#webSiteCreation").fadeIn();
|
$("#webSiteCreation").fadeIn();
|
||||||
|
|
||||||
@@ -39,6 +46,7 @@ app.controller('createWebsite', function($scope,$http) {
|
|||||||
phpSelection: phpSelection,
|
phpSelection: phpSelection,
|
||||||
ssl:ssl,
|
ssl:ssl,
|
||||||
websiteOwner:websiteOwner,
|
websiteOwner:websiteOwner,
|
||||||
|
dkimCheck:dkimCheck
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-9">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input ng-model="sslCheck" type="checkbox" value="">
|
<input ng-model="sslCheck" type="checkbox" value="">
|
||||||
@@ -94,6 +94,15 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input ng-model="dkimCheck" type="checkbox" value="">
|
||||||
|
DKIM Support
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input ng-pattern="/([\da-z\.-]+\.[a-z\.]{2,6}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?$/i" name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
|
<input ng-pattern="*" name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="websiteCreationForm.dom.$error.pattern" class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
<div ng-show="websiteCreationForm.dom.$error.pattern" class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
||||||
<div style="margin-bottom: 1%;" class=" col-sm-1">
|
<div style="margin-bottom: 1%;" class=" col-sm-1">
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ def submitWebsiteCreation(request):
|
|||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||||
|
|
||||||
execPath = execPath + " createVirtualHost --virtualHostName " + domain + " --administratorEmail " + adminEmail + " --phpVersion '" + phpSelection + "' --virtualHostUser " + externalApp + " --numberOfSites " + numberOfWebsites + " --ssl " + str(
|
execPath = execPath + " createVirtualHost --virtualHostName " + domain + " --administratorEmail " + adminEmail + " --phpVersion '" + phpSelection + "' --virtualHostUser " + externalApp + " --numberOfSites " + numberOfWebsites + " --ssl " + str(
|
||||||
data['ssl']) + " --sslPath " + sslpath
|
data['ssl']) + " --sslPath " + sslpath + " --dkimCheck " + str(data['dkimCheck'])
|
||||||
|
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = subprocess.check_output(shlex.split(execPath))
|
||||||
@@ -404,6 +404,68 @@ def submitWebsiteCreation(request):
|
|||||||
disabled=0,
|
disabled=0,
|
||||||
auth=1)
|
auth=1)
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
|
## TXT Records for mail
|
||||||
|
|
||||||
|
record = Records(domainOwner=zone,
|
||||||
|
domain_id=zone.id,
|
||||||
|
name=topLevelDomain,
|
||||||
|
type="TXT",
|
||||||
|
content="v=spf1 a mx ip4:" + ipAddress + " ~all",
|
||||||
|
ttl=3600,
|
||||||
|
prio=0,
|
||||||
|
disabled=0,
|
||||||
|
auth=1)
|
||||||
|
record.save()
|
||||||
|
|
||||||
|
record = Records(domainOwner=zone,
|
||||||
|
domain_id=zone.id,
|
||||||
|
name="_dmarc." + topLevelDomain,
|
||||||
|
type="TXT",
|
||||||
|
content="v=DMARC1; p=none",
|
||||||
|
ttl=3600,
|
||||||
|
prio=0,
|
||||||
|
disabled=0,
|
||||||
|
auth=1)
|
||||||
|
record.save()
|
||||||
|
|
||||||
|
record = Records(domainOwner=zone,
|
||||||
|
domain_id=zone.id,
|
||||||
|
name="_domainkey." + topLevelDomain,
|
||||||
|
type="TXT",
|
||||||
|
content="t=y; o=~;",
|
||||||
|
ttl=3600,
|
||||||
|
prio=0,
|
||||||
|
disabled=0,
|
||||||
|
auth=1)
|
||||||
|
record.save()
|
||||||
|
|
||||||
|
|
||||||
|
## DKIM Support
|
||||||
|
|
||||||
|
if data['dkimCheck'] == 1:
|
||||||
|
|
||||||
|
path = "/etc/opendkim/keys/" + topLevelDomain + "/default.txt"
|
||||||
|
command = "sudo cat " + path
|
||||||
|
output = subprocess.check_output(shlex.split(command))
|
||||||
|
|
||||||
|
record = Records(domainOwner=zone,
|
||||||
|
domain_id=zone.id,
|
||||||
|
name="default._domainkey." + topLevelDomain,
|
||||||
|
type="TXT",
|
||||||
|
content="v=DKIM1; k=rsa; p=" + output[53:269],
|
||||||
|
ttl=3600,
|
||||||
|
prio=0,
|
||||||
|
disabled=0,
|
||||||
|
auth=1)
|
||||||
|
record.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if Domains.objects.filter(name=topLevelDomain).count() == 0:
|
if Domains.objects.filter(name=topLevelDomain).count() == 0:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user