mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-27 09:49:04 +01:00
bug fix: don't update hostname ssl paths if fails
This commit is contained in:
@@ -165,7 +165,7 @@
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input ng-keypress="initiateLogin($event)" ng-model="password" type="password"
|
||||
class="form-control" id="password" placeholder="Password" required>
|
||||
class="form-control" id="password" placeholder="Password" required name="password">
|
||||
<span class="input-group-addon bg-blue">
|
||||
<i class="glyph-icon icon-unlock-alt"></i>
|
||||
</span>
|
||||
|
||||
@@ -575,6 +575,15 @@ class virtualHostUtilities:
|
||||
pathToStoreSSLFullChain = '/etc/letsencrypt/live/' + virtualHost + '/fullchain.pem'
|
||||
pathToStoreSSLPrivKey = '/etc/letsencrypt/live/' + virtualHost + '/privkey.pem'
|
||||
|
||||
adminEmail = "email@" + virtualHost
|
||||
|
||||
if not os.path.exists(pathToStoreSSLFullChain):
|
||||
retValues = sslUtilities.issueSSLForDomain(virtualHost, adminEmail, path)
|
||||
|
||||
if retValues[0] == 0:
|
||||
print "0," + str(retValues[1])
|
||||
return 0, retValues[1]
|
||||
|
||||
## removing old certs for lscpd
|
||||
if os.path.exists(destPrivKey):
|
||||
os.remove(destPrivKey)
|
||||
@@ -586,10 +595,11 @@ class virtualHostUtilities:
|
||||
os.remove(lswsAdminCert)
|
||||
if os.path.exists(lswsAdminPrivKey):
|
||||
os.remove(lswsAdminPrivKey)
|
||||
|
||||
## create symlink for hostname SSL for lsws webadmin SSL
|
||||
command = 'ln -s /usr/local/lscp/conf/cert.pem /usr/local/lsws/admin/conf/cert/admin.crt'
|
||||
command = 'ln -s %s /usr/local/lsws/admin/conf/cert/admin.crt' % (pathToStoreSSLFullChain)
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
command = 'ln -s /usr/local/lscp/conf/key.pem /usr/local/lsws/admin/conf/cert/admin.key'
|
||||
command = 'ln -s %s /usr/local/lsws/admin/conf/cert/admin.key' % (pathToStoreSSLPrivKey)
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
## removing self signed certs for ols webadmin
|
||||
@@ -597,23 +607,20 @@ class virtualHostUtilities:
|
||||
os.remove(olsAdminCert)
|
||||
if os.path.exists(olsAdminPrivKey):
|
||||
os.remove(olsAdminPrivKey)
|
||||
|
||||
## create symlink for hostname SSL for lsws webadmin SSL
|
||||
command = 'ln -s /usr/local/lscp/conf/cert.pem /usr/local/lsws/admin/conf/webadmin.crt'
|
||||
command = 'ln -s %s /usr/local/lsws/admin/conf/webadmin.crt' % (pathToStoreSSLFullChain)
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
command = 'ln -s /usr/local/lscp/conf/key.pem /usr/local/lsws/admin/conf/webadmin.key'
|
||||
command = 'ln -s %s /usr/local/lsws/admin/conf/webadmin.key' % (pathToStoreSSLPrivKey)
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
adminEmail = "email@" + virtualHost
|
||||
##
|
||||
|
||||
if not os.path.exists(pathToStoreSSLFullChain):
|
||||
retValues = sslUtilities.issueSSLForDomain(virtualHost, adminEmail, path)
|
||||
command = 'ln -s %s %s' % (pathToStoreSSLFullChain, destCert)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
if retValues[0] == 0:
|
||||
print "0," + str(retValues[1])
|
||||
return 0, retValues[1]
|
||||
|
||||
shutil.copy(pathToStoreSSLPrivKey, destPrivKey)
|
||||
shutil.copy(pathToStoreSSLFullChain, destCert)
|
||||
command = 'ln -s %s %s' % (pathToStoreSSLPrivKey, destPrivKey)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'systemctl restart lscpd'
|
||||
cmd = shlex.split(command)
|
||||
|
||||
21
tests/Users/geckodriver.log
Normal file
21
tests/Users/geckodriver.log
Normal file
@@ -0,0 +1,21 @@
|
||||
1573973433754 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileLc2y7g"
|
||||
1573973434225 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
|
||||
1573973434225 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
|
||||
1573973434225 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
|
||||
1573973434225 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
|
||||
1573973436114 Marionette INFO Listening on port 37645
|
||||
1573973436175 Marionette WARN TLS certificate errors will be ignored for this session
|
||||
1573973446035 Marionette INFO Stopped listening on port 37645
|
||||
|
||||
###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
|
||||
|
||||
1573973852572 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile1rjJBH"
|
||||
1573973853028 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
|
||||
1573973853028 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
|
||||
1573973853028 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
|
||||
1573973853029 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
|
||||
1573973854811 Marionette INFO Listening on port 41103
|
||||
1573973854879 Marionette WARN TLS certificate errors will be ignored for this session
|
||||
[Parent 10908, Gecko_IOThread] WARNING: pipe error (79): Connection reset by peer: file /build/firefox-clezVp/firefox-70.0.1+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 358
|
||||
[Parent 10908, Gecko_IOThread] WARNING: pipe error (76): Connection reset by peer: file /build/firefox-clezVp/firefox-70.0.1+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 358
|
||||
1573973986906 Marionette INFO Stopped listening on port 41103
|
||||
56
tests/Users/test_createUser.py
Normal file
56
tests/Users/test_createUser.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# Generated by Selenium IDE
|
||||
import pytest
|
||||
import time
|
||||
import json
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
from selenium.webdriver.support import expected_conditions
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
class TestCreateUser():
|
||||
def setup_method(self, method):
|
||||
self.driver = webdriver.Firefox(executable_path='/usr/bin/firefoxdriver')
|
||||
self.vars = {}
|
||||
|
||||
def teardown_method(self, method):
|
||||
self.driver.quit()
|
||||
|
||||
def test_createUser(self):
|
||||
self.driver.get("https://cyberpanel.xyz:8090/")
|
||||
self.driver.set_window_size(1366, 654)
|
||||
self.driver.find_element(By.NAME, "username").click()
|
||||
self.driver.find_element(By.NAME, "username").send_keys("admin")
|
||||
self.driver.find_element(By.ID, "password").send_keys("hello123")
|
||||
self.driver.find_element(By.ID, "password").send_keys(Keys.ENTER)
|
||||
self.driver.find_element(By.LINK_TEXT, "Users").click()
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".createNewUser span").click()
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".form-group:nth-child(1)").click()
|
||||
self.driver.find_element(By.NAME, "firstName").click()
|
||||
self.driver.find_element(By.NAME, "firstName").send_keys("Usman")
|
||||
self.driver.find_element(By.NAME, "lastName").send_keys("Nasir")
|
||||
self.driver.find_element(By.NAME, "email").send_keys("usman")
|
||||
self.driver.find_element(By.NAME, "email").send_keys(Keys.DOWN)
|
||||
self.driver.find_element(By.NAME, "email").send_keys("usman@cyberpersons.com")
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".form-group:nth-child(4) .form-control").click()
|
||||
dropdown = self.driver.find_element(By.CSS_SELECTOR, ".form-group:nth-child(4) .form-control")
|
||||
dropdown.find_element(By.XPATH, "//option[. = 'user']").click()
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".ng-not-empty > option:nth-child(3)").click()
|
||||
self.driver.find_element(By.NAME, "websitesLimits").click()
|
||||
self.driver.find_element(By.NAME, "websitesLimits").send_keys("50")
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".form-group:nth-child(6) .form-control").send_keys("usman")
|
||||
self.driver.find_element(By.NAME, "password").send_keys("nasir")
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".ng-empty").click()
|
||||
dropdown = self.driver.find_element(By.CSS_SELECTOR, ".form-group:nth-child(9) .form-control")
|
||||
dropdown.find_element(By.XPATH, "//option[. = 'HIGH']").click()
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".ng-untouched > option:nth-child(1)").click()
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".btn-lg").click()
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".alert-success").click()
|
||||
assert self.driver.find_element(By.CSS_SELECTOR, ".alert-success > p").text == "Account with username: usman is successfully created."
|
||||
|
||||
|
||||
ct = TestCreateUser()
|
||||
ct.setup_method('test')
|
||||
ct.test_createUser()
|
||||
ct.teardown_method('test')
|
||||
@@ -67,7 +67,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Websites Limit" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input placeholder="0 = Unlimited" type="number" class="form-control"
|
||||
<input name="websitesLimits" placeholder="0 = Unlimited" type="number" class="form-control"
|
||||
ng-model="websitesLimits" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user