Fixed serverLogs pages for Maillog and FTP logs for Ubuntu. Fixed CSF bug for Ubuntu.
This commit is contained in:
parent
164c6cddd4
commit
e671c5c53e
|
|
@ -64,7 +64,7 @@ class CSF(multi.Thread):
|
|||
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'
|
||||
command = 'apt-get install dnsutils libwww-perl net-tools -y'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
else:
|
||||
|
||||
|
|
@ -266,7 +266,19 @@ class CSF(multi.Thread):
|
|||
# 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:
|
||||
else:
|
||||
writeToConf.writelines(items)
|
||||
|
||||
writeToConf.close()
|
||||
|
||||
##
|
||||
|
||||
# Some Ubuntu initial configurations
|
||||
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
|
||||
data = open('/etc/csf/csf.conf', 'r').readlines()
|
||||
writeToConf = open('/etc/csf/csf.conf', 'w')
|
||||
|
||||
for items in data:
|
||||
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] != '#'):
|
||||
|
|
@ -277,14 +289,16 @@ class CSF(multi.Thread):
|
|||
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)
|
||||
else:
|
||||
writeToConf.writelines(items)
|
||||
writeToConf.close()
|
||||
|
||||
writeToConf.close()
|
||||
##
|
||||
|
||||
##
|
||||
|
||||
command = 'csf -s'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
|
@ -495,19 +509,11 @@ class CSF(multi.Thread):
|
|||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[blockIP]")
|
||||
|
||||
@staticmethod
|
||||
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 CSF.run_command(command):
|
||||
print(line)
|
||||
command = 'sudo csf -g ' + ipAddress
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIP]")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import shlex
|
|||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.acl import ACLManager
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
import os
|
||||
# Create your views here.
|
||||
|
||||
|
||||
|
|
@ -130,9 +131,15 @@ def getLogsFromFile(request):
|
|||
elif type == "error":
|
||||
fileName = installUtilities.Server_root_path + "/logs/error.log"
|
||||
elif type == "email":
|
||||
fileName = "/var/log/maillog"
|
||||
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||
fileName = "/var/log/maillog"
|
||||
else:
|
||||
fileName = "/var/log/mail.log"
|
||||
elif type == "ftp":
|
||||
fileName = "/var/log/messages"
|
||||
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||
fileName = "/var/log/messages"
|
||||
else:
|
||||
fileName = "/var/log/syslog"
|
||||
elif type == "modSec":
|
||||
fileName = "/usr/local/lsws/logs/auditmodsec.log"
|
||||
elif type == "cyberpanel":
|
||||
|
|
@ -195,4 +202,4 @@ def clearLogFile(request):
|
|||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
data_ret = {'cleanStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
return HttpResponse(json_data)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
## Script to clear caches after static file changes. Useful for development and testing.
|
||||
## All credit belongs to Usman Nasir
|
||||
## To use make it executable
|
||||
## chmod +x /usr/local/CyberCP/upgrade.sh
|
||||
## Then run it like below.
|
||||
## /usr/local/CyberCP/upgrade.sh
|
||||
|
||||
cd /usr/local/CyberCP && python manage.py collectstatic --no-input
|
||||
rm -rf /usr/local/CyberCP/public/static/*
|
||||
cp -R /usr/local/CyberCP/static/* /usr/local/CyberCP/public/static/
|
||||
find /usr/local/CyberCP -type d -exec chmod 0755 {} \;
|
||||
find /usr/local/CyberCP -type f -exec chmod 0644 {} \;
|
||||
chmod -R 755 /usr/local/CyberCP/bin
|
||||
chown -R root:root /usr/local/CyberCP
|
||||
chown -R lscpd:lscpd /usr/local/CyberCP/public/phpmyadmin/tmp
|
||||
systemctl restart lscpd
|
||||
Loading…
Reference in New Issue