usmannasir / cyberpanel

Cyber Panel - The hosting control panel for OpenLiteSpeed
GNU General Public License v3.0
1.53k stars 592 forks source link

Internal Upgrader + Latest PHPMyAdmin #1139

Closed master3395 closed 9 months ago

master3395 commented 11 months ago

One step closer.

usmannasir commented 11 months ago

I am sorry I didnt see your pull request yesterday. i've made some changes and installation is working but the upgrade via ui still does not work.

usmannasir commented 11 months ago

See last three commits: https://github.com/usmannasir/cyberpanel/commits/v2.3.5-dev

master3395 commented 10 months ago

For some reason, the upgrade button don't have access to this file location: /usr/local/CyberCP/cyberpanel_upgrade.sh Same if I try to use the command, to do it through shell from the web. Any suggestions?

sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh

master3395 commented 10 months ago

I made good buttons and branch chooser, but it seems to be refused future access :/

image image

usmannasir commented 10 months ago

For some reason, the upgrade button don't have access to this file location: /usr/local/CyberCP/cyberpanel_upgrade.sh Same if I try to use the command, to do it through shell from the web. Any suggestions?

sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh

I am sorry, I did not understand exactly?

master3395 commented 10 months ago

For some reason, the upgrade button doesn't have access to this file location: /usr/local/CyberCP/cyberpanel_upgrade.sh Same if I try to use the command, to do it through shell from the web. Any suggestions? sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh

I am sorry, I did not understand exactly?

What I mean is. I am trying to implement the same setup that is for installing Mailscanner, to try and upgrade CyberPanel, with the cmd window, showing the progress. But for some reason, when I click upgrade, the server refuses me from accessing this location, if I try upgrading from here: /usr/local/CyberCP/cyberpanel_upgrade.sh

Using this location gives me an error if I let the script change the branch from /stable/ to something else. sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh

What if i put it as a script in the CPScripts, will CyberPanel accept that path easier? https://github.com/usmannasir/cyberpanel/tree/v2.3.5-dev/CPScripts

master3395 commented 10 months ago

image

usmannasir commented 10 months ago

For some reason, the upgrade button doesn't have access to this file location: /usr/local/CyberCP/cyberpanel_upgrade.sh Same if I try to use the command, to do it through shell from the web. Any suggestions? sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh

I am sorry, I did not understand exactly?

What I mean is. I am trying to implement the same setup that is for installing Mailscanner, to try and upgrade CyberPanel, with the cmd window, showing the progress. But for some reason, when I click upgrade, the server refuses me from accessing this location, if I try upgrading from here: /usr/local/CyberCP/cyberpanel_upgrade.sh

Using this location gives me an error if I let the script change the branch from /stable/ to something else. sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh

What if i put it as a script in the CPScripts, will CyberPanel accept that path easier? https://github.com/usmannasir/cyberpanel/tree/v2.3.5-dev/CPScripts

Can you tell me exactly how are you running it? Also installing mailscanner is different, reason is upgrading CyberPanel itself disconnect it from the CyberPanel.

Which might be causing issue in your case?

master3395 commented 10 months ago

I am trying to run the upgrader through the shell setup, like the live shell we had in 2.3.2 if I remember the number right. Idk why it was removed, but using https://raw.githubusercontent.com/usmannasir/cyberpanel/${selectedBranch}/preUpgrade.sh To run it in Shell, with the desired branch from the dropdown menu.

This is the upgrade function: image

Then when it is installing, I only wanted the log window (The shell view) to show the progress of the upgrade, just like normal SSH is showing the upgrade of CyberPanel.

But the most important part is to be notified once the upgrade is done, or that it is still doing it's thing. Perhaps even run in the background, in case you close the browser etc.

So we continue to see the status if we return to the versionManagment.html

My main issue is the branch checking seems to be failing, because of invalid character. I have been trying to fix that.

21:31:58.056 versionManagment:1813 Upgrade response: ObjecterrorMessage: "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : ‘ < >."error_message: "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : ‘ < >."[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()length: 0name: "get __proto__"arguments: (...)caller: (...)[[Prototype]]: ƒ ()[[Scopes]]: Scopes[0]set __proto__: ƒ __proto__()length: 1name: "set __proto__"arguments: (...)caller: (...)[[Prototype]]: ƒ ()[[Scopes]]: Scopes[0]
21:31:58.056 versionManagment:1821  Invalid progress value received from the server: undefined
(anonymous) @ versionManagment:1821
Promise.then (async)
upgradeCyberPanel @ versionManagment:1811
onclick @ versionManagment:1710

versionManagment.html

``` {% extends "baseTemplate/index.html" %} {% load i18n %} {% block title %}{% trans "Version Management - CyberPanel" %}{% endblock %} {% block content %} {% load static %}

{% trans "Version Management" %}

{% trans "Here you can manage versions and check for updates to CyberPanel" %}

{% if Notecheck %}

{% trans "Note: Latest commit does not match, please upgrade CyberPanel." %}

{% endif %}

CyberPanel

{{ currentVersion }}
{{ build }}
{{ Currentcomt }}
{{ latestVersion }}
{{ latestBuild }}
{{ latestcomit }}
{% endblock %} ```
usmannasir commented 10 months ago

I am trying to run the upgrader through the shell setup, like the live shell we had in 2.3.2 if I remember the number right. Idk why it was removed, but using https://raw.githubusercontent.com/usmannasir/cyberpanel/${selectedBranch}/preUpgrade.sh To run it in Shell, with the desired branch from the dropdown menu.

This is the upgrade function: image

Then when it is installing, I only wanted the log window (The shell view) to show the progress of the upgrade, just like normal SSH is showing the upgrade of CyberPanel.

But the most important part is to be notified once the upgrade is done, or that it is still doing it's thing. Perhaps even run in the background, in case you close the browser etc.

So we continue to see the status if we return to the versionManagment.html

My main issue is the branch checking seems to be failing, because of invalid character. I have been trying to fix that.

21:31:58.056 versionManagment:1813 Upgrade response: ObjecterrorMessage: "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : ‘ < >."error_message: "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : ‘ < >."[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()length: 0name: "get __proto__"arguments: (...)caller: (...)[[Prototype]]: ƒ ()[[Scopes]]: Scopes[0]set __proto__: ƒ __proto__()length: 1name: "set __proto__"arguments: (...)caller: (...)[[Prototype]]: ƒ ()[[Scopes]]: Scopes[0]
21:31:58.056 versionManagment:1821  Invalid progress value received from the server: undefined
(anonymous) @ versionManagment:1821
Promise.then (async)
upgradeCyberPanel @ versionManagment:1811
onclick @ versionManagment:1710

versionManagment.html

This function checks the variables passed via javascript for malicious data, so if you think you need to bypass any variable you can use this

https://github.com/usmannasir/cyberpanel/blob/1ac841449eb3aabac68a4a2548b07a6cd502df2f/CyberCP/secMiddleware.py#L22C11-L22C11

Or let me know which variables are you passing from js side, so i can adjust this function accordingly.

usmannasir commented 9 months ago

Merged and testing.

usmannasir commented 9 months ago

@master3395 which view are you calling for uri /upgrade ?