Skip to content

Commit 53c5536

Browse files
committed
Update CSF to enable Webui port 1025
1 parent e671c5c commit 53c5536

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

plogical/csf.py

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,27 @@ def installCSF():
5959
command = 'bash install.sh'
6060
ProcessUtilities.normalExecutioner(command)
6161

62+
command = 'mv /etc/csf/ui/server.crt /etc/csf/ui/server.crt-bak'
63+
ProcessUtilities.normalExecutioner(command)
64+
65+
command = 'mv /etc/csf/ui/server.key /etc/csf/ui/server.key-bak'
66+
ProcessUtilities.normalExecutioner(command)
67+
68+
command = 'ln -s /usr/local/lscp/conf/cert.pem /etc/csf/ui/server.crt'
69+
ProcessUtilities.normalExecutioner(command)
70+
71+
command = 'ln -s /usr/local/lscp/conf/key.pem /etc/csf/ui/server.key'
72+
ProcessUtilities.normalExecutioner(command)
73+
6274
# install required packages for CSF perl and /usr/bin/host
6375
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
6476
command = 'yum install bind-utils perl-libwww-perl net-tools perl-LWP-Protocol-https -y'
6577
ProcessUtilities.normalExecutioner(command)
6678
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
6779
command = 'apt-get install dnsutils libwww-perl net-tools -y'
6880
ProcessUtilities.normalExecutioner(command)
81+
command = 'ln -s /bin/systemctl /usr/bin/systemctl'
82+
ProcessUtilities.normalExecutioner(command)
6983
else:
7084

7185
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath,
@@ -79,14 +93,16 @@ def installCSF():
7993
for items in data:
8094
if items.find('TCP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'):
8195
writeToConf.writelines(
82-
'TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,7080,8090,40110:40210"\n')
96+
'TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,1025,7080,8090,40110:40210"\n')
8397
elif items.find('TCP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'):
84-
writeToConf.writelines('TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,8090,40110:40210"\n')
98+
writeToConf.writelines('TCP_OUT = "20,21,22,25,43,53,80,110,113,443,587,993,995,8090,40110:40210"\n')
8599
elif items.find('UDP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'):
86100
writeToConf.writelines('UDP_IN = "20,21,53"\n')
87101
elif items.find('UDP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'):
88102
writeToConf.writelines('UDP_OUT = "20,21,53,113,123"\n')
89-
# setting RESTRICT_SYSLOG to "3" for use with option RESTRICT_SYSLOG_GROUP
103+
elif items.find('TESTING =') > -1 and items.find('=') > -1 and (items[0] != '#'):
104+
writeToConf.writelines('TESTING = "0"\n')
105+
# setting RESTRICT_SYSLOG to "3" for use with option RESTRICT_SYSLOG_GROUP
90106
elif items.find('RESTRICT_SYSLOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
91107
writeToConf.writelines('RESTRICT_SYSLOG = "3"\n')
92108

@@ -266,6 +282,18 @@ def installCSF():
266282
# HTACCESS_LOG is ins main error.log
267283
elif items.find('HTACCESS_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
268284
writeToConf.writelines('HTACCESS_LOG = "/usr/local/lsws/logs/error.log"\n')
285+
286+
# CSF UI enable
287+
elif items.find('UI = "0"') > -1 and items.find('=') > -1 and (items[0] != '#'):
288+
writeToConf.writelines('UI = "1"\n')
289+
elif items.find('UI_ALLOW') > -1 and items.find('=') > -1 and (items[0] != '#'):
290+
writeToConf.writelines('UI_ALLOW = "0"\n')
291+
elif items.find('UI_PORT =') > -1 and items.find('=') > -1 and (items[0] != '#'):
292+
writeToConf.writelines('UI_PORT = "1025"\n')
293+
elif items.find('UI_USER') > -1 and items.find('=') > -1 and (items[0] != '#'):
294+
writeToConf.writelines('UI_USER = "cyberpanel"\n')
295+
elif items.find('UI_PASS') > -1 and items.find('=') > -1 and (items[0] != '#'):
296+
writeToConf.writelines('UI_PASS = "csfadmin1234567"\n')
269297
else:
270298
writeToConf.writelines(items)
271299

@@ -303,6 +331,12 @@ def installCSF():
303331
command = 'csf -s'
304332
ProcessUtilities.normalExecutioner(command)
305333

334+
command = 'sleep 5'
335+
ProcessUtilities.normalExecutioner(command)
336+
337+
command = 'csf -ra'
338+
ProcessUtilities.normalExecutioner(command)
339+
306340
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'CSF successfully Installed.[200]\n', 1)
307341

308342
try:

0 commit comments

Comments
 (0)