mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-12-22 16:29:45 +01:00
This commit is contained in:
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@@ -6,6 +6,12 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="5251c5c9-f2a1-41f2-bc76-10b517091df1" name="Changes" comment="">
|
<list default="true" id="5251c5c9-f2a1-41f2-bc76-10b517091df1" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/loginSystem/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/loginSystem/views.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/plogical/adminPass.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/adminPass.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/plogical/customACME.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/customACME.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/plogical/sslUtilities.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/sslUtilities.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/plogical/sslv2.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/sslv2.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/websiteFunctions/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/websiteFunctions/views.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -48,7 +54,7 @@
|
|||||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"SHELLCHECK.PATH": "/Users/cyberpersons/Library/Application Support/JetBrains/PyCharm2025.1/plugins/Shell Script/shellcheck",
|
"SHELLCHECK.PATH": "/Users/cyberpersons/Library/Application Support/JetBrains/PyCharm2025.1/plugins/Shell Script/shellcheck",
|
||||||
"git-widget-placeholder": "stable",
|
"git-widget-placeholder": "v2.4.3",
|
||||||
"last_opened_file_path": "/Users/cyberpersons/cyberpanel",
|
"last_opened_file_path": "/Users/cyberpersons/cyberpanel",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
@@ -117,6 +123,7 @@
|
|||||||
<workItem from="1754429757112" duration="3503000" />
|
<workItem from="1754429757112" duration="3503000" />
|
||||||
<workItem from="1754433799097" duration="517000" />
|
<workItem from="1754433799097" duration="517000" />
|
||||||
<workItem from="1754448353513" duration="2970000" />
|
<workItem from="1754448353513" duration="2970000" />
|
||||||
|
<workItem from="1754511414251" duration="12135000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ def loadLoginPage(request):
|
|||||||
|
|
||||||
token = hashPassword.generateToken('admin', '1234567')
|
token = hashPassword.generateToken('admin', '1234567')
|
||||||
|
|
||||||
email = 'example@example.org'
|
email = 'admin@cyberpanel.net'
|
||||||
admin = Administrator(userName="admin", password=password, type=1, email=email,
|
admin = Administrator(userName="admin", password=password, type=1, email=email,
|
||||||
firstName="Cyber", lastName="Panel", acl=acl, token=token)
|
firstName="Cyber", lastName="Panel", acl=acl, token=token)
|
||||||
admin.save()
|
admin.save()
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ def main():
|
|||||||
acl = ACL.objects.get(name='admin')
|
acl = ACL.objects.get(name='admin')
|
||||||
token = hashPassword.generateToken('admin', adminPass)
|
token = hashPassword.generateToken('admin', adminPass)
|
||||||
|
|
||||||
email = 'example@example.org'
|
email = 'admin@cyberpanel.net'
|
||||||
admin = Administrator(userName="admin", password=hashPassword.hash_password(adminPass), type=1, email=email,
|
admin = Administrator(userName="admin", password=hashPassword.hash_password(adminPass), type=1, email=email,
|
||||||
firstName="Cyber", lastName="Panel", acl=acl, token=token)
|
firstName="Cyber", lastName="Panel", acl=acl, token=token)
|
||||||
admin.save()
|
admin.save()
|
||||||
|
|||||||
@@ -17,10 +17,12 @@ from plogical import CyberCPLogFileWriter as logging
|
|||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
|
||||||
class CustomACME:
|
class CustomACME:
|
||||||
def __init__(self, domain, admin_email, staging=False, provider='letsencrypt'):
|
def __init__(self, domain, admin_email, staging=False, provider='letsencrypt'):
|
||||||
"""Initialize CustomACME"""
|
"""Initialize CustomACME"""
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Initializing CustomACME for domain: {domain}, email: {admin_email}, staging: {staging}, provider: {provider}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Initializing CustomACME for domain: {domain}, email: {admin_email}, staging: {staging}, provider: {provider}')
|
||||||
self.domain = domain
|
self.domain = domain
|
||||||
self.admin_email = admin_email
|
self.admin_email = admin_email
|
||||||
self.staging = staging
|
self.staging = staging
|
||||||
@@ -55,7 +57,8 @@ class CustomACME:
|
|||||||
self.cert_path = f'/etc/letsencrypt/live/{domain}'
|
self.cert_path = f'/etc/letsencrypt/live/{domain}'
|
||||||
self.challenge_path = '/usr/local/lsws/Example/html/.well-known/acme-challenge'
|
self.challenge_path = '/usr/local/lsws/Example/html/.well-known/acme-challenge'
|
||||||
self.account_key_path = f'/etc/letsencrypt/accounts/{domain}.key'
|
self.account_key_path = f'/etc/letsencrypt/accounts/{domain}.key'
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Certificate path: {self.cert_path}, Challenge path: {self.challenge_path}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Certificate path: {self.cert_path}, Challenge path: {self.challenge_path}')
|
||||||
|
|
||||||
# Create accounts directory if it doesn't exist
|
# Create accounts directory if it doesn't exist
|
||||||
os.makedirs('/etc/letsencrypt/accounts', exist_ok=True)
|
os.makedirs('/etc/letsencrypt/accounts', exist_ok=True)
|
||||||
@@ -82,7 +85,8 @@ class CustomACME:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(f'Fetching ACME directory from {self.acme_directory}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Fetching ACME directory from {self.acme_directory}')
|
||||||
response = requests.get(self.acme_directory)
|
response = requests.get(self.acme_directory)
|
||||||
self.directory = response.json()
|
self.directory = response.json()
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Successfully fetched ACME directory: {json.dumps(self.directory)}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Successfully fetched ACME directory: {json.dumps(self.directory)}')
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Error getting directory: {str(e)}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Error getting directory: {str(e)}')
|
||||||
@@ -197,13 +201,10 @@ class CustomACME:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile('Creating final JWS...')
|
logging.CyberCPLogFileWriter.writeToFile('Creating final JWS...')
|
||||||
jws = {
|
jws = {
|
||||||
"protected": protected_b64,
|
"protected": protected_b64,
|
||||||
|
"payload": payload_b64, # Always include payload field, even if empty
|
||||||
"signature": signature_b64
|
"signature": signature_b64
|
||||||
}
|
}
|
||||||
|
|
||||||
# Only add payload if it exists
|
|
||||||
if payload is not None:
|
|
||||||
jws["payload"] = payload_b64
|
|
||||||
|
|
||||||
# Ensure the JWS is properly formatted
|
# Ensure the JWS is properly formatted
|
||||||
jws_str = json.dumps(jws, separators=(',', ':'))
|
jws_str = json.dumps(jws, separators=(',', ':'))
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Final JWS: {jws_str}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Final JWS: {jws_str}')
|
||||||
@@ -259,14 +260,17 @@ class CustomACME:
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check if External Account Binding is required (for ZeroSSL)
|
# Check if External Account Binding is required (for ZeroSSL)
|
||||||
if self.provider == 'zerossl' and 'meta' in self.directory and 'externalAccountRequired' in self.directory['meta']:
|
if self.provider == 'zerossl' and 'meta' in self.directory and 'externalAccountRequired' in self.directory[
|
||||||
|
'meta']:
|
||||||
if self.directory['meta']['externalAccountRequired']:
|
if self.directory['meta']['externalAccountRequired']:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('ZeroSSL requires External Account Binding, getting EAB credentials...')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
'ZeroSSL requires External Account Binding, getting EAB credentials...')
|
||||||
|
|
||||||
# Get EAB credentials from ZeroSSL
|
# Get EAB credentials from ZeroSSL
|
||||||
eab_kid, eab_hmac_key = self._get_zerossl_eab_credentials()
|
eab_kid, eab_hmac_key = self._get_zerossl_eab_credentials()
|
||||||
if not eab_kid or not eab_hmac_key:
|
if not eab_kid or not eab_hmac_key:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Failed to get ZeroSSL EAB credentials, falling back to Let\'s Encrypt')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
'Failed to get ZeroSSL EAB credentials, falling back to Let\'s Encrypt')
|
||||||
# Fallback to Let's Encrypt
|
# Fallback to Let's Encrypt
|
||||||
self.provider = 'letsencrypt'
|
self.provider = 'letsencrypt'
|
||||||
self.acme_directory = "https://acme-v02.api.letsencrypt.org/directory"
|
self.acme_directory = "https://acme-v02.api.letsencrypt.org/directory"
|
||||||
@@ -294,12 +298,14 @@ class CustomACME:
|
|||||||
|
|
||||||
if response.status_code == 201:
|
if response.status_code == 201:
|
||||||
self.account_url = response.headers['Location']
|
self.account_url = response.headers['Location']
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Successfully created account. Account URL: {self.account_url}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Successfully created account. Account URL: {self.account_url}')
|
||||||
# Save the account key for future use
|
# Save the account key for future use
|
||||||
self._save_account_key()
|
self._save_account_key()
|
||||||
return True
|
return True
|
||||||
elif response.status_code == 429:
|
elif response.status_code == 429:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Rate limit hit for account creation. Using staging environment...')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
'Rate limit hit for account creation. Using staging environment...')
|
||||||
self.staging = True
|
self.staging = True
|
||||||
self.acme_directory = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
self.acme_directory = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||||
# Get new directory and nonce for staging
|
# Get new directory and nonce for staging
|
||||||
@@ -645,17 +651,20 @@ class CustomACME:
|
|||||||
order_status = response.json().get('status')
|
order_status = response.json().get('status')
|
||||||
if order_status == 'valid':
|
if order_status == 'valid':
|
||||||
self.certificate_url = response.json().get('certificate')
|
self.certificate_url = response.json().get('certificate')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Successfully finalized order. Certificate URL: {self.certificate_url}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Successfully finalized order. Certificate URL: {self.certificate_url}')
|
||||||
return True
|
return True
|
||||||
elif order_status == 'invalid':
|
elif order_status == 'invalid':
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Order validation failed')
|
logging.CyberCPLogFileWriter.writeToFile('Order validation failed')
|
||||||
return False
|
return False
|
||||||
elif order_status == 'processing':
|
elif order_status == 'processing':
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Order still processing, attempt {attempt + 1}/{max_attempts}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Order still processing, attempt {attempt + 1}/{max_attempts}')
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Order status check failed, attempt {attempt + 1}/{max_attempts}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Order status check failed, attempt {attempt + 1}/{max_attempts}')
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Order processing timed out')
|
logging.CyberCPLogFileWriter.writeToFile('Order processing timed out')
|
||||||
@@ -671,15 +680,30 @@ class CustomACME:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile('Downloading certificate...')
|
logging.CyberCPLogFileWriter.writeToFile('Downloading certificate...')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Certificate URL: {self.certificate_url}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Certificate URL: {self.certificate_url}')
|
||||||
|
|
||||||
# For certificate downloads, we can use a simple GET request
|
# Get a fresh nonce for the request
|
||||||
response = requests.get(self.certificate_url)
|
if not self._get_nonce():
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile('Failed to get nonce for certificate download')
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Use POST-as-GET for certificate download (ACME v2 requirement)
|
||||||
|
jws = self._create_jws(None, self.certificate_url)
|
||||||
|
if not jws:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile('Failed to create JWS for certificate download')
|
||||||
|
return None
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'Content-Type': 'application/jose+json'
|
||||||
|
}
|
||||||
|
response = requests.post(self.certificate_url, data=jws, headers=headers)
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Certificate download response status: {response.status_code}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Certificate download response status: {response.status_code}')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Certificate download response headers: {response.headers}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Certificate download response headers: {response.headers}')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Certificate download response content: {response.text}')
|
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Successfully downloaded certificate')
|
logging.CyberCPLogFileWriter.writeToFile('Successfully downloaded certificate')
|
||||||
return response.content
|
# The response should be the PEM-encoded certificate chain
|
||||||
|
return response.text.encode('utf-8') if isinstance(response.text, str) else response.content
|
||||||
|
else:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(f'Certificate download failed: {response.text}')
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Error downloading certificate: {str(e)}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Error downloading certificate: {str(e)}')
|
||||||
@@ -715,7 +739,8 @@ class CustomACME:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile('Challenge validation failed')
|
logging.CyberCPLogFileWriter.writeToFile('Challenge validation failed')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Challenge still pending, attempt {attempt + 1}/{max_attempts}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Challenge still pending, attempt {attempt + 1}/{max_attempts}')
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Challenge validation timed out')
|
logging.CyberCPLogFileWriter.writeToFile('Challenge validation timed out')
|
||||||
@@ -876,11 +901,13 @@ class CustomACME:
|
|||||||
logging.CyberCPLogFileWriter.writeToFile('Order validation failed')
|
logging.CyberCPLogFileWriter.writeToFile('Order validation failed')
|
||||||
return False
|
return False
|
||||||
elif order_status == 'processing':
|
elif order_status == 'processing':
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Order still processing, attempt {attempt + 1}/{max_attempts}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Order still processing, attempt {attempt + 1}/{max_attempts}')
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Order status check failed, attempt {attempt + 1}/{max_attempts}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Order status check failed, attempt {attempt + 1}/{max_attempts}')
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Order processing timed out')
|
logging.CyberCPLogFileWriter.writeToFile('Order processing timed out')
|
||||||
@@ -892,7 +919,8 @@ class CustomACME:
|
|||||||
def issue_certificate(self, domains, use_dns=False):
|
def issue_certificate(self, domains, use_dns=False):
|
||||||
"""Main method to issue certificate"""
|
"""Main method to issue certificate"""
|
||||||
try:
|
try:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Starting certificate issuance for domains: {domains}, use_dns: {use_dns}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Starting certificate issuance for domains: {domains}, use_dns: {use_dns}')
|
||||||
|
|
||||||
# Try to load existing account key first
|
# Try to load existing account key first
|
||||||
if self._load_account_key():
|
if self._load_account_key():
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import shlex
|
|||||||
import subprocess
|
import subprocess
|
||||||
import socket
|
import socket
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from websiteFunctions.models import ChildDomains, Websites
|
from websiteFunctions.models import ChildDomains, Websites
|
||||||
except:
|
except:
|
||||||
@@ -14,7 +15,6 @@ from plogical.acl import ACLManager
|
|||||||
|
|
||||||
|
|
||||||
class sslUtilities:
|
class sslUtilities:
|
||||||
|
|
||||||
Server_root = "/usr/local/lsws"
|
Server_root = "/usr/local/lsws"
|
||||||
redisConf = '/usr/local/lsws/conf/dvhost_redis.conf'
|
redisConf = '/usr/local/lsws/conf/dvhost_redis.conf'
|
||||||
|
|
||||||
@@ -108,7 +108,8 @@ class sslUtilities:
|
|||||||
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Fallback for Python < 3.7
|
# Fallback for Python < 3.7
|
||||||
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
|
||||||
# If there's any output, the domain has A records
|
# If there's any output, the domain has A records
|
||||||
if result.stdout.strip():
|
if result.stdout.strip():
|
||||||
@@ -120,7 +121,8 @@ class sslUtilities:
|
|||||||
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Fallback for Python < 3.7
|
# Fallback for Python < 3.7
|
||||||
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
|
||||||
if result.stdout.strip():
|
if result.stdout.strip():
|
||||||
return True
|
return True
|
||||||
@@ -164,7 +166,6 @@ class sslUtilities:
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return 0, str(msg)
|
return 0, str(msg)
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def CheckIfSSLNeedsToBeIssued(virtualHostName):
|
def CheckIfSSLNeedsToBeIssued(virtualHostName):
|
||||||
#### if website already have an SSL, better not issue again - need to check for wild-card
|
#### if website already have an SSL, better not issue again - need to check for wild-card
|
||||||
@@ -177,7 +178,6 @@ class sslUtilities:
|
|||||||
if os.path.exists(ProcessUtilities.debugPath):
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'SSL provider for {virtualHostName} is {SSLProvider}.')
|
logging.CyberCPLogFileWriter.writeToFile(f'SSL provider for {virtualHostName} is {SSLProvider}.')
|
||||||
|
|
||||||
|
|
||||||
#### totally seprate check to see if both non-www and www are covered
|
#### totally seprate check to see if both non-www and www are covered
|
||||||
|
|
||||||
if SSLProvider == "(STAGING) Let's Encrypt":
|
if SSLProvider == "(STAGING) Let's Encrypt":
|
||||||
@@ -189,7 +189,8 @@ class sslUtilities:
|
|||||||
if len(domains) > 1:
|
if len(domains) > 1:
|
||||||
### need further checks here to see if ssl is valid for less then 15 days etc
|
### need further checks here to see if ssl is valid for less then 15 days etc
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
'[CheckIfSSLNeedsToBeIssued] SSL exists for %s and both versions are covered, just need to ensure if SSL is valid for less then 15 days.' % (virtualHostName), 0)
|
'[CheckIfSSLNeedsToBeIssued] SSL exists for %s and both versions are covered, just need to ensure if SSL is valid for less then 15 days.' % (
|
||||||
|
virtualHostName), 0)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return sslUtilities.ISSUE_SSL
|
return sslUtilities.ISSUE_SSL
|
||||||
@@ -261,7 +262,6 @@ class sslUtilities:
|
|||||||
return str(msg)
|
return str(msg)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def checkSSLIPv6Listener():
|
def checkSSLIPv6Listener():
|
||||||
try:
|
try:
|
||||||
@@ -271,7 +271,8 @@ class sslUtilities:
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [IO Error with main config file [checkSSLIPv6Listener]]")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
str(msg) + " [IO Error with main config file [checkSSLIPv6Listener]]")
|
||||||
return str(msg)
|
return str(msg)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -350,7 +351,8 @@ class sslUtilities:
|
|||||||
# If conflicts found, log them and return
|
# If conflicts found, log them and return
|
||||||
if conflicts:
|
if conflicts:
|
||||||
conflict_message = 'Configuration conflicts found: ' + '; '.join(conflicts)
|
conflict_message = 'Configuration conflicts found: ' + '; '.join(conflicts)
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Configuration conflicts for {virtualHostName}: {conflict_message}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Configuration conflicts for {virtualHostName}: {conflict_message}')
|
||||||
return 0, conflict_message
|
return 0, conflict_message
|
||||||
|
|
||||||
# Create challenge directory if it doesn't exist
|
# Create challenge directory if it doesn't exist
|
||||||
@@ -397,7 +399,8 @@ context /.well-known/acme-challenge {
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
f.write(line)
|
f.write(line)
|
||||||
if line.find('DocumentRoot /home/') > -1 and check == 0:
|
if line.find('DocumentRoot /home/') > -1 and check == 0:
|
||||||
f.write(' Alias /.well-known/acme-challenge /usr/local/lsws/Example/html/.well-known/acme-challenge\n')
|
f.write(
|
||||||
|
' Alias /.well-known/acme-challenge /usr/local/lsws/Example/html/.well-known/acme-challenge\n')
|
||||||
check = 1
|
check = 1
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Error writing Apache configuration: {str(e)}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Error writing Apache configuration: {str(e)}')
|
||||||
@@ -407,7 +410,8 @@ context /.well-known/acme-challenge {
|
|||||||
try:
|
try:
|
||||||
from plogical import installUtilities
|
from plogical import installUtilities
|
||||||
installUtilities.installUtilities.reStartLiteSpeed()
|
installUtilities.installUtilities.reStartLiteSpeed()
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Successfully configured ACME challenge for {virtualHostName}')
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f'Successfully configured ACME challenge for {virtualHostName}')
|
||||||
return 1, 'Successfully configured ACME challenge'
|
return 1, 'Successfully configured ACME challenge'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f'Error restarting LiteSpeed: {str(e)}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Error restarting LiteSpeed: {str(e)}')
|
||||||
@@ -418,7 +422,7 @@ context /.well-known/acme-challenge {
|
|||||||
return 0, f'Unexpected error: {str(e)}'
|
return 0, f'Unexpected error: {str(e)}'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def installSSLForDomain(virtualHostName, adminEmail='example@example.org'):
|
def installSSLForDomain(virtualHostName, adminEmail='domain@cyberpanel.net'):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
website = Websites.objects.get(domain=virtualHostName)
|
website = Websites.objects.get(domain=virtualHostName)
|
||||||
@@ -674,6 +678,14 @@ context /.well-known/acme-challenge {
|
|||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
# Replace example.org emails with domain-specific email
|
||||||
|
if adminEmail and ('example.org' in adminEmail or 'example.com' in adminEmail):
|
||||||
|
import re
|
||||||
|
# Remove special characters and create domain-based email
|
||||||
|
clean_domain = re.sub(r'[^a-zA-Z0-9]', '', virtualHostName)
|
||||||
|
adminEmail = f'{clean_domain}@cyberpanel.net'
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(f'Replacing invalid email with {adminEmail}')
|
||||||
|
|
||||||
Status = 1
|
Status = 1
|
||||||
|
|
||||||
if sslUtilities.CheckIfSSLNeedsToBeIssued(virtualHostName) == sslUtilities.ISSUE_SSL:
|
if sslUtilities.CheckIfSSLNeedsToBeIssued(virtualHostName) == sslUtilities.ISSUE_SSL:
|
||||||
@@ -700,18 +712,22 @@ context /.well-known/acme-challenge {
|
|||||||
# Check if www subdomain has DNS records before adding it (skip for hostnames)
|
# Check if www subdomain has DNS records before adding it (skip for hostnames)
|
||||||
if not isHostname and sslUtilities.checkDNSRecords(f'www.{virtualHostName}'):
|
if not isHostname and sslUtilities.checkDNSRecords(f'www.{virtualHostName}'):
|
||||||
domains.append(f'www.{virtualHostName}')
|
domains.append(f'www.{virtualHostName}')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{virtualHostName} has DNS records, including in SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{virtualHostName} has DNS records, including in SSL request")
|
||||||
elif not isHostname:
|
elif not isHostname:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{virtualHostName} has no DNS records, excluding from SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{virtualHostName} has no DNS records, excluding from SSL request")
|
||||||
|
|
||||||
if aliasDomain:
|
if aliasDomain:
|
||||||
domains.append(aliasDomain)
|
domains.append(aliasDomain)
|
||||||
# Check if www.aliasDomain has DNS records
|
# Check if www.aliasDomain has DNS records
|
||||||
if sslUtilities.checkDNSRecords(f'www.{aliasDomain}'):
|
if sslUtilities.checkDNSRecords(f'www.{aliasDomain}'):
|
||||||
domains.append(f'www.{aliasDomain}')
|
domains.append(f'www.{aliasDomain}')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{aliasDomain} has DNS records, including in SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{aliasDomain} has DNS records, including in SSL request")
|
||||||
else:
|
else:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{aliasDomain} has no DNS records, excluding from SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{aliasDomain} has no DNS records, excluding from SSL request")
|
||||||
|
|
||||||
# Check if Cloudflare is used
|
# Check if Cloudflare is used
|
||||||
use_dns = False
|
use_dns = False
|
||||||
@@ -750,18 +766,22 @@ context /.well-known/acme-challenge {
|
|||||||
# Check if www subdomain has DNS records before adding it (skip for hostnames)
|
# Check if www subdomain has DNS records before adding it (skip for hostnames)
|
||||||
if not isHostname and sslUtilities.checkDNSRecords(f'www.{virtualHostName}'):
|
if not isHostname and sslUtilities.checkDNSRecords(f'www.{virtualHostName}'):
|
||||||
domains.append(f'www.{virtualHostName}')
|
domains.append(f'www.{virtualHostName}')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{virtualHostName} has DNS records, including in SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{virtualHostName} has DNS records, including in SSL request")
|
||||||
elif not isHostname:
|
elif not isHostname:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{virtualHostName} has no DNS records, excluding from SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{virtualHostName} has no DNS records, excluding from SSL request")
|
||||||
|
|
||||||
if aliasDomain:
|
if aliasDomain:
|
||||||
domains.append(aliasDomain)
|
domains.append(aliasDomain)
|
||||||
# Check if www.aliasDomain has DNS records
|
# Check if www.aliasDomain has DNS records
|
||||||
if sslUtilities.checkDNSRecords(f'www.{aliasDomain}'):
|
if sslUtilities.checkDNSRecords(f'www.{aliasDomain}'):
|
||||||
domains.append(f'www.{aliasDomain}')
|
domains.append(f'www.{aliasDomain}')
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{aliasDomain} has DNS records, including in SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{aliasDomain} has DNS records, including in SSL request")
|
||||||
else:
|
else:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{aliasDomain} has no DNS records, excluding from SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{aliasDomain} has no DNS records, excluding from SSL request")
|
||||||
|
|
||||||
acme = CustomACME(virtualHostName, adminEmail, staging=False, provider='zerossl')
|
acme = CustomACME(virtualHostName, adminEmail, staging=False, provider='zerossl')
|
||||||
if acme.issue_certificate(domains, use_dns=use_dns):
|
if acme.issue_certificate(domains, use_dns=use_dns):
|
||||||
@@ -794,9 +814,11 @@ context /.well-known/acme-challenge {
|
|||||||
# Check if www subdomain has DNS records (skip for hostnames)
|
# Check if www subdomain has DNS records (skip for hostnames)
|
||||||
if not isHostname and sslUtilities.checkDNSRecords(f'www.{virtualHostName}'):
|
if not isHostname and sslUtilities.checkDNSRecords(f'www.{virtualHostName}'):
|
||||||
domain_list += " -d www." + virtualHostName
|
domain_list += " -d www." + virtualHostName
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{virtualHostName} has DNS records, including in acme.sh SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{virtualHostName} has DNS records, including in acme.sh SSL request")
|
||||||
elif not isHostname:
|
elif not isHostname:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"www.{virtualHostName} has no DNS records, excluding from acme.sh SSL request")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"www.{virtualHostName} has no DNS records, excluding from acme.sh SSL request")
|
||||||
|
|
||||||
command = acmePath + " --issue" + domain_list \
|
command = acmePath + " --issue" + domain_list \
|
||||||
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
||||||
@@ -807,7 +829,8 @@ context /.well-known/acme-challenge {
|
|||||||
result = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
|
result = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Fallback for Python < 3.7
|
# Fallback for Python < 3.7
|
||||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True, shell=True)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
command = acmePath + " --issue" + domain_list \
|
command = acmePath + " --issue" + domain_list \
|
||||||
@@ -819,7 +842,8 @@ context /.well-known/acme-challenge {
|
|||||||
result = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
|
result = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Fallback for Python < 3.7
|
# Fallback for Python < 3.7
|
||||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True, shell=True)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
@@ -860,7 +884,8 @@ context /.well-known/acme-challenge {
|
|||||||
result = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
|
result = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Fallback for Python < 3.7
|
# Fallback for Python < 3.7
|
||||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True, shell=True)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
return 1
|
return 1
|
||||||
@@ -910,7 +935,8 @@ def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain=None, isHostname=
|
|||||||
|
|
||||||
# For expired certificates, use --issue --force instead of --renew
|
# For expired certificates, use --issue --force instead of --renew
|
||||||
if is_expired:
|
if is_expired:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"Certificate is expired, using --issue --force for {domain}")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
f"Certificate is expired, using --issue --force for {domain}")
|
||||||
command = f'{acmePath} --issue {renewal_domains} --webroot /usr/local/lsws/Example/html --force'
|
command = f'{acmePath} --issue {renewal_domains} --webroot /usr/local/lsws/Example/html --force'
|
||||||
else:
|
else:
|
||||||
# Try to renew with explicit webroot
|
# Try to renew with explicit webroot
|
||||||
@@ -920,7 +946,8 @@ def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain=None, isHostname=
|
|||||||
result = subprocess.run(command, capture_output=True, text=True, shell=True)
|
result = subprocess.run(command, capture_output=True, text=True, shell=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Fallback for Python < 3.7
|
# Fallback for Python < 3.7
|
||||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True, shell=True)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(f"Successfully renewed SSL for {domain}")
|
logging.CyberCPLogFileWriter.writeToFile(f"Successfully renewed SSL for {domain}")
|
||||||
@@ -948,13 +975,16 @@ def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain=None, isHostname=
|
|||||||
|
|
||||||
if os.path.exists(pathToStoreSSLFullChain):
|
if os.path.exists(pathToStoreSSLFullChain):
|
||||||
import OpenSSL
|
import OpenSSL
|
||||||
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, open(pathToStoreSSLFullChain, 'r').read())
|
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
|
||||||
|
open(pathToStoreSSLFullChain, 'r').read())
|
||||||
SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8')
|
SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8')
|
||||||
|
|
||||||
if SSLProvider != 'Denial':
|
if SSLProvider != 'Denial':
|
||||||
if sslUtilities.installSSLForDomain(domain) == 1:
|
if sslUtilities.installSSLForDomain(domain) == 1:
|
||||||
logging.CyberCPLogFileWriter.writeToFile("We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www).")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
return [1, "We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www)." + " [issueSSLForDomain]"]
|
"We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www).")
|
||||||
|
return [1,
|
||||||
|
"We are not able to get new SSL for " + domain + ". But there is an existing SSL, it might only be for the main domain (excluding www)." + " [issueSSLForDomain]"]
|
||||||
|
|
||||||
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=' + domain + '" -keyout ' + pathToStoreSSLPrivKey + ' -out ' + pathToStoreSSLFullChain
|
command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=' + domain + '" -keyout ' + pathToStoreSSLPrivKey + ' -out ' + pathToStoreSSLFullChain
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import socket
|
|||||||
|
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from websiteFunctions.models import ChildDomains, Websites
|
from websiteFunctions.models import ChildDomains, Websites
|
||||||
except:
|
except:
|
||||||
@@ -17,7 +18,6 @@ except:
|
|||||||
|
|
||||||
|
|
||||||
class sslUtilities:
|
class sslUtilities:
|
||||||
|
|
||||||
Server_root = "/usr/local/lsws"
|
Server_root = "/usr/local/lsws"
|
||||||
redisConf = '/usr/local/lsws/conf/dvhost_redis.conf'
|
redisConf = '/usr/local/lsws/conf/dvhost_redis.conf'
|
||||||
|
|
||||||
@@ -57,7 +57,6 @@ class sslUtilities:
|
|||||||
return str(msg)
|
return str(msg)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def checkSSLIPv6Listener():
|
def checkSSLIPv6Listener():
|
||||||
try:
|
try:
|
||||||
@@ -67,7 +66,8 @@ class sslUtilities:
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [IO Error with main config file [checkSSLIPv6Listener]]")
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
|
str(msg) + " [IO Error with main config file [checkSSLIPv6Listener]]")
|
||||||
return str(msg)
|
return str(msg)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ class sslUtilities:
|
|||||||
return [0, "347 " + str(msg) + " [issueSSLForDomain]"]
|
return [0, "347 " + str(msg) + " [issueSSLForDomain]"]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def installSSLForDomain(virtualHostName, adminEmail='example@example.org'):
|
def installSSLForDomain(virtualHostName, adminEmail='domain@cyberpanel.net'):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
website = Websites.objects.get(domain=virtualHostName)
|
website = Websites.objects.get(domain=virtualHostName)
|
||||||
@@ -332,7 +332,6 @@ class sslUtilities:
|
|||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def FindIfDomainInCloudflare(virtualHostName):
|
def FindIfDomainInCloudflare(virtualHostName):
|
||||||
try:
|
try:
|
||||||
@@ -403,6 +402,14 @@ class sslUtilities:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def obtainSSLForADomain(virtualHostName, adminEmail, sslpath, aliasDomain=None):
|
def obtainSSLForADomain(virtualHostName, adminEmail, sslpath, aliasDomain=None):
|
||||||
|
# Replace example.org emails with domain-specific email
|
||||||
|
if adminEmail and ('example.org' in adminEmail or 'example.com' in adminEmail):
|
||||||
|
import re
|
||||||
|
# Remove special characters and create domain-based email
|
||||||
|
clean_domain = re.sub(r'[^a-zA-Z0-9]', '', virtualHostName)
|
||||||
|
adminEmail = f'{clean_domain}@cyberpanel.net'
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(f'Replacing invalid email with {adminEmail}')
|
||||||
|
|
||||||
sender_email = 'root@%s' % (socket.gethostname())
|
sender_email = 'root@%s' % (socket.gethostname())
|
||||||
|
|
||||||
CF_Check = 0
|
CF_Check = 0
|
||||||
@@ -419,7 +426,6 @@ class sslUtilities:
|
|||||||
if SSLProvider != 'Denial':
|
if SSLProvider != 'Denial':
|
||||||
return 1, 'This domain already have a valid SSL.'
|
return 1, 'This domain already have a valid SSL.'
|
||||||
|
|
||||||
|
|
||||||
CF_Check, message = sslUtilities.FindIfDomainInCloudflare(virtualHostName)
|
CF_Check, message = sslUtilities.FindIfDomainInCloudflare(virtualHostName)
|
||||||
|
|
||||||
DNS_TO_USE = ''
|
DNS_TO_USE = ''
|
||||||
@@ -494,8 +500,10 @@ class sslUtilities:
|
|||||||
'SSL Notification for %s.' % (virtualHostName))
|
'SSL Notification for %s.' % (virtualHostName))
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Failed to obtain SSL, issuing self-signed SSL for: ' + virtualHostName, 0)
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
logging.CyberCPLogFileWriter.SendEmail(sender_email, adminEmail, 'Failed to obtain SSL, issuing self-signed SSL for: ' + virtualHostName,
|
'Failed to obtain SSL, issuing self-signed SSL for: ' + virtualHostName, 0)
|
||||||
|
logging.CyberCPLogFileWriter.SendEmail(sender_email, adminEmail,
|
||||||
|
'Failed to obtain SSL, issuing self-signed SSL for: ' + virtualHostName,
|
||||||
'SSL Notification for %s.' % (virtualHostName))
|
'SSL Notification for %s.' % (virtualHostName))
|
||||||
return 0, output
|
return 0, output
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import json
|
|||||||
import plogical.CyberCPLogFileWriter as logging
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
|
|
||||||
|
|
||||||
from plogical.httpProc import httpProc
|
from plogical.httpProc import httpProc
|
||||||
from websiteFunctions.models import wpplugins
|
from websiteFunctions.models import wpplugins
|
||||||
from websiteFunctions.website import WebsiteManager
|
from websiteFunctions.website import WebsiteManager
|
||||||
@@ -26,6 +25,7 @@ from plogical.processUtilities import ProcessUtilities
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def loadWebsitesHome(request):
|
def loadWebsitesHome(request):
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
admin = Administrator.objects.get(pk=val)
|
admin = Administrator.objects.get(pk=val)
|
||||||
@@ -33,6 +33,7 @@ def loadWebsitesHome(request):
|
|||||||
{"type": admin.type})
|
{"type": admin.type})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
def createWebsite(request):
|
def createWebsite(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -40,6 +41,8 @@ def createWebsite(request):
|
|||||||
return wm.createWebsite(request, userID)
|
return wm.createWebsite(request, userID)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def WPCreate(request):
|
def WPCreate(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -48,6 +51,7 @@ def WPCreate(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def ListWPSites(request):
|
def ListWPSites(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -57,6 +61,7 @@ def ListWPSites(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def WPHome(request):
|
def WPHome(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -67,6 +72,8 @@ def WPHome(request):
|
|||||||
return wm.WPHome(request, userID, WPid, DeleteID)
|
return wm.WPHome(request, userID, WPid, DeleteID)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def RestoreHome(request):
|
def RestoreHome(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -88,6 +95,7 @@ def RemoteBackupConfig(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def BackupfileConfig(request):
|
def BackupfileConfig(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -99,6 +107,7 @@ def BackupfileConfig(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def AddRemoteBackupsite(request):
|
def AddRemoteBackupsite(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -110,6 +119,7 @@ def AddRemoteBackupsite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def WordpressPricing(request):
|
def WordpressPricing(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -118,6 +128,7 @@ def WordpressPricing(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def RestoreBackups(request):
|
def RestoreBackups(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -128,6 +139,7 @@ def RestoreBackups(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def AutoLogin(request):
|
def AutoLogin(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -136,6 +148,8 @@ def AutoLogin(request):
|
|||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def ConfigurePlugins(request):
|
def ConfigurePlugins(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -154,6 +168,7 @@ def ConfigurePlugins(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def Addnewplugin(request):
|
def Addnewplugin(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -163,8 +178,6 @@ def Addnewplugin(request):
|
|||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def SearchOnkeyupPlugin(request):
|
def SearchOnkeyupPlugin(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -352,6 +365,7 @@ def fetchstaging(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchDatabase(request):
|
def fetchDatabase(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -373,6 +387,7 @@ def fetchDatabase(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def SaveUpdateConfig(request):
|
def SaveUpdateConfig(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -394,6 +409,7 @@ def SaveUpdateConfig(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def DeploytoProduction(request):
|
def DeploytoProduction(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -415,6 +431,7 @@ def DeploytoProduction(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def WPCreateBackup(request):
|
def WPCreateBackup(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -437,7 +454,6 @@ def WPCreateBackup(request):
|
|||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def RestoreWPbackupNow(request):
|
def RestoreWPbackupNow(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -480,6 +496,7 @@ def SaveBackupConfig(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def SaveBackupSchedule(request):
|
def SaveBackupSchedule(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -500,6 +517,7 @@ def SaveBackupSchedule(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def AddWPsiteforRemoteBackup(request):
|
def AddWPsiteforRemoteBackup(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -607,7 +625,6 @@ def dataintegrity(request):
|
|||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def GetCurrentThemes(request):
|
def GetCurrentThemes(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -795,7 +812,6 @@ def CreateStagingNow(request):
|
|||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def modifyWebsite(request):
|
def modifyWebsite(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -807,6 +823,7 @@ def modifyWebsite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def deleteWebsite(request):
|
def deleteWebsite(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -815,6 +832,7 @@ def deleteWebsite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def CreateNewDomain(request):
|
def CreateNewDomain(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -823,6 +841,7 @@ def CreateNewDomain(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def siteState(request):
|
def siteState(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -831,6 +850,7 @@ def siteState(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def listWebsites(request):
|
def listWebsites(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -839,6 +859,7 @@ def listWebsites(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def listChildDomains(request):
|
def listChildDomains(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -847,6 +868,7 @@ def listChildDomains(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitWebsiteCreation(request):
|
def submitWebsiteCreation(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -868,6 +890,7 @@ def submitWebsiteCreation(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitDomainCreation(request):
|
def submitDomainCreation(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -887,6 +910,7 @@ def submitDomainCreation(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchDomains(request):
|
def fetchDomains(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -895,6 +919,7 @@ def fetchDomains(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def searchWebsites(request):
|
def searchWebsites(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -903,6 +928,7 @@ def searchWebsites(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def searchChilds(request):
|
def searchChilds(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -911,6 +937,7 @@ def searchChilds(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getFurtherAccounts(request):
|
def getFurtherAccounts(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -919,6 +946,7 @@ def getFurtherAccounts(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchWebsitesList(request):
|
def fetchWebsitesList(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -927,6 +955,7 @@ def fetchWebsitesList(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchChildDomainsMain(request):
|
def fetchChildDomainsMain(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -935,6 +964,7 @@ def fetchChildDomainsMain(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitWebsiteDeletion(request):
|
def submitWebsiteDeletion(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -954,6 +984,7 @@ def submitWebsiteDeletion(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitDomainDeletion(request):
|
def submitDomainDeletion(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -975,6 +1006,7 @@ def submitDomainDeletion(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def convertDomainToSite(request):
|
def convertDomainToSite(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -985,6 +1017,7 @@ def convertDomainToSite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitWebsiteStatus(request):
|
def submitWebsiteStatus(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1006,6 +1039,7 @@ def submitWebsiteStatus(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitWebsiteModify(request):
|
def submitWebsiteModify(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1016,6 +1050,7 @@ def submitWebsiteModify(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveWebsiteChanges(request):
|
def saveWebsiteChanges(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1037,6 +1072,7 @@ def saveWebsiteChanges(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def domain(request, domain):
|
def domain(request, domain):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1061,6 +1097,7 @@ def domain(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def launchChild(request, domain, childDomain):
|
def launchChild(request, domain, childDomain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1069,6 +1106,7 @@ def launchChild(request, domain, childDomain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getDataFromLogFile(request):
|
def getDataFromLogFile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1077,6 +1115,7 @@ def getDataFromLogFile(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchErrorLogs(request):
|
def fetchErrorLogs(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1085,6 +1124,7 @@ def fetchErrorLogs(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getDataFromConfigFile(request):
|
def getDataFromConfigFile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1093,6 +1133,7 @@ def getDataFromConfigFile(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveConfigsToFile(request):
|
def saveConfigsToFile(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1114,6 +1155,7 @@ def saveConfigsToFile(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getRewriteRules(request):
|
def getRewriteRules(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1122,6 +1164,7 @@ def getRewriteRules(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveRewriteRules(request):
|
def saveRewriteRules(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1143,6 +1186,7 @@ def saveRewriteRules(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveSSL(request):
|
def saveSSL(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1164,6 +1208,7 @@ def saveSSL(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def changePHP(request):
|
def changePHP(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1185,6 +1230,7 @@ def changePHP(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def listCron(request):
|
def listCron(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1193,6 +1239,7 @@ def listCron(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getWebsiteCron(request):
|
def getWebsiteCron(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1201,6 +1248,7 @@ def getWebsiteCron(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getCronbyLine(request):
|
def getCronbyLine(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1209,6 +1257,7 @@ def getCronbyLine(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveCronChanges(request):
|
def saveCronChanges(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1217,6 +1266,7 @@ def saveCronChanges(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def remCronbyLine(request):
|
def remCronbyLine(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1236,6 +1286,7 @@ def remCronbyLine(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def addNewCron(request):
|
def addNewCron(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1255,6 +1306,7 @@ def addNewCron(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def domainAlias(request, domain):
|
def domainAlias(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1263,6 +1315,7 @@ def domainAlias(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitAliasCreation(request):
|
def submitAliasCreation(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1282,6 +1335,7 @@ def submitAliasCreation(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def issueAliasSSL(request):
|
def issueAliasSSL(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1290,6 +1344,7 @@ def issueAliasSSL(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def delateAlias(request):
|
def delateAlias(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1309,6 +1364,7 @@ def delateAlias(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def changeOpenBasedir(request):
|
def changeOpenBasedir(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -1330,6 +1386,7 @@ def changeOpenBasedir(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def wordpressInstall(request, domain):
|
def wordpressInstall(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1338,6 +1395,7 @@ def wordpressInstall(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def installWordpress(request):
|
def installWordpress(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1346,6 +1404,7 @@ def installWordpress(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def installWordpressStatus(request):
|
def installWordpressStatus(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1354,6 +1413,7 @@ def installWordpressStatus(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def joomlaInstall(request, domain):
|
def joomlaInstall(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1362,6 +1422,7 @@ def joomlaInstall(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def installJoomla(request):
|
def installJoomla(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1370,6 +1431,7 @@ def installJoomla(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def setupGit(request, domain):
|
def setupGit(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1378,6 +1440,7 @@ def setupGit(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def setupGitRepo(request):
|
def setupGitRepo(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1386,6 +1449,7 @@ def setupGitRepo(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def gitNotify(request, domain):
|
def gitNotify(request, domain):
|
||||||
try:
|
try:
|
||||||
@@ -1394,6 +1458,7 @@ def gitNotify(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def detachRepo(request):
|
def detachRepo(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1402,6 +1467,7 @@ def detachRepo(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def changeBranch(request):
|
def changeBranch(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1410,6 +1476,7 @@ def changeBranch(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def installPrestaShop(request, domain):
|
def installPrestaShop(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1418,6 +1485,7 @@ def installPrestaShop(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def installMagento(request, domain):
|
def installMagento(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1426,6 +1494,7 @@ def installMagento(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def magentoInstall(request):
|
def magentoInstall(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1434,6 +1503,7 @@ def magentoInstall(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def installMautic(request, domain):
|
def installMautic(request, domain):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1442,6 +1512,7 @@ def installMautic(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def mauticInstall(request):
|
def mauticInstall(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1450,6 +1521,7 @@ def mauticInstall(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def prestaShopInstall(request):
|
def prestaShopInstall(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1458,6 +1530,7 @@ def prestaShopInstall(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def sshAccess(request, domain):
|
def sshAccess(request, domain):
|
||||||
try:
|
try:
|
||||||
# from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter
|
# from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter
|
||||||
@@ -1517,6 +1590,7 @@ def sshAccess(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveSSHAccessChanges(request):
|
def saveSSHAccessChanges(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1552,6 +1626,7 @@ def syncToMaster(request, domain, childDomain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def startSync(request):
|
def startSync(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1578,6 +1653,7 @@ def manageGIT(request, domain):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchFolderDetails(request):
|
def fetchFolderDetails(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1586,6 +1662,7 @@ def fetchFolderDetails(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def initRepo(request):
|
def initRepo(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1594,6 +1671,7 @@ def initRepo(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def setupRemote(request):
|
def setupRemote(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1602,6 +1680,7 @@ def setupRemote(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def changeGitBranch(request):
|
def changeGitBranch(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1610,6 +1689,7 @@ def changeGitBranch(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def createNewBranch(request):
|
def createNewBranch(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1618,6 +1698,7 @@ def createNewBranch(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def commitChanges(request):
|
def commitChanges(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1626,6 +1707,7 @@ def commitChanges(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def gitPull(request):
|
def gitPull(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1634,6 +1716,7 @@ def gitPull(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def gitPush(request):
|
def gitPush(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1642,6 +1725,7 @@ def gitPush(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def attachRepoGIT(request):
|
def attachRepoGIT(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1650,6 +1734,7 @@ def attachRepoGIT(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def removeTracking(request):
|
def removeTracking(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1658,6 +1743,7 @@ def removeTracking(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchGitignore(request):
|
def fetchGitignore(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1666,6 +1752,7 @@ def fetchGitignore(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveGitIgnore(request):
|
def saveGitIgnore(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1674,6 +1761,7 @@ def saveGitIgnore(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchCommits(request):
|
def fetchCommits(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1682,6 +1770,7 @@ def fetchCommits(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchFiles(request):
|
def fetchFiles(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1690,6 +1779,7 @@ def fetchFiles(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchChangesInFile(request):
|
def fetchChangesInFile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1698,6 +1788,7 @@ def fetchChangesInFile(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveGitConfigurations(request):
|
def saveGitConfigurations(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1706,6 +1797,7 @@ def saveGitConfigurations(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchGitLogs(request):
|
def fetchGitLogs(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1714,6 +1806,7 @@ def fetchGitLogs(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def getSSHConfigs(request):
|
def getSSHConfigs(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1722,6 +1815,7 @@ def getSSHConfigs(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def deleteSSHKey(request):
|
def deleteSSHKey(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1730,6 +1824,7 @@ def deleteSSHKey(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def addSSHKey(request):
|
def addSSHKey(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1738,6 +1833,7 @@ def addSSHKey(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def webhook(request, domain):
|
def webhook(request, domain):
|
||||||
try:
|
try:
|
||||||
@@ -1764,6 +1860,7 @@ def getSwitchStatus(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def switchServer(request):
|
def switchServer(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1772,6 +1869,7 @@ def switchServer(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def statusFunc(request):
|
def statusFunc(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1783,6 +1881,7 @@ def statusFunc(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def tuneSettings(request):
|
def tuneSettings(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1792,6 +1891,7 @@ def tuneSettings(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveApacheConfigsToFile(request):
|
def saveApacheConfigsToFile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1812,6 +1912,7 @@ def CreateDockerPackage(request):
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(msg)
|
return HttpResponse(msg)
|
||||||
|
|
||||||
|
|
||||||
def CreateDockerPackage(request):
|
def CreateDockerPackage(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1820,6 +1921,8 @@ def CreateDockerPackage(request):
|
|||||||
return wm.CreateDockerPackage(request, userID, None, DeleteID)
|
return wm.CreateDockerPackage(request, userID, None, DeleteID)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def AssignPackage(request):
|
def AssignPackage(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1828,6 +1931,8 @@ def AssignPackage(request):
|
|||||||
return wm.AssignPackage(request, userID, None, DeleteID)
|
return wm.AssignPackage(request, userID, None, DeleteID)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def CreateDockersite(request):
|
def CreateDockersite(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1836,6 +1941,7 @@ def CreateDockersite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def AddDockerpackage(request):
|
def AddDockerpackage(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1844,6 +1950,8 @@ def AddDockerpackage(request):
|
|||||||
return wm.AddDockerpackage(userID, data)
|
return wm.AddDockerpackage(userID, data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def Getpackage(request):
|
def Getpackage(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1852,6 +1960,8 @@ def Getpackage(request):
|
|||||||
return wm.Getpackage(userID, data)
|
return wm.Getpackage(userID, data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def Updatepackage(request):
|
def Updatepackage(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1860,6 +1970,8 @@ def Updatepackage(request):
|
|||||||
return wm.Updatepackage(userID, data)
|
return wm.Updatepackage(userID, data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def AddAssignment(request):
|
def AddAssignment(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1869,6 +1981,7 @@ def AddAssignment(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitDockerSiteCreation(request):
|
def submitDockerSiteCreation(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1878,6 +1991,7 @@ def submitDockerSiteCreation(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def ListDockerSites(request):
|
def ListDockerSites(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1887,6 +2001,7 @@ def ListDockerSites(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchDockersite(request):
|
def fetchDockersite(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1896,6 +2011,7 @@ def fetchDockersite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def Dockersitehome(request, dockerapp):
|
def Dockersitehome(request, dockerapp):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1904,6 +2020,7 @@ def Dockersitehome(request, dockerapp):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchWPDetails(request):
|
def fetchWPDetails(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -1915,6 +2032,7 @@ def fetchWPDetails(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def startContainer(request):
|
def startContainer(request):
|
||||||
try:
|
try:
|
||||||
@@ -1924,6 +2042,7 @@ def startContainer(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def stopContainer(request):
|
def stopContainer(request):
|
||||||
try:
|
try:
|
||||||
@@ -1933,6 +2052,7 @@ def stopContainer(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def restartContainer(request):
|
def restartContainer(request):
|
||||||
try:
|
try:
|
||||||
@@ -1942,6 +2062,7 @@ def restartContainer(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_website_resources(request):
|
def get_website_resources(request):
|
||||||
try:
|
try:
|
||||||
@@ -1980,6 +2101,7 @@ def get_website_resources(request):
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(f'Error in get_website_resources: {str(msg)}')
|
logging.CyberCPLogFileWriter.writeToFile(f'Error in get_website_resources: {str(msg)}')
|
||||||
return JsonResponse({'status': 0, 'error_message': str(msg)})
|
return JsonResponse({'status': 0, 'error_message': str(msg)})
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_terminal_jwt(request):
|
def get_terminal_jwt(request):
|
||||||
import logging
|
import logging
|
||||||
@@ -2046,6 +2168,7 @@ def get_terminal_jwt(request):
|
|||||||
logger.error(f"Exception in get_terminal_jwt: {str(e)}")
|
logger.error(f"Exception in get_terminal_jwt: {str(e)}")
|
||||||
return JsonResponse({'status': 0, 'error_message': str(e)})
|
return JsonResponse({'status': 0, 'error_message': str(e)})
|
||||||
|
|
||||||
|
|
||||||
def fetchWPBackups(request):
|
def fetchWPBackups(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|||||||
Reference in New Issue
Block a user