From cedb7beeddd4cd77ad727f8d915738f42238abf2 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 6 Sep 2023 09:28:50 +0300 Subject: [PATCH 1/2] set CSRF TRUSTED ORIGIN modification on settings.py --- webvirtcloud.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/webvirtcloud.sh b/webvirtcloud.sh index 5b5248e..2df16a9 100755 --- a/webvirtcloud.sh +++ b/webvirtcloud.sh @@ -246,6 +246,13 @@ install_webvirtcloud () { sed -i "s|^\\(WS_PUBLIC_PORT = \\).*|\\1$novncd_public_port_escape|" "$APP_PATH/webvirtcloud/settings.py" sed -i "s|^\\(WS_HOST = \\).*|\\1\'$novncd_host_escape\'|" "$APP_PATH/webvirtcloud/settings.py" + # set CSRF TRUSTED ORIGINS + host_ip="'http://127.0.0.1', " + for i in $(hostname -I); do + host_ip+="'http://$i', " + done + sed -i "s|^\\(CSRF_TRUSTED_ORIGINS = \\).*|\\1\[ \'http://$fqdn\', $host_ip ]|" /srv/webvirtcloud/webvirtcloud/settings.py + echo "* Activate virtual environment." activate_python_environment @@ -409,6 +416,7 @@ case $distro in ;; esac +fqdn="localhost" setupfqdn=default until [[ $setupfqdn == "yes" ]] || [[ $setupfqdn == "no" ]]; do echo -n " Q. Do you want to configure fqdn for Nginx? (y/n) " @@ -418,9 +426,6 @@ until [[ $setupfqdn == "yes" ]] || [[ $setupfqdn == "no" ]]; do [yY] | [yY][Ee][Ss] ) echo -n " Q. What is the FQDN of your server? ($(hostname --fqdn)): " read -r fqdn - if [ -z "$fqdn" ]; then - readonly fqdn="$(hostname --fqdn)" - fi setupfqdn="yes" echo " Setting to $fqdn" echo "" From cbd1f6f8b0fef9f4ac3c4130d9b284598e04c28a Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 6 Sep 2023 09:41:08 +0300 Subject: [PATCH 2/2] update requirement and fix install script --- conf/requirements.txt | 10 +++++----- dev/libvirt-bootstrap.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/requirements.txt b/conf/requirements.txt index b0529f1..64206b8 100644 --- a/conf/requirements.txt +++ b/conf/requirements.txt @@ -1,4 +1,4 @@ -Django==4.2.4 +Django==4.2.5 django_bootstrap5==23.3 django-bootstrap-icons==0.8.3 django-login-required-middleware==0.9.0 @@ -6,15 +6,15 @@ django-otp==1.2.2 django-qr-code==3.1.1 gunicorn==21.2.0 libsass==0.22.0 -libvirt-python==9.6.0 +libvirt-python==9.7.0 lxml==4.9.3 qrcode==7.4.2 rwlock==0.0.7 -websockify==0.10.0 +websockify==0.11.0 zipp==3.16.2 ldap3==2.9.1 -python-engineio==4.5.1 -python-socketio==5.8.0 +python-engineio==4.7.0 +python-socketio==5.9.0 eventlet==0.33.3 djangorestframework==3.14.0 drf-nested-routers==0.93.4 diff --git a/dev/libvirt-bootstrap.sh b/dev/libvirt-bootstrap.sh index 139481a..a1fc888 100644 --- a/dev/libvirt-bootstrap.sh +++ b/dev/libvirt-bootstrap.sh @@ -680,7 +680,7 @@ install_debian() { apt-get update || return 1 if [ "$DISTRO_MAJOR_VERSION" -lt 10 ]; then apt-get -y install qemu-kvm libvirt-bin bridge-utils sasl2-bin python-guestfs supervisor || return 1 - else [ "$DISTRO_MAJOR_VERSION" -lt 12 ]; then + elif [ "$DISTRO_MAJOR_VERSION" -lt 12 ]; then apt-get -y install qemu qemu-kvm qemu-system qemu-utils libvirt-clients libvirt-daemon-system sasl2-bin python3-guestfs virtinst supervisor || return 1 else apt-get -y install qemu-system qemu-utils libvirt-clients libvirt-daemon-system sasl2-bin python3-guestfs virtinst supervisor || return 1