mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-18 03:01:01 +01:00
bug fix: docker problem with csf: ref https://community.cyberpanel.net/t/docker-and-csf-problems/52284/2
This commit is contained in:
@@ -3,6 +3,8 @@ import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from random import randint
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
|
||||
try:
|
||||
@@ -44,6 +46,60 @@ class Docker_Sites(multi.Thread):
|
||||
except:
|
||||
pass
|
||||
|
||||
command = 'cat /etc/csf/csf.conf'
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if result.find('SECTION:Initial Settings') > -1:
|
||||
|
||||
from plogical.csf import CSF
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
currentSettings = CSF.fetchCSFSettings()
|
||||
|
||||
tcpIN = currentSettings['tcpIN']
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.writeToFile(f'TCPIN docker: {tcpIN}')
|
||||
|
||||
|
||||
|
||||
if tcpIN.find('8088') == -1:
|
||||
|
||||
ports = f'{tcpIN},8088'
|
||||
|
||||
portsPath = '/home/cyberpanel/' + str(randint(1000, 9999))
|
||||
|
||||
if os.path.exists(portsPath):
|
||||
os.remove(portsPath)
|
||||
|
||||
writeToFile = open(portsPath, 'w')
|
||||
writeToFile.write(ports)
|
||||
writeToFile.close()
|
||||
|
||||
execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||
execPath = execPath + f" modifyPorts --protocol TCP_IN --ports " + portsPath
|
||||
ProcessUtilities.executioner(execPath)
|
||||
|
||||
tcpOUT = currentSettings['tcpOUT']
|
||||
if tcpOUT.find('8088') == -1:
|
||||
|
||||
ports = f'{tcpOUT},8088'
|
||||
|
||||
portsPath = '/home/cyberpanel/' + str(randint(1000, 9999))
|
||||
|
||||
if os.path.exists(portsPath):
|
||||
os.remove(portsPath)
|
||||
|
||||
writeToFile = open(portsPath, 'w')
|
||||
writeToFile.write(ports)
|
||||
writeToFile.close()
|
||||
|
||||
execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||
execPath = execPath + f" modifyPorts --protocol TCP_OUT --ports " + portsPath
|
||||
ProcessUtilities.executioner(execPath)
|
||||
|
||||
|
||||
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
if self.function_run == 'DeployWPContainer':
|
||||
|
||||
Reference in New Issue
Block a user