From 25848342f51542a009fa58ce58dd1059b8c13bec Mon Sep 17 00:00:00 2001 From: Michael Ramsey Date: Tue, 8 Oct 2019 13:17:33 -0400 Subject: [PATCH] Fix Dates. Improve CSF integration. Fix Typos --- IncBackups/IncBackupsControl.py | 6 +- IncBackups/static/IncBackups/IncBackups.js | 2 +- .../templates/IncBackups/createBackup.html | 0 backup/backupManager.py | 6 +- .../templates/baseTemplate/index.html | 0 cli/cliLogger.py | 2 +- .../templates/emailPremium/emailPage.html | 0 .../templates/emailPremium/listDomains.html | 2 +- .../templates/emailPremium/policyServer.html | 2 +- firewall/templates/firewall/index.html | 46 ++++ install/install.py | 12 +- install/installLog.py | 2 +- locale/br/LC_MESSAGES/django.po | 2 +- locale/bs/LC_MESSAGES/django.po | 2 +- locale/cn/LC_MESSAGES/django.po | 2 +- locale/es/LC_MESSAGES/django.po | 2 +- locale/fr/LC_MESSAGES/django.po | 2 +- locale/gr/LC_MESSAGES/django.po | 2 +- locale/id/LC_MESSAGES/django.po | 2 +- locale/it/LC_MESSAGES/django.po | 2 +- locale/ja/LC_MESSAGES/django.po | 2 +- locale/pl/LC_MESSAGES/django.po | 2 +- locale/pt/LC_MESSAGES/django.po | 2 +- locale/ru/LC_MESSAGES/django.po | 2 +- locale/tr/LC_MESSAGES/django.po | 2 +- locale/vi/LC_MESSAGES/django.po | 2 +- loginSystem/templates/loginSystem/login.html | 2 +- plogical/CyberCPLogFileWriter.py | 4 +- plogical/backupSchedule.py | 8 +- plogical/backupScheduleLocal.py | 4 +- plogical/backupUtilities.py | 18 +- plogical/csf.py | 239 +++++++++++++++++- plogical/mailUtilities.py | 0 plogical/mysqlUtilities.py | 0 plogical/processUtilities.py | 0 plogical/remoteBackup.py | 48 ++-- plogical/remoteTransferUtilities.py | 36 +-- plogical/upgrade.py | 6 +- pluginInstaller/pluginInstaller.py | 6 +- postfixSenderPolicy/accept_traffic.py | 4 +- s3Backups/s3Backups.py | 4 +- 41 files changed, 379 insertions(+), 108 deletions(-) mode change 100755 => 100644 IncBackups/templates/IncBackups/createBackup.html mode change 100755 => 100644 backup/backupManager.py mode change 100755 => 100644 baseTemplate/templates/baseTemplate/index.html mode change 100755 => 100644 cli/cliLogger.py mode change 100755 => 100644 emailPremium/templates/emailPremium/emailPage.html mode change 100755 => 100644 emailPremium/templates/emailPremium/listDomains.html mode change 100755 => 100644 emailPremium/templates/emailPremium/policyServer.html mode change 100755 => 100644 firewall/templates/firewall/index.html mode change 100755 => 100644 install/install.py mode change 100755 => 100644 install/installLog.py mode change 100755 => 100644 loginSystem/templates/loginSystem/login.html mode change 100755 => 100644 plogical/CyberCPLogFileWriter.py mode change 100755 => 100644 plogical/backupSchedule.py mode change 100755 => 100644 plogical/backupScheduleLocal.py mode change 100755 => 100644 plogical/backupUtilities.py mode change 100755 => 100644 plogical/csf.py mode change 100755 => 100644 plogical/mailUtilities.py mode change 100755 => 100644 plogical/mysqlUtilities.py mode change 100755 => 100644 plogical/processUtilities.py mode change 100755 => 100644 plogical/remoteBackup.py mode change 100755 => 100644 plogical/remoteTransferUtilities.py mode change 100755 => 100644 plogical/upgrade.py mode change 100755 => 100644 pluginInstaller/pluginInstaller.py mode change 100755 => 100644 postfixSenderPolicy/accept_traffic.py mode change 100755 => 100644 s3Backups/s3Backups.py diff --git a/IncBackups/IncBackupsControl.py b/IncBackups/IncBackupsControl.py index 2c62017c4..52c0b653a 100644 --- a/IncBackups/IncBackupsControl.py +++ b/IncBackups/IncBackupsControl.py @@ -12,7 +12,7 @@ except: pass import threading as multi from plogical.processUtilities import ProcessUtilities -from IncBackups.models import IncJob, JobSnapshots +from models import IncJob, JobSnapshots from websiteFunctions.models import Websites import plogical.randomPassword as randomPassword from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging @@ -316,7 +316,7 @@ class IncJobs(multi.Thread): reparsed = minidom.parseString(rough_string) return reparsed.toprettyxml(indent=" ") - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018/meta.xml -- metaPath + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath metaPath = '/home/cyberpanel/%s' % (str(randint(1000, 9999))) @@ -538,4 +538,4 @@ class IncJobs(multi.Thread): except: pass - logging.statusWriter(self.statusPath, 'Completed', 1) \ No newline at end of file + logging.statusWriter(self.statusPath, 'Completed', 1) diff --git a/IncBackups/static/IncBackups/IncBackups.js b/IncBackups/static/IncBackups/IncBackups.js index 54769c4f1..36463bbb3 100644 --- a/IncBackups/static/IncBackups/IncBackups.js +++ b/IncBackups/static/IncBackups/IncBackups.js @@ -491,4 +491,4 @@ app.controller('incrementalDestinations', function ($scope, $http) { }; -}); \ No newline at end of file +}); diff --git a/IncBackups/templates/IncBackups/createBackup.html b/IncBackups/templates/IncBackups/createBackup.html old mode 100755 new mode 100644 diff --git a/backup/backupManager.py b/backup/backupManager.py old mode 100755 new mode 100644 index 2e9d80cdc..e419c68dd --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -142,10 +142,10 @@ class BackupManager: ## /home/example.com/backup backupPath = os.path.join("/home", backupDomain, "backup/") - domainUser = website.externalApp - backupName = 'backup-' + domainUser + "-" + time.strftime("%I-%M-%S-%a-%b-%Y") + backupDomainName = data['websiteToBeBacked'] + backupName = 'backup-' + backupDomainName + "-" + time.strftime("%m.%d.%Y_%H-%M-%S") - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 tempStoragePath = os.path.join(backupPath, backupName) diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html old mode 100755 new mode 100644 diff --git a/cli/cliLogger.py b/cli/cliLogger.py old mode 100755 new mode 100644 index 878f5527a..c5c25a554 --- a/cli/cliLogger.py +++ b/cli/cliLogger.py @@ -10,7 +10,7 @@ class cliLogger: try: file = open(cliLogger.fileName, 'a') file.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] [" + level + ":" + method + "] " + message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] [" + level + ":" + method + "] " + message + "\n") file.close() file.close() except IOError: diff --git a/emailPremium/templates/emailPremium/emailPage.html b/emailPremium/templates/emailPremium/emailPage.html old mode 100755 new mode 100644 diff --git a/emailPremium/templates/emailPremium/listDomains.html b/emailPremium/templates/emailPremium/listDomains.html old mode 100755 new mode 100644 index 013f99776..fe547101b --- a/emailPremium/templates/emailPremium/listDomains.html +++ b/emailPremium/templates/emailPremium/listDomains.html @@ -11,7 +11,7 @@
-

{% trans "List Domains" %} - {% trans "Emai Limits Docs" %}

+

{% trans "List Domains" %} - {% trans "Email Limits Docs" %}

{% trans "On this page you manage emails limits for Domains/Email Addresses" %}

diff --git a/emailPremium/templates/emailPremium/policyServer.html b/emailPremium/templates/emailPremium/policyServer.html old mode 100755 new mode 100644 index 357fb1ab2..91939a79b --- a/emailPremium/templates/emailPremium/policyServer.html +++ b/emailPremium/templates/emailPremium/policyServer.html @@ -10,7 +10,7 @@
-

{% trans "Email Policy Server Configurations!" %} - {% trans "Emai Limits Docs" %}

+

{% trans "Email Policy Server Configurations!" %} - {% trans "Email Limits Docs" %}

{% trans "Turn ON Email Policy Server to use Email Limits Feature. " %}

diff --git a/firewall/templates/firewall/index.html b/firewall/templates/firewall/index.html old mode 100755 new mode 100644 index 9c31285cf..4f694aab2 --- a/firewall/templates/firewall/index.html +++ b/firewall/templates/firewall/index.html @@ -43,6 +43,52 @@
+ + + + + + + + + +
diff --git a/install/install.py b/install/install.py old mode 100755 new mode 100644 index eda1718dd..74bed45d2 --- a/install/install.py +++ b/install/install.py @@ -122,10 +122,10 @@ class preFlightsChecks: def stdOut(message, log=0, do_exit=0, code=os.EX_OK): print("\n\n") print ("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") - print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n") + print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + message + "\n") print ("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") + "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n") if log: logging.InstallLog.writeToFile(message) @@ -575,7 +575,7 @@ class preFlightsChecks: if preFlightsChecks.resFailed(self.distro, res): count = count + 1 print("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] " + "Unable to install Python setup tools, trying again, try number: " + str( + "%m.%d.%Y_%H-%M-%S") + "] " + "Unable to install Python setup tools, trying again, try number: " + str( count) + "\n") if count == 3: logging.InstallLog.writeToFile( @@ -584,7 +584,7 @@ class preFlightsChecks: os._exit(0) else: logging.InstallLog.writeToFile("Python setup tools Successfully installed!") - print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + "Python setup tools Successfully installed!") + print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + "Python setup tools Successfully installed!") break def install_python_requests(self): @@ -2349,7 +2349,7 @@ enabled=1""" else: logging.InstallLog.writeToFile("Rainloop permissions changed!") print( - "[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + "Rainloop permissions changed!") + "[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + "Rainloop permissions changed!") break ############# diff --git a/install/installLog.py b/install/installLog.py old mode 100755 new mode 100644 index 2e7c28022..6aa1b7254 --- a/install/installLog.py +++ b/install/installLog.py @@ -7,5 +7,5 @@ class InstallLog: def writeToFile(message): file = open(InstallLog.fileName,'a') file.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] "+message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] "+message + "\n") file.close() diff --git a/locale/br/LC_MESSAGES/django.po b/locale/br/LC_MESSAGES/django.po index 2e77baac4..64582e111 100755 --- a/locale/br/LC_MESSAGES/django.po +++ b/locale/br/LC_MESSAGES/django.po @@ -3692,7 +3692,7 @@ msgstr "SpamAssassin конфигурация е успешно променен #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Email лимити документация" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/bs/LC_MESSAGES/django.po b/locale/bs/LC_MESSAGES/django.po index 7a7e7d31e..0af46625b 100755 --- a/locale/bs/LC_MESSAGES/django.po +++ b/locale/bs/LC_MESSAGES/django.po @@ -3835,7 +3835,7 @@ msgstr " uspješno je kreiran." #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Email logovi" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/cn/LC_MESSAGES/django.po b/locale/cn/LC_MESSAGES/django.po index 4779386d5..81c451f14 100755 --- a/locale/cn/LC_MESSAGES/django.po +++ b/locale/cn/LC_MESSAGES/django.po @@ -3773,7 +3773,7 @@ msgstr " 已成功创建." #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Email日志" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index 92a6d8b8a..f16b34caa 100755 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -3780,7 +3780,7 @@ msgstr "" #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 0f3b6d45a..e5c9c5ba4 100755 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3706,7 +3706,7 @@ msgstr "Les configurations de SpamAssassin ont été enregistrées avec succès. #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Limites de messagerie documentations" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/gr/LC_MESSAGES/django.po b/locale/gr/LC_MESSAGES/django.po index b9795b6c6..a4c103bfe 100755 --- a/locale/gr/LC_MESSAGES/django.po +++ b/locale/gr/LC_MESSAGES/django.po @@ -3848,7 +3848,7 @@ msgstr "δημιουργήθηκε με επιτυχία." #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Αρχεία καταγραφής Email " #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/id/LC_MESSAGES/django.po b/locale/id/LC_MESSAGES/django.po index 60810defd..412fa91e9 100755 --- a/locale/id/LC_MESSAGES/django.po +++ b/locale/id/LC_MESSAGES/django.po @@ -3437,7 +3437,7 @@ msgstr "" #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/it/LC_MESSAGES/django.po b/locale/it/LC_MESSAGES/django.po index 641aabe0f..f2c7a51a3 100755 --- a/locale/it/LC_MESSAGES/django.po +++ b/locale/it/LC_MESSAGES/django.po @@ -3803,7 +3803,7 @@ msgstr "Le configurazioni di SpamAssassin sono state salvate correttamente." #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Documentazione Limiti Email" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/ja/LC_MESSAGES/django.po b/locale/ja/LC_MESSAGES/django.po index 2799ded15..6eb63f9c8 100755 --- a/locale/ja/LC_MESSAGES/django.po +++ b/locale/ja/LC_MESSAGES/django.po @@ -3682,7 +3682,7 @@ msgstr "SpamAssassin 設定が保存されました。" #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Eメールの制限ドキュメント" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/pl/LC_MESSAGES/django.po b/locale/pl/LC_MESSAGES/django.po index 995998181..11ce10080 100755 --- a/locale/pl/LC_MESSAGES/django.po +++ b/locale/pl/LC_MESSAGES/django.po @@ -3676,7 +3676,7 @@ msgstr "Pomyślnie zapisano konfigurację SpamAssassin." #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Limity poczty dokumentacja" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/pt/LC_MESSAGES/django.po b/locale/pt/LC_MESSAGES/django.po index 98b93b48b..fe5c85a00 100755 --- a/locale/pt/LC_MESSAGES/django.po +++ b/locale/pt/LC_MESSAGES/django.po @@ -3845,7 +3845,7 @@ msgstr " foi criado com sucesso." #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Logs de E-Mail" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po index e03a8eef8..c477cd703 100755 --- a/locale/ru/LC_MESSAGES/django.po +++ b/locale/ru/LC_MESSAGES/django.po @@ -3801,7 +3801,7 @@ msgstr "Успешно запущен процесс резервного коп #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Лог-журнал Эл.почты" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index 20b2514f4..ea1ce37c3 100755 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -3775,7 +3775,7 @@ msgstr "Yedekleme işlemi başarıyla başlatıldı." #: emailPremium/templates/emailPremium/policyServer.html:13 #, fuzzy #| msgid "Email Logs" -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Eposta günlükleri" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/locale/vi/LC_MESSAGES/django.po b/locale/vi/LC_MESSAGES/django.po index e1d7ae77c..c3ce50232 100755 --- a/locale/vi/LC_MESSAGES/django.po +++ b/locale/vi/LC_MESSAGES/django.po @@ -3674,7 +3674,7 @@ msgstr "Đã lưu thành công cấu hình SpamAssassin." #: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -msgid "Emai Limits Docs" +msgid "Email Limits Docs" msgstr "Tài liệu giới hạn Emai" #: emailPremium/templates/emailPremium/emailLimits.html:14 diff --git a/loginSystem/templates/loginSystem/login.html b/loginSystem/templates/loginSystem/login.html old mode 100755 new mode 100644 index 407ee54ee..a9dc40895 --- a/loginSystem/templates/loginSystem/login.html +++ b/loginSystem/templates/loginSystem/login.html @@ -67,7 +67,7 @@
-

CyberPanel v 1.8

+

CyberPanel v 1.9

Web Hosting Control Panel

    diff --git a/plogical/CyberCPLogFileWriter.py b/plogical/CyberCPLogFileWriter.py old mode 100755 new mode 100644 index b7b60c117..449a321a9 --- a/plogical/CyberCPLogFileWriter.py +++ b/plogical/CyberCPLogFileWriter.py @@ -10,7 +10,7 @@ class CyberCPLogFileWriter: try: file = open(CyberCPLogFileWriter.fileName,'a') file.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n") file.close() except IOError,msg: @@ -21,7 +21,7 @@ class CyberCPLogFileWriter: try: file = open(CyberCPLogFileWriter.fileName, 'a') file.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] [" + level + ":" + method + "] " + message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] [" + level + ":" + method + "] " + message + "\n") file.close() file.close() except IOError: diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py old mode 100755 new mode 100644 index 126e0f84d..eb8b3a482 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -24,8 +24,8 @@ class backupSchedule: def remoteBackupLogging(fileName, message): try: file = open(fileName,'a') - file.writelines("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") - print ("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") + file.writelines("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n") + print ("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n") file.close() except IOError,msg: return "Can not write to error file." @@ -192,10 +192,10 @@ class backupSchedule: try: destinations = backupUtilities.destinationsPath - backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%I-%M-%S-%a-%b-%Y") + backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%m.%d.%Y_%H-%M-%S") backupSchedule.remoteBackupLogging(backupLogPath,"#################################################") - backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%I-%M-%S-%a-%b-%Y")) + backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%m.%d.%Y_%H-%M-%S")) backupSchedule.remoteBackupLogging(backupLogPath,"#################################################\n") backupSchedule.remoteBackupLogging(backupLogPath, "") diff --git a/plogical/backupScheduleLocal.py b/plogical/backupScheduleLocal.py old mode 100755 new mode 100644 index 7f000cf30..7129b9867 --- a/plogical/backupScheduleLocal.py +++ b/plogical/backupScheduleLocal.py @@ -11,12 +11,12 @@ class backupScheduleLocal: @staticmethod def prepare(): try: - backupLogPath = "/usr/local/lscp/logs/local_backup_log." + time.strftime("%I-%M-%S-%a-%b-%Y") + backupLogPath = "/usr/local/lscp/logs/local_backup_log." + time.strftime("%m.%d.%Y_%H-%M-%S") writeToFile = open(backupLogPath, "a") backupSchedule.remoteBackupLogging(backupLogPath, "#################################################") - backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + time.strftime("%I-%M-%S-%a-%b-%Y")) + backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + time.strftime("%m.%d.%Y_%H-%M-%S")) backupSchedule.remoteBackupLogging(backupLogPath, "#################################################\n") backupSchedule.remoteBackupLogging(backupLogPath, "") diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py old mode 100755 new mode 100644 index 1ac44073e..21ad2802c --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -208,7 +208,7 @@ class backupUtilities: reparsed = minidom.parseString(rough_string) return reparsed.toprettyxml(indent=" ") - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018/meta.xml -- metaPath + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath metaPath = '/tmp/%s' % (str(randint(1000, 9999))) @@ -221,7 +221,7 @@ class backupUtilities: ## meta generated - newBackup = Backups(website=website, fileName=backupName, date=time.strftime("%I-%M-%S-%a-%b-%Y"), + newBackup = Backups(website=website, fileName=backupName, date=time.strftime("%m.%d.%Y_%H-%M-%S"), size=0, status=1) newBackup.save() @@ -238,7 +238,7 @@ class backupUtilities: def startBackup(tempStoragePath, backupName, backupPath, metaPath = None): try: - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath ## /home/example.com/backup - backupPath ##### Writing the name of backup file. @@ -256,7 +256,7 @@ class backupUtilities: ##### Parsing XML Meta file! - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath metaPathInBackup = os.path.join(tempStoragePath,'meta.xml') @@ -279,7 +279,7 @@ class backupUtilities: if os.path.exists(backupUtilities.licenseKey): copy(completPathToConf, tempStoragePath + '/vhost.conf') - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath ## shutil.make_archive make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) @@ -534,7 +534,7 @@ class backupUtilities: status = os.path.join(completPath,'status') logging.CyberCPLogFileWriter.statusWriter(status, "Extracting Main Archive!") - ## Converting /home/backup/backup-example-06-50-03-Thu-Feb-2018.tar.gz -> /home/backup/backup-example-06-50-03-Thu-Feb-2018 + ## Converting /home/backup/backup-example.com-02.13.2018_10-24-52.tar.gz -> /home/backup/backup-example.com-02.13.2018_10-24-52 tar = tarfile.open(originalFile) tar.extractall(completPath) @@ -690,7 +690,7 @@ class backupUtilities: logging.CyberCPLogFileWriter.statusWriter(status, "Extracting web home data!") - # /home/backup/backup-example-06-50-03-Thu-Feb-2018/public_html.tar.gz + # /home/backup/backup-example.com-02.13.2018_10-24-52/public_html.tar.gz tar = tarfile.open(pathToCompressedHome) tar.extractall(websiteHome) @@ -1027,8 +1027,8 @@ class backupUtilities: def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): try: - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath - ## backup-example-06-50-03-Thu-Feb-2018 -- backup name + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath + ## backup-example.com-02.13.2018_10-24-52 -- backup name ## /home/example.com/backup - backupPath ## /home/cyberpanel/1047.xml - metaPath diff --git a/plogical/csf.py b/plogical/csf.py old mode 100755 new mode 100644 index 715ee78f2..cd1f2108f --- a/plogical/csf.py +++ b/plogical/csf.py @@ -11,6 +11,7 @@ from mailUtilities import mailUtilities import threading as multi from plogical.processUtilities import ProcessUtilities + class CSF(multi.Thread): installLogPath = "/home/cyberpanel/csfInstallLog" csfURL = 'https://download.configserver.com/csf.tgz' @@ -58,25 +59,233 @@ class CSF(multi.Thread): command = 'bash install.sh' ProcessUtilities.normalExecutioner(command) + # install required packages for CSF perl and /usr/bin/host + if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + command = 'yum install bind-utils perl-libwww-perl net-tools perl-LWP-Protocol-https -y' + ProcessUtilities.normalExecutioner(command) + elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + command = 'apt-get install dnsutils libwww-perl -y' + ProcessUtilities.normalExecutioner(command) + else: - ## Some initial configurations + logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, + 'CSF required packages successfully Installed.[200]\n', 1) + + # Some initial configurations data = open('/etc/csf/csf.conf', 'r').readlines() writeToConf = open('/etc/csf/csf.conf', 'w') for items in data: if items.find('TCP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'): - writeToConf.writelines('TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,8090,40110:40210"\n') + writeToConf.writelines( + 'TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,7080,8090,40110:40210"\n') elif items.find('TCP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'): writeToConf.writelines('TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,8090,40110:40210"\n') elif items.find('UDP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'): writeToConf.writelines('UDP_IN = "20,21,53"\n') elif items.find('UDP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'): writeToConf.writelines('UDP_OUT = "20,21,53,113,123"\n') + # setting RESTRICT_SYSLOG to "3" for use with option RESTRICT_SYSLOG_GROUP + elif items.find('RESTRICT_SYSLOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RESTRICT_SYSLOG = "3"\n') + + # Send an email alert if an IP address is blocked by one of the [*] triggers: disabled + elif items.find('LF_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_EMAIL_ALERT = "0"\n') + + # Set LF_PERMBLOCK_ALERT to "0" to disable this feature + elif items.find('LF_PERMBLOCK_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_PERMBLOCK_ALERT = "0"\n') + + # Set LF_NETBLOCK_ALERT to "0" to disable this feature + elif items.find('LF_NETBLOCK_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_NETBLOCK_ALERT = "0"\n') + + # Login Failure Blocking and Alerts + # LF_TRIGGER_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_TRIGGER_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_TRIGGER_PERM = "1800"\n') + + # Enable login failure detection of sshd connections: 10 failures triggers + elif items.find('LF_SSHD =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_SSHD = "10"\n') + + # LF_SSHD_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_SSHD_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_SSHD_PERM = "1800"\n') + + # Enable login failure detection of ftp connections: 10 failures triggers + elif items.find('LF_FTPD =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_FTPD = "10"\n') + + # LF_FTPD_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_FTPD_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_FTPD_PERM = "1800"\n') + + # Enable login failure detection of SMTP AUTH connections: 10 failures triggers + elif items.find('LF_SMTPAUTH =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_SMTPAUTH = "10"\n') + + # LF_SMTPAUTH_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_SMTPAUTH_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_SMTPAUTH_PERM = "1800"\n') + + # Enable login failure detection of pop3 connections: 10 failures triggers + elif items.find('LF_POP3D =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_POP3D = "10"\n') + + # LF_POP3D_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_POP3D_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_POP3D_PERM = "1800"\n') + + # Enable login failure detection of imap connections: 10 failures triggers + elif items.find('LF_IMAPD =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_IMAPD = "10"\n') + + # LF_IMAPD_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_IMAPD_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_IMAPD_PERM = "1800"\n') + + # LF_HTACCESS_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_HTACCESS_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_HTACCESS_PERM = "1800"\n') + + # Enable failure detection of repeated Apache mod_security rule triggers: 10 failures triggers + elif items.find('LF_MODSEC =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_MODSEC = "10"\n') + + # LF_MODSEC_PERM = "1800" => the IP is blocked temporarily for 30 minutes + elif items.find('LF_MODSEC_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_MODSEC_PERM = "1800"\n') + + # MODSEC_LOG location + elif items.find('MODSEC_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('MODSEC_LOG = "/usr/local/lsws/logs/auditmodsec.log"\n') + + # Send an email alert if anyone logs in successfully using SSH: Disabled + elif items.find('LF_SSH_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_SSH_EMAIL_ALERT = "0"\n') + + # Send an email alert if anyone accesses webmin: Disabled not applicable + elif items.find('LF_WEBMIN_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_WEBMIN_EMAIL_ALERT = "0"\n') + + # LF_QUEUE_ALERT disabled + elif items.find('LF_QUEUE_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_QUEUE_ALERT = "0"\n') + + # LF_QUEUE_INTERVAL disabled + elif items.find('LF_QUEUE_INTERVAL = "0"') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('LF_TRIGGER_PERM = "1800"\n') + + # Relay Tracking. This allows you to track email that is relayed through the server. Disabled + elif items.find('RT_RELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_RELAY_ALERT = "0"\n') + + # RT_[relay type]_LIMIT: the limit/hour afterwhich an email alert will be sent + elif items.find('RT_RELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_RELAY_LIMIT = "500"\n') + + # RT_[relay type]_BLOCK: 0 = no block;1 = perm block;nn=temp block for nn secs + elif items.find('RT_RELAY_BLOCK') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_RELAY_BLOCK = "0"\n') + + # This option triggers for email authenticated by SMTP AUTH disabled + elif items.find('RT_AUTHRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_AUTHRELAY_ALERT = "0"\n') + + # RT_AUTHRELAY_LIMIT set to 100 + elif items.find('RT_AUTHRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_AUTHRELAY_LIMIT = "100"\n') + + # RT_AUTHRELAY_LIMIT set to 0 + elif items.find('RT_AUTHRELAY_BLOCK') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_AUTHRELAY_BLOCK = "0"\n') + + # This option triggers for email authenticated by POP before SMTP + elif items.find('RT_POPRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_POPRELAY_ALERT = "0"\n') + + # This option triggers for email authenticated by POP before SMTP + elif items.find('RT_POPRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_POPRELAY_LIMIT = "100"\n') + + # RT_POPRELAY_BLOCK disabled + elif items.find('RT_POPRELAY_BLOCK') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_POPRELAY_BLOCK = "0"\n') + + # This option triggers for email sent via /usr/sbin/sendmail or /usr/sbin/exim: Disabled + elif items.find('RT_LOCALRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_LOCALRELAY_ALERT = "0"\n') + + # This option triggers for email sent via a local IP addresses + elif items.find('RT_LOCALRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_LOCALRELAY_LIMIT = "100"\n') + + # This option triggers for email sent via a local IP addresses + elif items.find('RT_LOCALHOSTRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_LOCALHOSTRELAY_ALERT = "0"\n') + + # This option triggers for email sent via a local IP addresses disabled + elif items.find('RT_LOCALHOSTRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_LOCALHOSTRELAY_LIMIT = "100"\n') + + # If an RT_* event is triggered, then if the following contains the path to a script + elif items.find('RT_ACTION') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('RT_ACTION = ""\n') + + # Send an email alert if an IP address is blocked due to connection tracking disabled + elif items.find('CT_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('CT_EMAIL_ALERT = "0"\n') + + # User Process Tracking. Set to 0 to disable this feature + elif items.find('PT_USERPROC =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('PT_USERPROC = "0"\n') + + # This User Process Tracking option sends an alert if any user process exceeds the virtual memory usage set (MB) + elif items.find('PT_USERMEM =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('PT_USERMEM = "0"\n') + + # This User Process Tracking option sends an alert if any user process exceeds the RSS memory usage set (MB) - RAM used, not virtual. + elif items.find('PT_USERRSS =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('PT_USERRSS = "0"\n') + + # If this option is set then processes detected by PT_USERMEM, PT_USERTIME or PT_USERPROC are killed. Disabled + elif items.find('PT_USERTIME =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('PT_USERTIME = "0"\n') + + # If you want to disable email alerts if PT_USERKILL is triggered, then set this option to 0. Disabled + elif items.find('PT_USERKILL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('PT_USERKILL_ALERT = "0"\n') + + # Check the PT_LOAD_AVG minute Load Average (can be set to 1 5 or 15 and defaults to 5 if set otherwise) on the server every PT_LOAD seconds. Disabled + elif items.find('PT_LOAD =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('PT_LOAD = "0"\n') + + # HTACCESS_LOG is ins main error.log + elif items.find('HTACCESS_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('HTACCESS_LOG = "/usr/local/lsws/logs/error.log"\n') + elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if items.find('SSHD_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('SSHD_LOG = "/var/log/auth.log"\n') + elif items.find('SU_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('SU_LOG = "/var/log/auth.log"\n') + elif items.find('SMTPAUTH_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('SMTPAUTH_LOG = "/var/log/mail.log"\n') + elif items.find('POP3D_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('POP3D_LOG = "/var/log/mail.log"\n') + elif items.find('IMAPD_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('IMAPD_LOG = "/var/log/mail.log"\n') + elif items.find('IPTABLES_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('IPTABLES_LOG = "/var/log/kern.log"\n') + elif items.find('SYSLOG_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'): + writeToConf.writelines('SYSLOG_LOG = "/var/log/syslog"\n') else: writeToConf.writelines(items) writeToConf.close() + ## command = 'csf -s' @@ -144,7 +353,8 @@ class CSF(multi.Thread): output = ProcessUtilities.outputExecutioner(command).splitlines() for items in output: - if items.find('TESTING') > -1 and items.find('=') > -1 and (items[0]!= '#') and items.find('TESTING_INTERVAL') == -1: + if items.find('TESTING') > -1 and items.find('=') > -1 and (items[0] != '#') and items.find( + 'TESTING_INTERVAL') == -1: if items.find('0') > -1: currentSettings['TESTING'] = 0 else: @@ -172,7 +382,6 @@ class CSF(multi.Thread): if output.find('0.0.0.0/0') > -1: currentSettings['firewallStatus'] = 1 - return currentSettings except BaseException, msg: @@ -209,7 +418,7 @@ class CSF(multi.Thread): except BaseException, msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[changeStatus]") - print '0',str(msg) + print '0', str(msg) @staticmethod def modifyPorts(protocol, portsPath): @@ -289,8 +498,23 @@ class CSF(multi.Thread): logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[blockIP]") -def main(): + def run_command(command): + p = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + return iter(p.stdout.readline, b'') + @staticmethod + def checkIP(ipAddress): + try: + command = "sudo csf -g ' + ipAddress.split() + for line in run_command(command): + print(line) + + except BaseException, msg: + logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIP]") + +def main(): parser = argparse.ArgumentParser(description='CSF Manager') parser.add_argument('function', help='Specific a function to call!') @@ -302,7 +526,7 @@ def main(): args = parser.parse_args() if args.function == "installCSF": - CSF.installCSF() + CSF.installCSF() elif args.function == 'removeCSF': controller = CSF(args.function, {}) controller.run() @@ -311,5 +535,6 @@ def main(): elif args.function == 'modifyPorts': CSF.modifyPorts(args.protocol, args.ports) + if __name__ == "__main__": main() diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py old mode 100755 new mode 100644 diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py old mode 100755 new mode 100644 diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py old mode 100755 new mode 100644 diff --git a/plogical/remoteBackup.py b/plogical/remoteBackup.py old mode 100755 new mode 100644 index f91ab23e1..0713f5e8c --- a/plogical/remoteBackup.py +++ b/plogical/remoteBackup.py @@ -43,7 +43,7 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: "+backup+".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Starting restore for: "+backup+".\n") writeToFile.close() finalData = json.dumps({'backupFile': backup, "dir": dir}) @@ -63,9 +63,9 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Restore aborted for: " + backup + ". Error message: "+data['status']+"\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Restore aborted for: " + backup + ". Error message: "+data['status']+"\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n") writeToFile.close() break elif data['abort'] == 1 and data['running'] == "Completed": @@ -73,9 +73,9 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed for: " + backup + ".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Restore Completed for: " + backup + ".\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n") writeToFile.close() break else: @@ -83,7 +83,7 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Waiting for restore to complete.\n") writeToFile.close() time.sleep(3) pass @@ -93,7 +93,7 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + "Could not start restore process for: " + backup + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + "Could not start restore process for: " + backup + "\n") writeToFile.close() writeToFile = open(backupLogPath, "a") @@ -101,7 +101,7 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backup Restore complete\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backup Restore complete\n") writeToFile.writelines("completed[success]") @@ -123,7 +123,7 @@ class remoteBackup: writeToFile.writelines("\n") writeToFile.writelines("############################\n") writeToFile.writelines(" Starting Backup Restore\n") - writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") + writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n") writeToFile.writelines("############################\n") writeToFile.writelines("\n") writeToFile.writelines("\n") @@ -172,9 +172,9 @@ class remoteBackup: def createBackup(virtualHost, ipAddress,writeToFile, dir): try: writeToFile.writelines("Location: "+dir + "\n") - writeToFile.writelines("["+time.strftime("%I-%M-%S-%a-%b-%Y")+"]"+" Preparing to create backup for: "+virtualHost+"\n") + writeToFile.writelines("["+time.strftime("%m.%d.%Y_%H-%M-%S")+"]"+" Preparing to create backup for: "+virtualHost+"\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backup started for: " + virtualHost + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backup started for: " + virtualHost + "\n") finalData = json.dumps({'websiteToBeBacked': virtualHost}) r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData,verify=False) @@ -191,16 +191,16 @@ class remoteBackup: break writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backup created for:" + virtualHost + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backup created for:" + virtualHost + "\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Preparing to send backup for: " + virtualHost +" to "+ipAddress+ "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Preparing to send backup for: " + virtualHost +" to "+ipAddress+ "\n") writeToFile.flush() remoteBackup.sendBackup(backupPath+".tar.gz", ipAddress,writeToFile, dir) writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backup for: " + virtualHost + " is sent to " + ipAddress + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backup for: " + virtualHost + " is sent to " + ipAddress + "\n") writeToFile.writelines("\n") writeToFile.writelines("\n") @@ -240,7 +240,7 @@ class remoteBackup: writeToFile = open(backupLogPath, "a") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Currently generating local backups for: " + virtualHost + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Currently generating local backups for: " + virtualHost + "\n") writeToFile.close() @@ -262,7 +262,7 @@ class remoteBackup: writeToFile = open(backupLogPath, "a") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for backup to complete.. " + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Waiting for backup to complete.. " + "\n") writeToFile.close() @@ -272,7 +272,7 @@ class remoteBackup: writeToFile = open(backupLogPath, "a") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Local Backup Completed for: " +virtualHost + " with status: "+ data['status'] +"\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Local Backup Completed for: " +virtualHost + " with status: "+ data['status'] +"\n") ## move the generated backup file to specified destination @@ -283,16 +283,16 @@ class remoteBackup: completedPathToSend = dir +"/" + completePathToBackupFile.split("/")[-1] writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Sending " + completedPathToSend +" to "+ipAddress +".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Sending " + completedPathToSend +" to "+ipAddress +".\n") remoteBackup.sendBackup(completedPathToSend,ipAddress,str(folderNumber),writeToFile) writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " #############################################" + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " #############################################" + "\n") writeToFile.close() break @@ -301,7 +301,7 @@ class remoteBackup: writeToFile = open(backupLogPath, "a") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n") writeToFile.close() ## removing local directory where backups were generated @@ -325,7 +325,7 @@ class remoteBackup: writeToFile.writelines("############################\n") writeToFile.writelines(" Starting remote Backup\n") - writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") + writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n") writeToFile.writelines("############################\n") writeToFile.writelines("\n") writeToFile.writelines("\n") @@ -335,14 +335,14 @@ class remoteBackup: checkConn = backupUtil.backupUtilities.checkConnection(ipAddress) if checkConn[0] == 0: writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting." + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting." + "\n") writeToFile.close() return [0, checkConn[1]] else: pass else: writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Host:" + ipAddress + " is down, aborting." + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Host:" + ipAddress + " is down, aborting." + "\n") writeToFile.close() return [0, "Remote server is not able to communicate with this server."] diff --git a/plogical/remoteTransferUtilities.py b/plogical/remoteTransferUtilities.py old mode 100755 new mode 100644 index 1536ed968..6d537a83e --- a/plogical/remoteTransferUtilities.py +++ b/plogical/remoteTransferUtilities.py @@ -74,7 +74,7 @@ class remoteTransferUtilities: writeToFile.writelines("############################\n") writeToFile.writelines(" Starting remote Backup\n") - writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") + writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n") writeToFile.writelines("############################\n") writeToFile.writelines("\n") writeToFile.writelines("\n") @@ -83,14 +83,14 @@ class remoteTransferUtilities: checkConn = backupUtil.backupUtilities.checkConnection(ipAddress) if checkConn[0] == 0: writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting. [5010]" + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting. [5010]" + "\n") writeToFile.close() return else: pass else: writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Host:" + ipAddress + " could be down, we are continuing..." + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Host:" + ipAddress + " could be down, we are continuing..." + "\n") writeToFile.close() writeToFile.close() @@ -133,7 +133,7 @@ class remoteTransferUtilities: writeToFile = open(backupLogPath, "a") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Currently generating local backups for: " + virtualHost + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Currently generating local backups for: " + virtualHost + "\n") writeToFile.close() retValue = backupSchedule.createLocalBackup(virtualHost, backupLogPath) @@ -141,7 +141,7 @@ class remoteTransferUtilities: if retValue[0] == 1: writeToFile = open(backupLogPath, 'a') writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Local Backup Completed for: " + virtualHost + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Local Backup Completed for: " + virtualHost + "\n") completePathToBackupFile = retValue[1] + '.tar.gz' @@ -153,20 +153,20 @@ class remoteTransferUtilities: completedPathToSend = dir + "/" + completePathToBackupFile.split("/")[-1] writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Sending " + completedPathToSend + " to " + ipAddress + ".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Sending " + completedPathToSend + " to " + ipAddress + ".\n") remoteTransferUtilities.sendBackup(completedPathToSend, ipAddress, str(folderNumber), writeToFile) writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " #############################################" + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " #############################################" + "\n") writeToFile.close() else: writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + "Failed to generate local backup for: " + virtualHost + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + "Failed to generate local backup for: " + virtualHost + "\n") except BaseException, msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [remoteTransferUtilities.backupProcess:173]") @@ -174,7 +174,7 @@ class remoteTransferUtilities: writeToFile = open(backupLogPath, "a") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n") writeToFile.close() ## removing local directory where backups were generated @@ -212,7 +212,7 @@ class remoteTransferUtilities: writeToFile.writelines("\n") writeToFile.writelines("############################\n") writeToFile.writelines(" Starting Backup Restore\n") - writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") + writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n") writeToFile.writelines("############################\n") writeToFile.writelines("\n") writeToFile.writelines("\n") @@ -258,7 +258,7 @@ class remoteTransferUtilities: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: " + backup + ".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Starting restore for: " + backup + ".\n") writeToFile.close() backupFile = backup @@ -282,9 +282,9 @@ class remoteTransferUtilities: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed for: " + backup + ".\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Restore Completed for: " + backup + ".\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n") writeToFile.close() break elif status.find("[5009]") > -1: @@ -296,10 +296,10 @@ class remoteTransferUtilities: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Restore aborted for: " + backup + ". Error message: " + + "%m.%d.%Y_%H-%M-%S") + "]" + " Restore aborted for: " + backup + ". Error message: " + status + "\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n") writeToFile.close() break else: @@ -307,7 +307,7 @@ class remoteTransferUtilities: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Waiting for restore to complete.\n") writeToFile.close() time.sleep(3) pass @@ -317,7 +317,7 @@ class remoteTransferUtilities: writeToFile.writelines("\n") writeToFile.writelines("\n") writeToFile.writelines("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "]" + " Backup Restore complete\n") + "%m.%d.%Y_%H-%M-%S") + "]" + " Backup Restore complete\n") writeToFile.writelines("completed[success]") except BaseException, msg: diff --git a/plogical/upgrade.py b/plogical/upgrade.py old mode 100755 new mode 100644 index 3615eb72b..df44d02f8 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -27,10 +27,10 @@ class Upgrade: def stdOut(message, do_exit=0): print("\n\n") print ("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") - print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n") + print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + message + "\n") print ("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") + "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n") if do_exit: os._exit(0) diff --git a/pluginInstaller/pluginInstaller.py b/pluginInstaller/pluginInstaller.py old mode 100755 new mode 100644 index ceb44d5f3..e79437ac5 --- a/pluginInstaller/pluginInstaller.py +++ b/pluginInstaller/pluginInstaller.py @@ -17,10 +17,10 @@ class pluginInstaller: def stdOut(message): print("\n\n") print ("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") - print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n") + print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + message + "\n") print ("[" + time.strftime( - "%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") + "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n") ### Functions Related to plugin installation. diff --git a/postfixSenderPolicy/accept_traffic.py b/postfixSenderPolicy/accept_traffic.py old mode 100755 new mode 100644 index 7986fdd5e..54aec3c94 --- a/postfixSenderPolicy/accept_traffic.py +++ b/postfixSenderPolicy/accept_traffic.py @@ -117,7 +117,7 @@ class HandleRequest(multi.Thread): else: email = EUsers.objects.get(email=emailAddress) if emailObj.logStatus == 1: - logEntry = EmailLogs(email=email, destination=destination, timeStamp=time.strftime("%I-%M-%S-%a-%b-%Y")) + logEntry = EmailLogs(email=email, destination=destination, timeStamp=time.strftime("%m.%d.%Y_%H-%M-%S")) logEntry.save() emailObj.monthlyUsed = emailObj.monthlyUsed + 1 emailObj.hourlyUsed = emailObj.hourlyUsed + 1 @@ -127,7 +127,7 @@ class HandleRequest(multi.Thread): email = EUsers.objects.get(email=emailAddress) if emailObj.logStatus == 1: logEntry = EmailLogs(email=email, destination=destination, - timeStamp=time.strftime("%I-%M-%S-%a-%b-%Y")) + timeStamp=time.strftime("%m.%d.%Y_%H-%M-%S")) logEntry.save() emailObj.monthlyUsed = emailObj.monthlyUsed + 1 diff --git a/s3Backups/s3Backups.py b/s3Backups/s3Backups.py old mode 100755 new mode 100644 index 45f203d68..6d8aa8f82 --- a/s3Backups/s3Backups.py +++ b/s3Backups/s3Backups.py @@ -424,9 +424,9 @@ class S3Backups(multi.Thread): ## /home/example.com/backup backupPath = os.path.join("/home", virtualHost, "backup/") domainUser = website.externalApp - backupName = 'backup-' + domainUser + "-" + time.strftime("%I-%M-%S-%a-%b-%Y") + backupName = 'backup-' + domainUser + "-" + time.strftime("%m.%d.%Y_%H-%M-%S") - ## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 + ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 tempStoragePath = os.path.join(backupPath, backupName) p = Process(target=backupUtil.submitBackupCreation,