diff --git a/AllCPUbuntu.json b/AllCPUbuntu.json new file mode 100644 index 000000000..fe707464f --- /dev/null +++ b/AllCPUbuntu.json @@ -0,0 +1,2984 @@ +[ + { + "Package": "aspell/bionic-updates,bionic-security,now", + "Version": "0.60.7~20110707-4ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "aspell-en/bionic,bionic,now", + "Version": "2017.08.24-0-0.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "autoconf/bionic,bionic,now", + "Version": "2.69-11", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "automake/bionic,bionic,now", + "Version": "1:1.15.1-3ubuntu2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "autopoint/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "0.19.8.1-6ubuntu0.3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "autotools-dev/bionic,bionic,now", + "Version": "20180224.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "binutils/bionic-updates,bionic-security,now", + "Version": "2.30-21ubuntu1~18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "binutils-common/bionic-updates,bionic-security,now", + "Version": "2.30-21ubuntu1~18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "binutils-x86-64-linux-gnu/bionic-updates,bionic-security,now", + "Version": "2.30-21ubuntu1~18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "build-essential/bionic,now", + "Version": "12.4ubuntu1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "bzip2-doc/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "1.0.6-8.1ubuntu0.2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "comerr-dev/bionic-updates,bionic-security,now", + "Version": "2.1-1.44.1-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "cpp/bionic-updates,bionic-security,now", + "Version": "4:7.4.0-1ubuntu2.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "cpp-7/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "curl/bionic-updates,bionic-security,now", + "Version": "7.58.0-2ubuntu3.8", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "dbconfig-common/bionic,bionic,now", + "Version": "2.0.9", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "dbconfig-mysql/bionic,bionic,now", + "Version": "2.0.9", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "debhelper/bionic-updates,bionic-updates,now", + "Version": "11.1.6ubuntu2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "dh-autoreconf/bionic,bionic,now", + "Version": "17", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "dh-python/bionic,bionic,now", + "Version": "3.20180325ubuntu2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "dh-strip-nondeterminism/bionic,bionic,now", + "Version": "0.040-1.1~build1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "dns-root-data/bionic,bionic,now", + "Version": "2018013001", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "dovecot-core/bionic,now", + "Version": "2:2.3.10-2+ubuntu18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "dovecot-imapd/bionic,now", + "Version": "2:2.3.10-2+ubuntu18.04", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "dovecot-mysql/bionic,now", + "Version": "2:2.3.10-2+ubuntu18.04", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "dovecot-pop3d/bionic,now", + "Version": "2:2.3.10-2+ubuntu18.04", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "dpkg-dev/bionic-updates,bionic-updates,now", + "Version": "1.19.0.5ubuntu2.3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "ebtables/bionic-updates,now", + "Version": "2.0.10.4-3.5ubuntu2.18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "enchant/bionic,now", + "Version": "1.6.0-11.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "fakeroot/bionic,now", + "Version": "1.22-2ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "firewalld/bionic,bionic,now", + "Version": "0.4.4.6-1", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "fontconfig/bionic,now", + "Version": "2.12.6-0ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "fontconfig-config/bionic,bionic,now", + "Version": "2.12.6-0ubuntu2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "fonts-dejavu-core/bionic,bionic,now", + "Version": "2.37-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "fonts-droid-fallback/bionic,bionic,now", + "Version": "1:6.0.1r16-1.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "fonts-noto-mono/bionic,bionic,now", + "Version": "20171026-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "g++/bionic-updates,bionic-security,now", + "Version": "4:7.4.0-1ubuntu2.3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "g++-7/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "galera-3/bionic,now", + "Version": "25.3.20-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gawk/bionic,now", + "Version": "1:4.1.4+dfsg-1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gcc/bionic-updates,bionic-security,now", + "Version": "4:7.4.0-1ubuntu2.3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "gcc-7/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gcc-7-base/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "geoip-bin/bionic,now", + "Version": "1.6.12-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gettext/bionic-updates,bionic-security,now", + "Version": "0.19.8.1-6ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "ghostscript/bionic-updates,bionic-security,now", + "Version": "9.26~dfsg+0-0ubuntu0.18.04.12", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gir1.2-freedesktop/bionic,now", + "Version": "1.56.1-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gir1.2-gdkpixbuf-2.0/bionic,now", + "Version": "2.36.11-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gir1.2-harfbuzz-0.0/bionic,now", + "Version": "1.7.2-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "gir1.2-rsvg-2.0/bionic,now", + "Version": "2.40.20-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "git/bionic-updates,bionic-security,now", + "Version": "1:2.17.1-1ubuntu0.7", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "git-man/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "1:2.17.1-1ubuntu0.7", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "gsfonts/bionic,bionic,now", + "Version": "1:8.11+urwcyr1.0.7~pre44-4.4", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "htop/bionic,now", + "Version": "2.1.0-3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "hunspell-en-us/bionic,bionic,now", + "Version": "1:2017.08.24", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "icu-devtools/bionic-updates,bionic-security,now", + "Version": "60.2-3ubuntu3.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "idn2/bionic-updates,bionic-security,now", + "Version": "2.0.4-1.1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "imagemagick-6-common/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "intltool-debian/bionic,bionic,now", + "Version": "0.35.0+20060710.4", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "ipset/bionic,now", + "Version": "6.34-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "javascript-common/bionic,bionic,now", + "Version": "11", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "krb5-multidev/bionic-updates,bionic-security,now", + "Version": "1.16-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libaio1/bionic-updates,now", + "Version": "0.3.110-5ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libalgorithm-diff-perl/bionic,bionic,now", + "Version": "1.19.03-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libalgorithm-diff-xs-perl/bionic,now", + "Version": "0.04-5", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libalgorithm-merge-perl/bionic,bionic,now", + "Version": "0.08-3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libarchive-cpio-perl/bionic,bionic,now", + "Version": "0.10-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libarchive-zip-perl/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "1.60-1ubuntu0.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libasan4/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libaspell15/bionic-updates,bionic-security,now", + "Version": "0.60.7~20110707-4ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libassuan-dev/bionic,now", + "Version": "2.5.1-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libatomic1/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libattr1-dev/bionic,now", + "Version": "1:2.4.47-2build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libavahi-client3/bionic-updates,bionic-security,now", + "Version": "0.7-3.1ubuntu1.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libavahi-common-data/bionic-updates,bionic-security,now", + "Version": "0.7-3.1ubuntu1.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libavahi-common3/bionic-updates,bionic-security,now", + "Version": "0.7-3.1ubuntu1.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libbinutils/bionic-updates,bionic-security,now", + "Version": "2.30-21ubuntu1~18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libboost-program-options1.65.1/bionic,now", + "Version": "1.65.1+dfsg-0ubuntu5", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libbz2-dev/bionic-updates,bionic-security,now", + "Version": "1.0.6-8.1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libc-ares2/bionic,now", + "Version": "1.14.0-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libc-client2007e/bionic-updates,bionic-security,now", + "Version": "8:2007f~dfsg-5ubuntu0.18.04.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libc-dev-bin/bionic,now", + "Version": "2.27-3ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libc6-dev/bionic,now", + "Version": "2.27-3ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcairo-gobject2/bionic-updates,now", + "Version": "1.15.10-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcairo-script-interpreter2/bionic-updates,now", + "Version": "1.15.10-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcairo2/bionic-updates,now", + "Version": "1.15.10-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcairo2-dev/bionic-updates,now", + "Version": "1.15.10-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcc1-0/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcgi-fast-perl/bionic,bionic,now", + "Version": "1:2.13-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libcgi-pm-perl/bionic,bionic,now", + "Version": "4.38-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libcilkrts5/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcomerr2/bionic-updates,bionic-security,now", + "Version": "1.44.1-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libconfig-inifiles-perl/bionic,bionic,now", + "Version": "2.94-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libcroco3/bionic,now", + "Version": "0.6.12-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcups2/bionic-updates,bionic-security,now", + "Version": "2.2.7-1ubuntu2.7", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcupsfilters1/bionic-updates,bionic-security,now", + "Version": "1.20.2-0ubuntu3.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcupsimage2/bionic-updates,bionic-security,now", + "Version": "2.2.7-1ubuntu2.7", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcurl3-gnutls/bionic-updates,bionic-security,now", + "Version": "7.58.0-2ubuntu3.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcurl4/bionic-updates,bionic-security,now", + "Version": "7.58.0-2ubuntu3.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libcurl4-gnutls-dev/bionic-updates,bionic-security,now", + "Version": "7.58.0-2ubuntu3.8", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libdatrie1/bionic,now", + "Version": "0.2.10-7", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libdbd-mysql-perl/bionic,now", + "Version": "4.046-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libdbi-perl/bionic,now", + "Version": "1.640-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libdjvulibre-dev/bionic-updates,bionic-security,now", + "Version": "3.5.27.1-8ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libdjvulibre-text/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "3.5.27.1-8ubuntu0.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libdjvulibre21/bionic-updates,bionic-security,now", + "Version": "3.5.27.1-8ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libdpkg-perl/bionic-updates,bionic-updates,now", + "Version": "1.19.0.5ubuntu2.3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libenchant1c2a/bionic,now", + "Version": "1.6.0-11.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libencode-locale-perl/bionic,bionic,now", + "Version": "1.05-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "liberror-perl/bionic,bionic,now", + "Version": "0.17025-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libev4/bionic,now", + "Version": "1:4.22-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libevent-2.1-6/bionic,now", + "Version": "2.1.8-stable-4build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libexif-dev/bionic-updates,bionic-security,now", + "Version": "0.6.21-4ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libexif-doc/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "0.6.21-4ubuntu0.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libexif12/bionic-updates,bionic-security,now", + "Version": "0.6.21-4ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libexpat1-dev/bionic-updates,bionic-security,now", + "Version": "2.2.5-3ubuntu0.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libexttextcat-2.0-0/bionic,now", + "Version": "3.4.5-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libexttextcat-data/bionic,bionic,now", + "Version": "3.4.5-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libfakeroot/bionic,now", + "Version": "1.22-2ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libfcgi-perl/bionic,now", + "Version": "0.78-2build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libffi-dev/bionic,now", + "Version": "3.2.1-8", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libfftw3-double3/bionic,now", + "Version": "3.3.7-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libfile-copy-recursive-perl/bionic,bionic,now", + "Version": "0.40-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libfile-fcntllock-perl/bionic,now", + "Version": "0.22-3build2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libfile-stripnondeterminism-perl/bionic,bionic,now", + "Version": "0.040-1.1~build1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libfontconfig1/bionic,now", + "Version": "2.12.6-0ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libfontconfig1-dev/bionic,now", + "Version": "2.12.6-0ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libfreetype6-dev/bionic,now", + "Version": "2.8.1-2ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgcc-7-dev/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgcrypt20-dev/bionic-updates,bionic-security,now", + "Version": "1.8.1-4ubuntu1.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libgdbm-compat4/bionic,now", + "Version": "1.14.1-6", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgdk-pixbuf2.0-0/bionic,now", + "Version": "2.36.11-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgdk-pixbuf2.0-bin/bionic,now", + "Version": "2.36.11-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgdk-pixbuf2.0-common/bionic,bionic,now", + "Version": "2.36.11-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libgdk-pixbuf2.0-dev/bionic,now", + "Version": "2.36.11-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgeoip-dev/bionic,now", + "Version": "1.6.12-1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libglib2.0-bin/bionic-updates,bionic-security,now", + "Version": "2.56.4-0ubuntu0.18.04.6", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libglib2.0-dev/bionic-updates,bionic-security,now", + "Version": "2.56.4-0ubuntu0.18.04.6", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libglib2.0-dev-bin/bionic-updates,bionic-security,now", + "Version": "2.56.4-0ubuntu0.18.04.6", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgmp-dev/bionic,now", + "Version": "2:6.1.2+dfsg-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgmpxx4ldbl/bionic,now", + "Version": "2:6.1.2+dfsg-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgnutls-dane0/bionic-updates,bionic-security,now", + "Version": "3.5.18-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgnutls-openssl27/bionic-updates,bionic-security,now", + "Version": "3.5.18-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgnutls28-dev/bionic-updates,bionic-security,now", + "Version": "3.5.18-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libgnutlsxx28/bionic-updates,bionic-security,now", + "Version": "3.5.18-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgomp1/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgpg-error-dev/bionic,now", + "Version": "1.27-6", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgpgme-dev/bionic-updates,now", + "Version": "1.10.0-1ubuntu2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libgpgme11/bionic-updates,now", + "Version": "1.10.0-1ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgpm2/bionic,now", + "Version": "1.20.7-5", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgraphite2-3/bionic,now", + "Version": "1.3.11-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgraphite2-dev/bionic,now", + "Version": "1.3.11-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgs9/bionic-updates,bionic-security,now", + "Version": "9.26~dfsg+0-0ubuntu0.18.04.12", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libgs9-common/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "9.26~dfsg+0-0ubuntu0.18.04.12", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libgssrpc4/bionic-updates,bionic-security,now", + "Version": "1.16-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libharfbuzz-dev/bionic,now", + "Version": "1.7.2-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libharfbuzz-gobject0/bionic,now", + "Version": "1.7.2-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libharfbuzz-icu0/bionic,now", + "Version": "1.7.2-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libharfbuzz0b/bionic,now", + "Version": "1.7.2-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libhtml-parser-perl/bionic,now", + "Version": "3.72-3build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libhtml-tagset-perl/bionic,bionic,now", + "Version": "3.20-3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libhtml-template-perl/bionic,bionic,now", + "Version": "2.97-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libhttp-date-perl/bionic,bionic,now", + "Version": "6.02-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libhttp-message-perl/bionic,bionic,now", + "Version": "6.14-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libhunspell-1.6-0/bionic,now", + "Version": "1.6.2-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libice-dev/bionic,now", + "Version": "2:1.0.9-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libice6/bionic,now", + "Version": "2:1.0.9-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libicu-dev/bionic-updates,bionic-security,now", + "Version": "60.2-3ubuntu3.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libicu-le-hb-dev/bionic,now", + "Version": "1.0.3+git161113-4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libicu-le-hb0/bionic,now", + "Version": "1.0.3+git161113-4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libiculx60/bionic-updates,bionic-security,now", + "Version": "60.2-3ubuntu3.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libidn2-0-dev/bionic-updates,bionic-security,now", + "Version": "2.0.4-1.1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libidn2-dev/bionic-updates,bionic-security,now", + "Version": "2.0.4-1.1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libijs-0.35/bionic,now", + "Version": "0.35-13", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libilmbase-dev/bionic,now", + "Version": "2.2.0-11ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libilmbase12/bionic,now", + "Version": "2.2.0-11ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libio-html-perl/bionic,bionic,now", + "Version": "1.001-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libipset3/bionic,now", + "Version": "6.34-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libisl19/bionic,now", + "Version": "0.19-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libitm1/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjansson4/bionic,now", + "Version": "2.11-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjbig-dev/bionic,now", + "Version": "2.1-3.1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjbig0/bionic,now", + "Version": "2.1-3.1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjbig2dec0/bionic,now", + "Version": "0.13-6", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjemalloc1/bionic,now", + "Version": "3.6.0-11", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjpeg-dev/bionic,now", + "Version": "8c-2ubuntu8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjpeg-turbo8/bionic-updates,bionic-security,now", + "Version": "1.5.2-0ubuntu5.18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjpeg-turbo8-dev/bionic-updates,bionic-security,now", + "Version": "1.5.2-0ubuntu5.18.04.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjpeg8/bionic,now", + "Version": "8c-2ubuntu8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjpeg8-dev/bionic,now", + "Version": "8c-2ubuntu8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libjs-jquery/bionic,bionic,now", + "Version": "3.2.1-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libkadm5clnt-mit11/bionic-updates,bionic-security,now", + "Version": "1.16-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libkadm5srv-mit11/bionic-updates,bionic-security,now", + "Version": "1.16-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libkdb5-9/bionic-updates,bionic-security,now", + "Version": "1.16-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libkrb5-dev/bionic-updates,bionic-security,now", + "Version": "1.16-2ubuntu0.1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "liblcms2-2/bionic-updates,bionic-security,now", + "Version": "2.9-1ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblcms2-dev/bionic-updates,bionic-security,now", + "Version": "2.9-1ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libldap2-dev/bionic-updates,now", + "Version": "2.4.45+dfsg-1ubuntu1.4", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "liblqr-1-0/bionic,now", + "Version": "0.4.2-2.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblqr-1-0-dev/bionic,now", + "Version": "0.4.2-2.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblsan0/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libltdl-dev/bionic,now", + "Version": "2.4.6-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libltdl7/bionic,now", + "Version": "2.4.6-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblua5.1-0/bionic,now", + "Version": "5.1.5-8.1build2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblua5.2-0/bionic,now", + "Version": "5.2.4-1.1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblua5.3-0/bionic-updates,bionic-security,now", + "Version": "5.3.3-1ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liblwp-mediatypes-perl/bionic,bionic,now", + "Version": "6.02-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "liblzma-dev/bionic,now", + "Version": "5.2.2-1.3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "liblzo2-2/bionic,now", + "Version": "2.08-1.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickcore-6-arch-config/bionic-updates,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickcore-6-headers/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickcore-6.q16-3/bionic-updates,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickcore-6.q16-3-extra/bionic-updates,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickcore-6.q16-dev/bionic-updates,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickwand-6-headers/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickwand-6.q16-3/bionic-updates,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickwand-6.q16-dev/bionic-updates,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmagickwand-dev/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "8:6.9.7.4+dfsg-16ubuntu6.8", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "libmail-sendmail-perl/bionic,bionic,now", + "Version": "0.80-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libmariadbclient-dev/bionic-updates,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libmariadbclient18/bionic-updates,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmcrypt4/bionic,now", + "Version": "2.5.8-3.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmemcached11/bionic-updates,now", + "Version": "1.0.18-4.2ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmilter1.0.1/bionic,now", + "Version": "8.15.2-10", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmpc3/bionic,now", + "Version": "1.1.0-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmpfr6/bionic,now", + "Version": "4.0.1-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmpx2/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libmysqlclient20/bionic-updates,bionic-security,now", + "Version": "5.7.29-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libnghttp2-14/bionic,now", + "Version": "1.30.0-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libnghttp2-dev/bionic,now", + "Version": "1.30.0-1ubuntu1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libonig4/bionic,now", + "Version": "6.7.0-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libopendbx1/bionic,now", + "Version": "1.4.6-11", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libopendbx1-sqlite3/bionic,now", + "Version": "1.4.6-11", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libopendkim11/bionic,now", + "Version": "2.11.0~alpha-11build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libopenexr-dev/bionic-updates,bionic-security,now", + "Version": "2.2.0-11.1ubuntu1.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libopenexr22/bionic-updates,bionic-security,now", + "Version": "2.2.0-11.1ubuntu1.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libp11-kit-dev/bionic,now", + "Version": "0.23.9-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpango-1.0-0/bionic-updates,bionic-security,now", + "Version": "1.40.14-1ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpangocairo-1.0-0/bionic-updates,bionic-security,now", + "Version": "1.40.14-1ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpangoft2-1.0-0/bionic-updates,bionic-security,now", + "Version": "1.40.14-1ubuntu0.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpaper-utils/bionic,now", + "Version": "1.1.24+nmu5ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpaper1/bionic,now", + "Version": "1.1.24+nmu5ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpcre16-3/bionic,now", + "Version": "2:8.39-9", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpcre3-dev/bionic,now", + "Version": "2:8.39-9", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libpcre32-3/bionic,now", + "Version": "2:8.39-9", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpcrecpp0v5/bionic,now", + "Version": "2:8.39-9", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libperl5.26/bionic-updates,bionic-security,now", + "Version": "5.26.1-6ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpixman-1-0/bionic,now", + "Version": "0.34.0-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpixman-1-dev/bionic,now", + "Version": "0.34.0-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpng-dev/bionic-updates,bionic-security,now", + "Version": "1.6.34-1ubuntu0.18.04.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpng-tools/bionic-updates,bionic-security,now", + "Version": "1.6.34-1ubuntu0.18.04.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpolkit-agent-1-0/bionic-updates,bionic-security,now", + "Version": "0.105-20ubuntu0.18.04.5", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpolkit-backend-1-0/bionic-updates,bionic-security,now", + "Version": "0.105-20ubuntu0.18.04.5", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpsl-dev/bionic,now", + "Version": "0.19.1-5build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libpthread-stubs0-dev/bionic,now", + "Version": "0.3-4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpython3-dev/bionic-updates,now", + "Version": "3.6.7-1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpython3.6/bionic-updates,bionic-security,now", + "Version": "3.6.9-1~18.04ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libpython3.6-dev/bionic-updates,bionic-security,now", + "Version": "3.6.9-1~18.04ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libquadmath0/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "librbl1/bionic,now", + "Version": "2.11.0~alpha-11build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libreadline5/bionic,now", + "Version": "5.2+dfsg-3build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "librecode0/bionic,now", + "Version": "3.6-23", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "librsvg2-2/bionic,now", + "Version": "2.40.20-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "librsvg2-common/bionic,now", + "Version": "2.40.20-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "librsvg2-dev/bionic,now", + "Version": "2.40.20-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "librtmp-dev/bionic,now", + "Version": "2.4+20151223.gitfa8646d.1-1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "librtmp1/bionic,now", + "Version": "2.4+20151223.gitfa8646d.1-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libsigsegv2/bionic,now", + "Version": "2.12-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libsm-dev/bionic,now", + "Version": "2:1.2.2-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libsm6/bionic,now", + "Version": "2:1.2.2-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libsodium23/bionic,now", + "Version": "1.0.16-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libssl-dev/bionic-updates,bionic-security,now", + "Version": "1.1.1-1ubuntu2.1~18.04.5", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libstdc++-7-dev/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libstemmer0d/bionic,now", + "Version": "0+svn585-1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libsys-hostname-long-perl/bionic,bionic,now", + "Version": "1.5-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libtasn1-6-dev/bionic,now", + "Version": "4.13-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtasn1-doc/bionic,bionic,now", + "Version": "4.13-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libterm-readkey-perl/bionic,now", + "Version": "2.37-1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libthai-data/bionic,bionic,now", + "Version": "0.1.27-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libthai0/bionic,now", + "Version": "0.1.27-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtidy5/bionic,now", + "Version": "1:5.2.0-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtiff-dev/bionic-updates,bionic-security,now", + "Version": "4.0.9-5ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtiff5/bionic-updates,bionic-security,now", + "Version": "4.0.9-5ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtiff5-dev/bionic-updates,bionic-security,now", + "Version": "4.0.9-5ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtiffxx5/bionic-updates,bionic-security,now", + "Version": "4.0.9-5ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libtimedate-perl/bionic,bionic,now", + "Version": "2.3000-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libtool/bionic,bionic,now", + "Version": "2.4.6-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libtsan0/bionic-updates,bionic-security,now", + "Version": "8.4.0-1ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libubsan0/bionic-updates,bionic-security,now", + "Version": "7.5.0-3ubuntu1~18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libudns-dev/bionic,now", + "Version": "0.4-1build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "libudns0/bionic,now", + "Version": "0.4-1build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libunbound2/bionic-updates,now", + "Version": "1.6.7-1ubuntu2.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "liburi-perl/bionic,bionic,now", + "Version": "1.73-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libvbr2/bionic,now", + "Version": "2.11.0~alpha-11build1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libwebp6/bionic,now", + "Version": "0.6.1-2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libwmf-dev/bionic,now", + "Version": "0.2.8.4-12", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libwmf0.2-7/bionic,now", + "Version": "0.2.8.4-12", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libx11-dev/bionic-updates,now", + "Version": "2:1.6.4-3ubuntu0.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libx11-doc/bionic-updates,bionic-updates,now", + "Version": "2:1.6.4-3ubuntu0.2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "libxau-dev/bionic,now", + "Version": "1:1.0.8-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxcb-render0/bionic-updates,now", + "Version": "1.13-2~ubuntu18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxcb-render0-dev/bionic-updates,now", + "Version": "1.13-2~ubuntu18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxcb-shm0/bionic-updates,now", + "Version": "1.13-2~ubuntu18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxcb-shm0-dev/bionic-updates,now", + "Version": "1.13-2~ubuntu18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxcb1-dev/bionic-updates,now", + "Version": "1.13-2~ubuntu18.04", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxdmcp-dev/bionic,now", + "Version": "1:1.1.2-3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxext-dev/bionic,now", + "Version": "2:1.3.3-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxml2-dev/bionic-updates,bionic-security,now", + "Version": "2.9.4+dfsg1-6.1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxpm4/bionic,now", + "Version": "1:3.5.12-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxrender-dev/bionic,now", + "Version": "1:0.9.10-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxrender1/bionic,now", + "Version": "1:0.9.10-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxslt1.1/bionic-updates,bionic-security,now", + "Version": "1.1.29-5ubuntu0.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxt-dev/bionic,now", + "Version": "1:1.1.5-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libxt6/bionic,now", + "Version": "1:1.1.5-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "libzip4/bionic,now", + "Version": "1.1.2-1.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "linux-libc-dev/bionic-updates,bionic-security,now", + "Version": "4.15.0-96.97", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp70/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-common/bionic,bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "lsphp70-curl/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-dev/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-igbinary/bionic,now", + "Version": "3.0.1-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp70-imap/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-intl/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-json/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-ldap/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-memcached/bionic,now", + "Version": "3.1.5-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-msgpack/bionic,now", + "Version": "2.0.3-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp70-mysql/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-opcache/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-pspell/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-recode/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-redis/bionic,now", + "Version": "5.1.1-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-sqlite3/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp70-tidy/bionic,now", + "Version": "7.0.33-13+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-common/bionic,bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "lsphp71-curl/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-dev/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-igbinary/bionic,now", + "Version": "3.0.1-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp71-imap/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-intl/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-json/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-ldap/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-memcached/bionic,now", + "Version": "3.1.5-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-msgpack/bionic,now", + "Version": "2.0.3-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp71-mysql/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-opcache/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-pspell/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-recode/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-redis/bionic,now", + "Version": "5.1.1-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-sqlite3/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp71-tidy/bionic,now", + "Version": "7.1.33-3+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-common/bionic,bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "lsphp72-curl/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-dev/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-igbinary/bionic,now", + "Version": "3.0.1-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp72-imap/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-intl/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-json/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-ldap/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-memcached/bionic,now", + "Version": "3.1.5-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-msgpack/bionic,now", + "Version": "2.0.3-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp72-mysql/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-opcache/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-pspell/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-recode/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-redis/bionic,now", + "Version": "5.1.1-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-sqlite3/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp72-tidy/bionic,now", + "Version": "7.2.29-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-common/bionic,bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "lsphp73-curl/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-dev/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-igbinary/bionic,now", + "Version": "3.0.1-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp73-imap/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-intl/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-json/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-ldap/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-memcached/bionic,now", + "Version": "3.1.5-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-msgpack/bionic,now", + "Version": "2.0.3-1+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp73-mysql/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-opcache/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-pspell/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-recode/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-redis/bionic,now", + "Version": "5.1.1-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-sqlite3/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp73-tidy/bionic,now", + "Version": "7.3.16-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-common/bionic,bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "lsphp74-curl/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-dev/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-igbinary/bionic,now", + "Version": "3.0.1-2+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp74-imap/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-intl/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-json/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-ldap/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-memcached/bionic,now", + "Version": "3.1.5-2+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-msgpack/bionic,now", + "Version": "2.0.3-2+bionic", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "lsphp74-mysql/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-opcache/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-pspell/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-redis/bionic,now", + "Version": "5.1.1-2+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-sqlite3/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "lsphp74-tidy/bionic,now", + "Version": "7.4.4-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "m4/bionic,now", + "Version": "1.4.18-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "make/bionic,now", + "Version": "4.1-9.1ubuntu1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "manpages-dev/bionic,bionic,now", + "Version": "4.15-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "mariadb-client-10.1/bionic-updates,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "mariadb-client-core-10.1/bionic-updates,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "mariadb-common/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "mariadb-server/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "mariadb-server-10.1/bionic-updates,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "mariadb-server-core-10.1/bionic-updates,bionic-security,now", + "Version": "1:10.1.44-0ubuntu0.18.04.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "memcached/bionic-updates,bionic-security,now", + "Version": "1.5.6-0ubuntu1.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "mlock/bionic-updates,bionic-security,now", + "Version": "8:2007f~dfsg-5ubuntu0.18.04.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "mysql-common/bionic,bionic,now", + "Version": "5.8+1.0.4", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "nettle-dev/bionic,now", + "Version": "3.4-1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "nghttp2/bionic,bionic,now", + "Version": "1.30.0-1ubuntu1", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "nghttp2-client/bionic,now", + "Version": "1.30.0-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "nghttp2-proxy/bionic,now", + "Version": "1.30.0-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "nghttp2-server/bionic,now", + "Version": "1.30.0-1ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "openbsd-inetd/bionic,now", + "Version": "0.20160825-3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "opendkim/bionic,now", + "Version": "2.11.0~alpha-11build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "opendkim-tools/bionic,now", + "Version": "2.11.0~alpha-11build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "openlitespeed/bionic,now", + "Version": "1.6.12-1+bionic", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "patch/bionic-updates,bionic-security,now", + "Version": "2.7.6-2ubuntu1.1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "pdns-backend-bind/bionic,now", + "Version": "4.1.1-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "pdns-backend-mysql/bionic,now", + "Version": "4.1.1-1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "pdns-server/bionic,now", + "Version": "4.1.1-1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "perl/bionic-updates,bionic-security,now", + "Version": "5.26.1-6ubuntu0.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "perl-modules-5.26/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "5.26.1-6ubuntu0.3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "php-cli/bionic,bionic,now", + "Version": "1:7.2+60ubuntu1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "php-common/bionic,bionic,now", + "Version": "1:60ubuntu1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "php-pear/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "1:1.10.5+submodules+notgz-1ubuntu1.18.04.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "php-readline/bionic,bionic,now", + "Version": "1:7.2+60ubuntu1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "php-xml/bionic,bionic,now", + "Version": "1:7.2+60ubuntu1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "php7.2-cli/bionic-updates,bionic-security,now", + "Version": "7.2.24-0ubuntu0.18.04.4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "php7.2-common/bionic-updates,bionic-security,now", + "Version": "7.2.24-0ubuntu0.18.04.4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "php7.2-json/bionic-updates,bionic-security,now", + "Version": "7.2.24-0ubuntu0.18.04.4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "php7.2-opcache/bionic-updates,bionic-security,now", + "Version": "7.2.24-0ubuntu0.18.04.4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "php7.2-readline/bionic-updates,bionic-security,now", + "Version": "7.2.24-0ubuntu0.18.04.4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "php7.2-xml/bionic-updates,bionic-security,now", + "Version": "7.2.24-0ubuntu0.18.04.4", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "pkg-config/bionic,now", + "Version": "0.29.1-0ubuntu2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "pkg-php-tools/bionic,bionic,now", + "Version": "1.35ubuntu1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "po-debconf/bionic,bionic,now", + "Version": "1.0.20", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "policykit-1/bionic-updates,bionic-security,now", + "Version": "0.105-20ubuntu0.18.04.5", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "poppler-data/bionic,bionic,now", + "Version": "0.4.8-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "postfix/bionic-updates,now", + "Version": "3.3.0-1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "postfix-mysql/bionic-updates,now", + "Version": "3.3.0-1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "pure-ftpd-common/now", + "Version": "1.0.47-3", + "Arch": "all", + "Status": "[installed,local]" + }, + { + "Package": "pure-ftpd-mysql/now", + "Version": "1.0.47-3", + "Arch": "amd64", + "Status": "[installed,local]" + }, + { + "Package": "python-pip-whl/bionic-updates,bionic-updates,now", + "Version": "9.0.1-2.3~ubuntu1.18.04.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-asn1crypto/bionic,bionic,now", + "Version": "0.24.0-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-cffi-backend/bionic,now", + "Version": "1.11.5-1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-crypto/bionic,now", + "Version": "2.6.1-8ubuntu2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-cryptography/bionic-updates,bionic-security,now", + "Version": "2.1.4-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-decorator/bionic,bionic,now", + "Version": "4.1.2-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-dev/bionic-updates,now", + "Version": "3.6.7-1~18.04", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "python3-distutils/bionic-updates,bionic-updates,now", + "Version": "3.6.9-1~18.04", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-keyring/bionic,bionic,now", + "Version": "10.6.0-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-keyrings.alt/bionic,bionic,now", + "Version": "3.0-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-lib2to3/bionic-updates,bionic-updates,now", + "Version": "3.6.9-1~18.04", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-pip/bionic-updates,bionic-updates,now", + "Version": "9.0.1-2.3~ubuntu1.18.04.1", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "python3-secretstorage/bionic,bionic,now", + "Version": "2.3.1-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-selinux/bionic,now", + "Version": "2.7-2build2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-setuptools/bionic,bionic,now", + "Version": "39.0.1-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-slip/bionic,bionic,now", + "Version": "0.6.5-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-slip-dbus/bionic,bionic,now", + "Version": "0.6.5-2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-venv/bionic-updates,now", + "Version": "3.6.7-1~18.04", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "python3-virtualenv/bionic,bionic,now", + "Version": "15.1.0+ds-1.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-wheel/bionic,bionic,now", + "Version": "0.30.0-0.2", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3-xdg/bionic,bionic,now", + "Version": "0.25-4ubuntu1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "python3.6-dev/bionic-updates,bionic-security,now", + "Version": "3.6.9-1~18.04ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "python3.6-venv/bionic-updates,bionic-security,now", + "Version": "3.6.9-1~18.04ubuntu1", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "rcs/bionic,now", + "Version": "5.9.4-4", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "redis/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "5:4.0.9-1ubuntu0.2", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "redis-server/bionic-updates,bionic-security,now", + "Version": "5:4.0.9-1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "redis-tools/bionic-updates,bionic-security,now", + "Version": "5:4.0.9-1ubuntu0.2", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "restic/bionic,now", + "Version": "0.8.3+ds-1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "shtool/bionic,bionic,now", + "Version": "2.0.8-9", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "socat/bionic,now", + "Version": "1.7.3.2-2ubuntu2", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "ssl-cert/bionic,bionic,now", + "Version": "1.0.39", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "tcpd/bionic,now", + "Version": "7.6.q-27", + "Arch": "amd64", + "Status": "[installed,automatic]" + }, + { + "Package": "update-inetd/bionic,bionic,now", + "Version": "4.44", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "vim/bionic-updates,bionic-security,now", + "Version": "2:8.0.1453-1ubuntu1.3", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "vim-runtime/bionic-updates,bionic-updates,bionic-security,bionic-security,now", + "Version": "2:8.0.1453-1ubuntu1.3", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "virtualenv/bionic,bionic,now", + "Version": "15.1.0+ds-1.1", + "Arch": "all", + "Status": "[installed]" + }, + { + "Package": "whichman/bionic,now", + "Version": "2.4-8build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "x11-common/bionic-updates,bionic-updates,now", + "Version": "1:7.7+19ubuntu7.1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "x11proto-core-dev/bionic,bionic,now", + "Version": "2018.4-4", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "x11proto-dev/bionic,bionic,now", + "Version": "2018.4-4", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "x11proto-xext-dev/bionic,bionic,now", + "Version": "2018.4-4", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "xorg-sgml-doctools/bionic,bionic,now", + "Version": "1:1.11-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "xtrans-dev/bionic,bionic,now", + "Version": "1.3.5-1", + "Arch": "all", + "Status": "[installed,automatic]" + }, + { + "Package": "zip/bionic,now", + "Version": "3.0-11build1", + "Arch": "amd64", + "Status": "[installed]" + }, + { + "Package": "zlib1g-dev/bionic,now", + "Version": "1:1.2.11.dfsg-0ubuntu2", + "Arch": "amd64", + "Status": "[installed]" + } +] \ No newline at end of file diff --git a/CLScript/CloudLinuxUsers.py b/CLScript/CloudLinuxUsers.py index 52c3dd8c9..bdc984655 100755 --- a/CLScript/CloudLinuxUsers.py +++ b/CLScript/CloudLinuxUsers.py @@ -79,48 +79,51 @@ class CloudLinuxUsers(CLMain): def fetchJson(self, websites): users = [] for webs in websites: - itemPackage = webs.package - package = {'name': itemPackage.packageName, 'owner': webs.externalApp} + try: + itemPackage = webs.package + package = {'name': itemPackage.packageName, 'owner': webs.externalApp} - user = {} + user = {} - if self.id: - user['id'] = pwd.getpwnam(webs.externalApp).pw_uid - - if self.un: - user['username'] = webs.externalApp - - if self.ow: - user['owner'] = webs.externalApp - - if self.domain: - user['domain'] = webs.domain - - if self.package: - user['package'] = package - - if self.email: - user['email'] = webs.adminEmail - - if self.localecode: - user['locale_code'] = "EN_us" - - - if self.packageName != None: - if self.package: - if self.packageName == user['package']['name'] and self.packageOwner == user['package']['owner']: - pass - else: - continue - - if self.uid !=None: if self.id: - if self.uid == user['id']: + user['id'] = pwd.getpwnam(webs.externalApp).pw_uid + + if self.un: + user['username'] = webs.externalApp + + if self.ow: + user['owner'] = webs.externalApp + + if self.domain: + user['domain'] = webs.domain + + if self.package: + user['package'] = package + + if self.email: + user['email'] = webs.adminEmail + + if self.localecode: + user['locale_code'] = "EN_us" + + + if self.packageName != None: + if self.package: + if self.packageName == user['package']['name'] and self.packageOwner == user['package']['owner']: + pass + else: + continue + + if self.uid !=None: + if self.id: + if self.uid == user['id']: + users.append(user) + else: users.append(user) else: users.append(user) - else: - users.append(user) + except BaseException as msg: + pass final = {'data': users, 'metadata': self.initialMeta} print(json.dumps(final)) diff --git a/CPCent7repo.json b/CPCent7repo.json new file mode 100644 index 000000000..2e1d80304 --- /dev/null +++ b/CPCent7repo.json @@ -0,0 +1,192 @@ +[ + { + "Package": "MariaDB-client.x86_64", + "Version": "10.1.44-1.el7.centos", + "Repo": "@CyberPanel" + }, + { + "Package": "MariaDB-common.x86_64", + "Version": "10.1.44-1.el7.centos", + "Repo": "@CyberPanel" + }, + { + "Package": "MariaDB-devel.x86_64", + "Version": "10.1.44-1.el7.centos", + "Repo": "@CyberPanel" + }, + { + "Package": "MariaDB-server.x86_64", + "Version": "10.1.44-1.el7.centos", + "Repo": "@CyberPanel" + }, + { + "Package": "MariaDB-shared.x86_64", + "Version": "10.1.44-1.el7.centos", + "Repo": "@CyberPanel" + }, + { + "Package": "compat-libtidy.x86_64", + "Version": "0.99.0-37.20091203.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "dovecot.x86_64", + "Version": "2:2.3.10-2", + "Repo": "@CyberPanel" + }, + { + "Package": "dovecot-mysql.x86_64", + "Version": "2:2.3.10-2", + "Repo": "@CyberPanel" + }, + { + "Package": "fastlz.x86_64", + "Version": "0.1.0-0.1.20070619svnrev12.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "galera.x86_64", + "Version": "25.3.28-1.rhel7.el7.centos", + "Repo": "@CyberPanel" + }, + { + "Package": "htop.x86_64", + "Version": "2.2.0-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "jemalloc.x86_64", + "Version": "3.6.0-1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libargon2.x86_64", + "Version": "20161029-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libbsd.x86_64", + "Version": "0.8.3-1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libc-client.x86_64", + "Version": "2007f-16.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libdb4.x86_64", + "Version": "4.8.30-13.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "liblzf.x86_64", + "Version": "3.6-7.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libmcrypt.x86_64", + "Version": "2.5.8-13.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libopendkim.x86_64", + "Version": "2.11.0-0.1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libsodium.x86_64", + "Version": "1.0.18-1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "libtidy.x86_64", + "Version": "5.4.0-1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "luajit.x86_64", + "Version": "2.0.4-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "oniguruma.x86_64", + "Version": "5.9.5-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "opendbx.x86_64", + "Version": "1.4.6-6.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "opendkim.x86_64", + "Version": "2.11.0-0.1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "pdns.x86_64", + "Version": "4.2.2-1pdns.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "pdns-backend-mysql.x86_64", + "Version": "4.2.2-1pdns.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "postfix3.x86_64", + "Version": "2:3.4.7-1.gf.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "postfix3-ldap.x86_64", + "Version": "2:3.4.7-1.gf.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "postfix3-mysql.x86_64", + "Version": "2:3.4.7-1.gf.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "postfix3-pcre.x86_64", + "Version": "2:3.4.7-1.gf.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "pure-ftpd.x86_64", + "Version": "1.0.47-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "redis.x86_64", + "Version": "3.2.12-2.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "restic.x86_64", + "Version": "0.9.6-1.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "rsync31u.x86_64", + "Version": "3.1.3-1.ius.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "udns.x86_64", + "Version": "0.4-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "udns-devel.x86_64", + "Version": "0.4-3.el7", + "Repo": "@CyberPanel" + }, + { + "Package": "vim-minimal.x86_64", + "Version": "2:8.0.003-1.gf.el7", + "Repo": "@CyberPanel" + } +] \ No newline at end of file diff --git a/CPScripts/mailscannerinstaller.sh b/CPScripts/mailscannerinstaller.sh new file mode 100644 index 000000000..9c193fdb8 --- /dev/null +++ b/CPScripts/mailscannerinstaller.sh @@ -0,0 +1,360 @@ +#!/bin/bash +#systemctl stop firewalld + +check_return() { +#check previous command result , 0 = ok , non-0 = something wrong. +if [[ $? -eq "0" ]] ; then + : +else + echo -e "\ncommand failed, exiting..." + exit +fi +} + +echo 'backup configs'; +cp /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf-bak_$(date '+%Y-%m-%d_%H_%M:%S'); +cp /etc/postfix/master.cf /etc/postfix/master.cf-bak_$(date '+%Y-%m-%d_%H_%M:%S'); +cp /etc/postfix/main.cf /etc/postfix/main.cf-bak_$(date '+%Y-%m-%d_%H_%M:%S'); +cp /etc/dovecot/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext-bak_$(date '+%Y-%m-%d_%H_%M:%S') + + +ZONE=$(firewall-cmd --get-default-zone) +firewall-cmd --zone=$ZONE --add-port=4190/tcp --permanent +systemctl stop firewalld + +echo 'Stop CSF' +csf -x + +MAILSCANNER=/etc/MailScanner + +if [ -d $MAILSCANNER ];then + +echo "MailScanner found. If you wish to reinstall then remove the package and revert" +echo "Postfix back to its original config at /etc/postfix/main.cf and remove" +echo "/etc/MailScanner and /usr/share/MailScanner directories" +exit +fi + +if [ -f /etc/os-release ];then +OS=$(head -1 /etc/os-release) +UBUNTUVERSION=$(sed '6q;d' /etc/os-release) +CENTOSVERSION=$(sed '5q;d' /etc/os-release) +fi + +if [ "$CENTOSVERSION" = "VERSION_ID=\"7\"" ];then + +setenforce 0 +yum install -y perl yum-utils perl-CPAN +yum install -y gcc cpp perl bzip2 zip make patch automake rpm-build perl-Archive-Zip perl-Filesys-Df perl-OLE-Storage_Lite perl-Sys-Hostname-Long perl-Sys-SigAction perl-Net-CIDR perl-DBI perl-MIME-tools perl-DBD-SQLite binutils glibc-devel perl-Filesys-Df zlib unzip zlib-devel wget mlocate clamav "perl(DBD::mysql)" + +rpm -Uvh https://forensics.cert.org/centos/cert/7/x86_64/unrar-5.4.0-1.el7.x86_64.rpm +export PERL_MM_USE_DEFAULT=1 +curl -L https://cpanmin.us | perl - App::cpanminus +perl -MCPAN -e 'install Encoding::FixLatin' +perl -MCPAN -e 'install Digest::SHA1' +perl -MCPAN -e 'install Geo::IP' +perl -MCPAN -e 'install Razor2::Client::Agent' +perl -MCPAN -e 'install Net::Patricia' + +freshclam -v +DIR=/etc/mail/spamassassin + +if [ -d "$DIR" ]; then +sa-update + +else + +echo "Please install spamassassin through the CyberPanel interface before proceeding" + +exit +fi + +elif [ "$CENTOSVERSION" = "VERSION_ID=\"8\"" ];then + +setenforce 0 +yum install -y perl yum-utils perl-CPAN +dnf --enablerepo=PowerTools install -y perl-IO-stringy +yum install -y gcc cpp perl bzip2 zip make patch automake rpm-build perl-Archive-Zip perl-Filesys-Df perl-OLE-Storage_Lite perl-Net-CIDR perl-DBI perl-MIME-tools perl-DBD-SQLite binutils glibc-devel perl-Filesys-Df zlib unzip zlib-devel wget mlocate clamav clamav-update "perl(DBD::mysql)" + +rpm -Uvh https://forensics.cert.org/centos/cert/8/x86_64/unrar-5.4.0-1.el8.x86_64.rpm + +export PERL_MM_USE_DEFAULT=1 +curl -L https://cpanmin.us | perl - App::cpanminus + +perl -MCPAN -e 'install Encoding::FixLatin' +perl -MCPAN -e 'install Digest::SHA1' +perl -MCPAN -e 'install Geo::IP' +perl -MCPAN -e 'install Razor2::Client::Agent' +perl -MCPAN -e 'install Sys::Hostname::Long' +perl -MCPAN -e 'install Sys::SigAction' + + + +freshclam -v + +DIR=/etc/mail/spamassassin + +if [ -d "$DIR" ]; then +sa-update + +else + +echo "Please install spamassassin through the CyberPanel interface before proceeding" + +exit +fi + +elif [ "$OS" = "NAME=\"Ubuntu\"" ];then + + apt-get install -y libmysqlclient-dev + + apt-get install -y cpanminus gcc perl bzip2 zip make patch automake rpm libarchive-zip-perl libfilesys-df-perl libole-storage-lite-perl libsys-hostname-long-perl libsys-sigaction-perl libregexp-common-net-cidr-perl libmime-tools-perl libdbd-sqlite3-perl binutils build-essential libfilesys-df-perl zlib1g unzip mlocate clamav libdbd-mysql-perl unrar libclamav-dev libclamav-client-perl libclamunrar9 + +cpanm Encoding::FixLatin +cpanm Digest::SHA1 +cpanm Geo::IP +cpanm Razor2::Client::Agent +cpanm Net::Patricia +cpanm Net::CIDR + +sudo systemctl stop clamav-freshclam.service + +freshclam + +sudo systemctl start clamav-freshclam.service + +DIR=/etc/spamassassin +if [ -d "$DIR" ]; then + +apt-get -y install razor pyzor libencode-detect-perl libgeo-ip-perl libnet-patricia-perl +sa-update +else +echo "Please install spamassassin through the CyberPanel interface before proceeding" +exit +fi + +fi + +echo "header_checks = regexp:/etc/postfix/header_checks" >> /etc/postfix/main.cf +echo "/^Received:/ HOLD" >> /etc/postfix/header_checks + +systemctl restart postfix + +if [ "$OS" = "NAME=\"Ubuntu\"" ];then +wget https://github.com/MailScanner/v5/releases/download/5.3.3-1/MailScanner-5.3.3-1.noarch.deb +dpkg -i *.noarch.deb + +mkdir /var/run/MailScanner +mkdir /var/lock/subsys +mkdir /var/lock/subsys/MailScanner +chown -R postfix:postfix /var/run/MailScanner +chown -R postfix:postfix /var/lock/subsys/MailScanner +chown -R postfix:postfix /var/spool/MailScanner + +elif [ "$OS" = "NAME=\"CentOS Linux\"" ];then +wget https://github.com/MailScanner/v5/releases/download/5.3.3-1/MailScanner-5.3.3-1.rhel.noarch.rpm +rpm -Uvh *.rhel.noarch.rpm +fi + +mkdir /var/spool/MailScanner/spamassassin + +chown postfix.mtagroup /var/spool/MailScanner/spamassassin +chown root.mtagroup /var/spool/MailScanner/incoming/ +chown postfix.mtagroup /var/spool/MailScanner/milterin +chown postfix.mtagroup /var/spool/MailScanner/milterout +chown postfix.mtagroup /var/spool/postfix/hold +chown postfix.mtagroup /var/spool/postfix/incoming +usermod -a -G mtagroup nobody + +chmod g+rx /var/spool/postfix/incoming +chmod g+rx /var/spool/postfix/hold +chmod -R 0775 /var/spool/postfix/incoming +chmod -R 0775 /var/spool/postfix/hold + +sed -i 's/^Run As User =.*/& postfix/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Run As Group =.*/& postfix/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Incoming Queue Dir =.*/Incoming Queue Dir = \/var\/spool\/postfix\/hold/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Outgoing Queue Dir =.*/Outgoing Queue Dir = \/var\/spool\/postfix\/incoming/' /etc/MailScanner/MailScanner.conf +sed -i 's/^MTA =.*/MTA = postfix/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Quarantine User =.*/& postfix/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Quarantine Group =.*/& mtagroup/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Quarantine Permissions =.*/Quarantine Permissions = 640/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Virus Scanners =.*/Virus Scanners = clamav/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Is Definitely Not Spam =.*/Is Definitely Not Spam = \&SQLWhitelist/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Is Definitely Spam =.*/Is Definitely Spam = \&SQLBlacklist/' /etc/MailScanner/MailScanner.conf +sed -i 's/^SpamAssassin User State Dir =.*/& \/var\/spool\/MailScanner\/spamassassin/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Always Looked Up Last =.*/Always Looked Up Last = \&MailWatchLogging/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Quarantine Whole Message =.*/Quarantine Whole Message = yes/' /etc/MailScanner/MailScanner.conf +sed -i 's/^Spam List =.*/Spam List = SBL + XBL/' /etc/MailScanner/MailScanner.conf + +mkdir /usr/local/CyberCP/public/mailwatch + +cd /usr/local/CyberCP/public/mailwatch + +git clone --depth=1 https://github.com/mailwatch/MailWatch.git --branch 1.2 --single-branch + +mv /usr/local/CyberCP/public/mailwatch/MailWatch/* /usr/local/CyberCP/public/mailwatch/ + +PASSWORD=$(cat /etc/cyberpanel/mysqlPassword) +USER=root +DATABASE=mailscanner +ADMINPASS=$(cat /etc/cyberpanel/adminPass) +mysql -u${USER} -p${PASSWORD} < "/usr/local/CyberCP/public/mailwatch/create.sql" +mysql -u${USER} -p${PASSWORD} -e "use mailscanner"; +mysql -u${USER} -D${DATABASE} -p${PASSWORD} -e "GRANT ALL ON mailscanner.* TO root@localhost IDENTIFIED BY '${PASSWORD}';" +mysql -u${USER} -D${DATABASE} -p${PASSWORD} -e "FLUSH PRIVILEGES;" +mysql -u${USER} -D${DATABASE} -p${PASSWORD} -e "INSERT INTO mailscanner.users SET username = 'admin', password = MD5('${ADMINPASS}'), fullname = 'admin', type = 'A';" + +cp /usr/local/CyberCP/public/mailwatch/mailscanner/conf.php.example /usr/local/CyberCP/public/mailwatch/mailscanner/conf.php + +sed -i "s/^define('DB_USER',.*/define('DB_USER','root');/" /usr/local/CyberCP/public/mailwatch/mailscanner/conf.php +sed -i "s/^define('DB_PASS',.*/define('DB_PASS','${PASSWORD}');/" /usr/local/CyberCP/public/mailwatch/mailscanner/conf.php +sed -i "s/^define('MAILWATCH_HOME',.*/define(\'MAILWATCH_HOME\', \'\/usr\/local\/CyberCP\/public\/mailwatch\/mailscanner');/" /usr/local/CyberCP/public/mailwatch/mailscanner/conf.php + +MSDEFAULT=/etc/MailScanner/defaults +if [ -f "$MSDEFAULT" ];then +sed -i 's/^run_mailscanner=.*/run_mailscanner=1/' /etc/MailScanner/defaults +elif [ ! -f "$MSDEFAULT" ];then +touch /etc/MailScanner/defaults +echo "run_mailscanner=1" >> /etc/MailScanner/defaults +fi + +cp /usr/local/CyberCP/public/mailwatch/MailScanner_perl_scripts/MailWatchConf.pm /usr/share/MailScanner/perl/custom/ +sed -i 's/^my (\$db_user) = .*/my (\$db_user) = \x27'${USER}'\x27;/' /usr/share/MailScanner/perl/custom/MailWatchConf.pm +sed -i 's/^my (\$db_pass) = .*/my (\$db_pass) = \x27'${PASSWORD}'\x27;/' /usr/share/MailScanner/perl/custom/MailWatchConf.pm +ln -s /usr/local/CyberCP/public/mailwatch/MailScanner_perl_scripts/MailWatch.pm /usr/share/MailScanner/perl/custom +ln -s /usr/local/CyberCP/public/mailwatch/MailScanner_perl_scripts/SQLBlackWhiteList.pm /usr/share/MailScanner/perl/custom +ln -s /usr/local/CyberCP/public/mailwatch/MailScanner_perl_scripts/SQLSpamSettings.pm /usr/share/MailScanner/perl/custom +sed -i "s/^\$pathToFunctions =.*/\$pathToFunctions = '\/usr\/local\/CyberCP\/public\/mailwatch\/mailscanner\/functions.php';/" /usr/local/CyberCP/public/mailwatch/upgrade.php + +/usr/local/lsws/lsphp72/bin/php /usr/local/CyberCP/public/mailwatch/upgrade.php +systemctl enable mailscanner +systemctl restart mailscanner + +IPADDRESS=$(cat /etc/cyberpanel/machineIP) + + +echo 'Setting up spamassassin and sieve to deliver spam to Junk folder by default' +#echo "If you wish mailscanner/spamassassin to send spam email to a spam folder please follow the tutorial on the Cyberpanel Website" +echo 'Fix protocols' +sed -i 's/^protocols =.*/protocols = imap pop3 lmtp sieve/g' /etc/dovecot/dovecot.conf + + +sed -i "s|^user_query.*|user_query = SELECT '5000' as uid, '5000' as gid, '/home/vmail/%d/%n' as home,mail FROM e_users WHERE email='%u';|g" /etc/dovecot/dovecot-sql.conf.ext + +if [ "$OS" = "NAME=\"Ubuntu\"" ];then +if [ "$UBUNTUVERSION" = "VERSION_ID=\"18.04\"" ];then + apt-get install -y dovecot-managesieved dovecot-sieve dovecot-lmtpd net-tools pflogsumm +elif [ "$UBUNTUVERSION" = "VERSION_ID=\"20.04\"" ];then + apt-get install -y libmysqlclient-dev + sed -e '/deb/ s/^#*/#/' -i /etc/apt/sources.list.d/dovecot.list + apt install -y dovecot-lmtpd dovecot-managesieved dovecot-sieve net-tools pflogsumm +fi + +elif [ "$CENTOSVERSION" = "VERSION_ID=\"7\"" ];then + + yum install -y nano net-tools dovecot-pigeonhole postfix-perl-scripts + +elif [ "$CENTOSVERSION" = "VERSION_ID=\"8\"" ];then + + rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm + dnf --enablerepo=gf-plus upgrade -y dovecot23* + dnf --enablerepo=gf-plus install -y dovecot23-pigeonhole + dnf install -y net-tools postfix-perl-scripts + +fi + + +# Create Sieve files +mkdir -p /etc/dovecot/sieve/global +touch /var/log/{dovecot-lda-errors.log,dovecot-lda.log} +touch /var/log/{dovecot-sieve-errors.log,dovecot-sieve.log} +touch /var/log/{dovecot-lmtp-errors.log,dovecot-lmtp.log} +touch /etc/dovecot/sieve/default.sieve +chown vmail: -R /etc/dovecot/sieve +chown vmail:mail /var/log/dovecot-* + +echo 'Create Sieve Default spam to Junk rule' +cat >> /etc/dovecot/sieve/default.sieve <> /etc/dovecot/dovecot.conf < -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1 \ or value.find("`") > -1 or value.find("$") > -1 or value.find("(") > -1 or value.find(")") > -1 \ diff --git a/CyberCP/settings.py b/CyberCP/settings.py index ef656129d..86a9d022e 100755 --- a/CyberCP/settings.py +++ b/CyberCP/settings.py @@ -113,8 +113,8 @@ DATABASES = { 'NAME': 'cyberpanel', 'USER': 'cyberpanel', 'PASSWORD': 'Bz9gF7Hr7X4RtD', - 'HOST': '127.0.0.1', - 'PORT':'3307' + 'HOST': 'localhost', + 'PORT':'' }, 'rootdb': { 'ENGINE': 'django.db.backends.mysql', @@ -187,6 +187,7 @@ LANGUAGES = ( ('vi', _('Vietnamese')), ('it', _('Italian')), ('de', _('Deutsch')), + ('id', _('Indonesian')), ) MEDIA_URL = '/home/cyberpanel/media/' diff --git a/IncBackups/IncBackupsControl.py b/IncBackups/IncBackupsControl.py index 40c63f7bc..618c950a4 100644 --- a/IncBackups/IncBackupsControl.py +++ b/IncBackups/IncBackupsControl.py @@ -118,6 +118,24 @@ class IncJobs(multi.Thread): except BaseException as msg: logging.writeToFile(str(msg)) + ## Find restore path + + def findRestorePath(self): + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8 \ + or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: + self.restoreTarget = '/' + return 1 + else: + if self.jobid.type[:8] == 'database': + self.restoreTarget = '/home/cyberpanel/' + elif self.jobid.type[:4] == 'data': + self.restoreTarget = '/home/' + elif self.jobid.type[:5] == 'email': + self.restoreTarget = '/home/vmail/' + elif self.jobid.type[:4] == 'meta': + self.restoreTarget = '/home/%s/' % (self.website) + #### def getAWSData(self): @@ -159,9 +177,9 @@ class IncJobs(multi.Thread): key, secret = self.getAWSData() - command = 'export RESTIC_PASSWORD=%s AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s && restic -r s3:s3.amazonaws.com/%s restore %s --target /' % ( + command = 'export RESTIC_PASSWORD=%s AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s && restic -r s3:s3.amazonaws.com/%s restore %s --target %s' % ( self.passwordFile, - key, secret, self.website, snapshotID) + key, secret, self.website, snapshotID, self.restoreTarget) result = ProcessUtilities.outputExecutioner(command) @@ -173,8 +191,8 @@ class IncJobs(multi.Thread): key, secret = self.getAWSData() - command = 'export AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s && restic -r s3:s3.amazonaws.com/%s restore %s --password-file %s --target /' % ( - key, secret, self.website, snapshotID, self.passwordFile) + command = 'export AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s && restic -r s3:s3.amazonaws.com/%s restore %s --password-file %s --target %s' % ( + key, secret, self.website, snapshotID, self.passwordFile, self.restoreTarget) result = ProcessUtilities.outputExecutioner(command) @@ -213,8 +231,8 @@ class IncJobs(multi.Thread): return 1 else: repoLocation = '/home/%s/incbackup' % (self.website) - command = 'restic -r %s restore %s --target / --password-file %s' % ( - repoLocation, self.jobid.snapshotid, self.passwordFile) + command = 'restic -r %s restore %s --target %s --password-file %s' % ( + repoLocation, self.jobid.snapshotid, self.restoreTarget, self.passwordFile) result = ProcessUtilities.outputExecutioner(command) @@ -250,17 +268,17 @@ class IncJobs(multi.Thread): else: if self.reconstruct == 'remote': repoLocation = '/home/backup/%s' % (self.website) - command = 'export RESTIC_PASSWORD=%s PATH=${PATH}:/usr/bin && restic -r %s:%s restore %s --target /' % ( + command = 'export RESTIC_PASSWORD=%s PATH=${PATH}:/usr/bin && restic -r %s:%s restore %s --target %s' % ( self.passwordFile, - self.backupDestinations, repoLocation, self.jobid) + self.backupDestinations, repoLocation, self.jobid, self.restoreTarget) result = ProcessUtilities.outputExecutioner(command) if result.find('restoring') == -1: logging.statusWriter(self.statusPath, 'Failed: %s. [5009]' % (result), 1) return 0 else: repoLocation = '/home/backup/%s' % (self.website) - command = 'export PATH=${PATH}:/usr/bin && restic -r %s:%s restore %s --target / --password-file %s' % ( - self.jobid.destination, repoLocation, self.jobid.snapshotid, self.passwordFile) + command = 'export PATH=${PATH}:/usr/bin && restic -r %s:%s restore %s --target %s --password-file %s' % ( + self.jobid.destination, repoLocation, self.jobid.snapshotid, self.restoreTarget, self.passwordFile) result = ProcessUtilities.outputExecutioner(command) if result.find('restoring') == -1: logging.statusWriter(self.statusPath, 'Failed: %s. [5009]' % (result), 1) @@ -448,8 +466,11 @@ class IncJobs(multi.Thread): message = 'Reconstructed' logging.statusWriter(self.statusPath, message, 1) else: + self.jobid = JobSnapshots.objects.get(pk=jobid) + self.findRestorePath() + message = 'Starting restore of %s for %s.' % (self.jobid.snapshotid, self.website) logging.statusWriter(self.statusPath, message, 1) self.passwordFile = '/home/%s/%s' % (self.website, self.website) diff --git a/IncBackups/views.py b/IncBackups/views.py index 9ba6b1afc..fe229f0c9 100644 --- a/IncBackups/views.py +++ b/IncBackups/views.py @@ -100,10 +100,16 @@ def addDestination(request): execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \ - + password + " --port " + port + + password + " --port " + port + ' --user %s' % ('root') + + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(execPath) output = ProcessUtilities.outputExecutioner(execPath) + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(output) + if output.find('1,') > -1: content = '%s\n%s' % (ipAddress, port) diff --git a/WebTerminal/CPWebSocket.py b/WebTerminal/CPWebSocket.py index 28cffc428..d9a449328 100644 --- a/WebTerminal/CPWebSocket.py +++ b/WebTerminal/CPWebSocket.py @@ -1,19 +1,18 @@ -#!/usr/local/CyberCP/bin/python +import tornado.httpserver +import tornado.websocket +import tornado.ioloop +import tornado.web import sys import os -import django sys.path.append('/usr/local/CyberCP') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging -import signal -import sys -import ssl -from SimpleWebSocketServer import WebSocket, SimpleSSLWebSocketServer import paramiko import os import json import threading as multi import time +import asyncio class SSHServer(multi.Thread): @@ -34,7 +33,7 @@ class SSHServer(multi.Thread): else: SSHServer.DEFAULT_PORT = int(items.split(' ')[1]) except BaseException as msg: - logging.writeToFile(str(msg)) + logging.writeToFile('%s. [SSHServer.findSSHPort]' % (str(msg))) def loadPublicKey(self): pubkey = '/root/.ssh/cyberpanel.pub' @@ -73,79 +72,90 @@ class SSHServer(multi.Thread): self.color = 0 def recvData(self): + asyncio.set_event_loop(asyncio.new_event_loop()) while True: try: if self.websocket.running: - if os.path.exists(self.websocket.verifyPath): - if self.websocket.filePassword == self.websocket.password: - if self.shell.recv_ready(): - if self.color == 0: - text = '%sEnjoy your accelerated Internet by CyberPanel and LiteSpeed%s' % (SSHServer.OKGREEN, SSHServer.ENDC) - nText = 'Enjoy your accelerated Internet by CyberPanel' - self.websocket.sendMessage(self.shell.recv(9000).decode("utf-8").replace(nText, text)) - self.color = 1 - else: - self.websocket.sendMessage(self.shell.recv(9000).decode("utf-8")) - else: - time.sleep(0.01) + if os.path.exists(self.verifyPath) and self.filePassword == self.password: + if self.shell.recv_ready(): + self.websocket.write_message(self.shell.recv(9000).decode("utf-8")) + else: + time.sleep(0.001) + else: + return 0 else: return 0 except BaseException as msg: - time.sleep(0.1) + print('%s. [recvData]' % str(msg)) + time.sleep(0.001) def run(self): try: self.recvData() except BaseException as msg: - print((str(msg))) + print('%s. [SSHServer.run]' % (str(msg))) +class WSHandler(tornado.websocket.WebSocketHandler): -class WebTerminalServer(WebSocket): + def open(self): + print('connected') + self.running = 1 + self.sh = SSHServer(self) + self.shell = self.sh.shell + self.sh.start() + self.init = 1 + print('connect ok') - def handleMessage(self): - try: - data = json.loads(self.data) - if str(self.data).find('"tp":"init"') > -1: - self.verifyPath = str(data['data']['verifyPath']) - self.password = str(data['data']['password']) - self.filePassword = open(self.verifyPath, 'r').read() - else: - if os.path.exists(self.verifyPath): - if self.filePassword == self.password: - self.shell.send(str(data['data'])) - except: - pass + def on_message(self, message): + try: + print('handle message') + data = json.loads(message) - def handleConnected(self): - self.running = 1 - self.sh = SSHServer(self) - self.shell = self.sh.shell - self.sh.start() + if self.init: + self.sh.verifyPath = str(data['data']['verifyPath']) + self.sh.password = str(data['data']['password']) + self.sh.filePassword = open(self.sh.verifyPath, 'r').read() + self.init = 0 + else: + if os.path.exists(self.sh.verifyPath): + if self.sh.filePassword == self.sh.password: + self.shell.send(str(data['data'])) - def handleClose(self): - try: - os.remove(self.verifyPath) - self.running = 0 - except: - pass + except BaseException as msg: + print('%s. [WebTerminalServer.handleMessage]' % (str(msg))) + def on_close(self): + print('connection closed') + + def check_origin(self, origin): + return True + +application = tornado.web.Application([ + (r'/', WSHandler), +]) if __name__ == "__main__": - pidfile = '/usr/local/CyberCP/WebTerminal/pid' - writeToFile = open(pidfile, 'w') - writeToFile.write(str(os.getpid())) - writeToFile.close() + pidfile = '/usr/local/CyberCP/WebTerminal/pid' - SSHServer.findSSHPort() + writeToFile = open(pidfile, 'w') + writeToFile.write(str(os.getpid())) + writeToFile.close() - print ('SSH Port is set to: %s' % (str(SSHServer.DEFAULT_PORT))) + http_server = tornado.httpserver.HTTPServer(application, ssl_options={ + "certfile": "/usr/local/lscp/conf/cert.pem", + "keyfile": "/usr/local/lscp/conf/key.pem", + }, ) - server = SimpleSSLWebSocketServer('0.0.0.0', '5678', WebTerminalServer, '/usr/local/lscp/conf/cert.pem', '/usr/local/lscp/conf/key.pem', version=ssl.PROTOCOL_TLSv1) + ADDR = '0.0.0.0' + http_server.listen(5678, ADDR) + print('*** Websocket Server Started at %s***' % ADDR) - def close_sig_handler(signal, frame): - server.close() - sys.exit() + import signal + def close_sig_handler(signal, frame): + http_server.stop() + sys.exit() - signal.signal(signal.SIGINT, close_sig_handler) - server.serveforever() \ No newline at end of file + signal.signal(signal.SIGINT, close_sig_handler) + + tornado.ioloop.IOLoop.instance().start() \ No newline at end of file diff --git a/WebTerminal/static/WebTerminal/main.js b/WebTerminal/static/WebTerminal/main.js index f7443fdbe..248737afc 100755 --- a/WebTerminal/static/WebTerminal/main.js +++ b/WebTerminal/static/WebTerminal/main.js @@ -73,16 +73,6 @@ function connect() { if (remember) { store(options) } - // if (check()) { - // openTerminal(options) - // } else { - // for (var key in validResult) { - // if (!validResult[key]) { - // alert(errorMsg[key]); - // break; - // } - // } - // } openTerminal(options) } diff --git a/WebTerminal/templates/WebTerminal/WebTerminal.html b/WebTerminal/templates/WebTerminal/WebTerminal.html index 81d21e451..75bea2190 100755 --- a/WebTerminal/templates/WebTerminal/WebTerminal.html +++ b/WebTerminal/templates/WebTerminal/WebTerminal.html @@ -7,15 +7,13 @@ {% get_current_language as LANGUAGE_CODE %} - - -

{% trans "Terminal" %} - {% trans "Web Terminal Docs" %}

+ style="height: 23px;line-height: 21px;" + class="btn btn-border btn-alt border-red btn-link font-red" + title="">{% trans "Web Terminal Docs" %}

{% trans "Execute your terminal commands." %}

@@ -50,5 +48,4 @@
- {% endblock %} diff --git a/api/views.py b/api/views.py index 49758343e..52323f091 100755 --- a/api/views.py +++ b/api/views.py @@ -622,7 +622,6 @@ def runAWSBackups(request): except BaseException as msg: logging.writeToFile(str(msg) + ' [API.runAWSBackups]') - @csrf_exempt def submitUserCreation(request): try: diff --git a/backup/backupManager.py b/backup/backupManager.py index 161a645ad..eb9f4fe73 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -9,7 +9,7 @@ django.setup() import json from plogical.acl import ACLManager import plogical.CyberCPLogFileWriter as logging -from websiteFunctions.models import Websites, Backups, dest, backupSchedules +from websiteFunctions.models import Websites, Backups, dest, backupSchedules, BackupJob, BackupJobLogs from plogical.virtualHostUtilities import virtualHostUtilities import subprocess import shlex @@ -407,46 +407,65 @@ class BackupManager: destinations = backupUtil.backupUtilities.destinationsPath - ipAddress = data['IPAddress'] - password = data['password'] + finalDic = {} + + finalDic['ipAddress'] = data['IPAddress'] + finalDic['password'] = data['password'] + + try: + finalDic['port'] = data['backupSSHPort'] + except: + finalDic['port'] = "22" + + try: + finalDic['user'] = data['user'] + except: + finalDic['user'] = "root" if dest.objects.all().count() == 2: + final_dic = {'destStatus': 0, 'error_message': "Currently only one remote destination is allowed."} final_json = json.dumps(final_dic) return HttpResponse(final_json) + try: - d = dest.objects.get(destLoc=ipAddress) + d = dest.objects.get(destLoc=finalDic['password']) final_dic = {'destStatus': 0, 'error_message': "This destination already exists."} final_json = json.dumps(final_dic) return HttpResponse(final_json) except: - try: - port = data['backupSSHPort'] - except: - port = "22" - execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" - execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \ - + password + " --port " + port + execPath = execPath + " submitDestinationCreation --ipAddress " + finalDic['ipAddress'] + " --password " \ + + finalDic['password'] + " --port " + finalDic['port'] + ' --user %s' % (finalDic['user']) + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(execPath) output = ProcessUtilities.outputExecutioner(execPath) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(output) + + if output.find('1,') > -1: try: writeToFile = open(destinations, "w") - writeToFile.writelines(ipAddress + "\n") - writeToFile.writelines(data['backupSSHPort'] + "\n") + writeToFile.write(json.dumps(finalDic)) writeToFile.close() - newDest = dest(destLoc=ipAddress) + newDest = dest(destLoc=finalDic['ipAddress']) newDest.save() + + final_dic = {'destStatus': 1, 'error_message': "None"} + final_json = json.dumps(final_dic) + return HttpResponse(final_json) except: writeToFile = open(destinations, "w") - writeToFile.writelines(ipAddress + "\n") - writeToFile.writelines("22" + "\n") + writeToFile.write(json.dumps(finalDic)) writeToFile.close() - newDest = dest(destLoc=ipAddress) + + newDest = dest(destLoc=finalDic['ipAddress']) newDest.save() final_dic = {'destStatus': 1, 'error_message': "None"} @@ -1096,32 +1115,27 @@ class BackupManager: time.sleep(3) - if os.path.isfile(backupLogPath): - command = "sudo cat " + backupLogPath - status = ProcessUtilities.outputExecutioner(command) + command = "sudo cat " + backupLogPath + status = ProcessUtilities.outputExecutioner(command) - if status.find("completed[success]") > -1: - command = "rm -rf " + removalPath - ProcessUtilities.executioner(command) - data_ret = {'remoteTransferStatus': 1, 'error_message': "None", "status": status, "complete": 1} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - elif status.find("[5010]") > -1: - command = "sudo rm -rf " + removalPath - ProcessUtilities.executioner(command) - data = {'remoteTransferStatus': 0, 'error_message': status, - "status": "None", "complete": 0} - json_data = json.dumps(data) - return HttpResponse(json_data) - else: - data_ret = {'remoteTransferStatus': 1, 'error_message': "None", "status": status, "complete": 0} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - else: - data_ret = {'remoteTransferStatus': 0, 'error_message': "No such log found", "status": "None", - "complete": 0} + if status.find("completed[success]") > -1: + command = "rm -rf " + removalPath + ProcessUtilities.executioner(command) + data_ret = {'remoteTransferStatus': 1, 'error_message': "None", "status": status, "complete": 1} json_data = json.dumps(data_ret) return HttpResponse(json_data) + elif status.find("[5010]") > -1: + command = "sudo rm -rf " + removalPath + ProcessUtilities.executioner(command) + data = {'remoteTransferStatus': 0, 'error_message': status, + "status": "None", "complete": 0} + json_data = json.dumps(data) + return HttpResponse(json_data) + else: + data_ret = {'remoteTransferStatus': 1, 'error_message': "None", "status": status, "complete": 0} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + except BaseException as msg: data = {'remoteTransferStatus': 0, 'error_message': str(msg), "status": "None", "complete": 0} json_data = json.dumps(data) @@ -1172,3 +1186,96 @@ class BackupManager: data = {'cancelStatus': 0, 'error_message': str(msg)} json_data = json.dumps(data) return HttpResponse(json_data) + + def backupLogs(self, request = None, userID = None, data = None): + try: + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + all_files = [] + + logFiles = BackupJob.objects.all().order_by('-id') + + for logFile in logFiles: + all_files.append(logFile.logFile) + + return render(request, 'backup/backupLogs.html', {'backups': all_files}) + + except BaseException as msg: + return HttpResponse(str(msg)) + + def fetchLogs(self, userID = None, data = None): + try: + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + page = int(str(data['page']).rstrip('\n')) + recordsToShow = int(data['recordsToShow']) + logFile = data['logFile'] + + logJob = BackupJob.objects.get(logFile=logFile) + + logs = logJob.backupjoblogs_set.all() + + from s3Backups.s3Backups import S3Backups + from plogical.backupSchedule import backupSchedule + + pagination = S3Backups.getPagination(len(logs), recordsToShow) + endPageNumber, finalPageNumber = S3Backups.recordsPointer(page, recordsToShow) + finalLogs = logs[finalPageNumber:endPageNumber] + + json_data = "[" + checker = 0 + counter = 0 + + for log in finalLogs: + + if log.status == backupSchedule.INFO: + status = 'INFO' + else: + status = 'ERROR' + + dic = { + 'LEVEL': status, "Message": log.message + } + if checker == 0: + json_data = json_data + json.dumps(dic) + checker = 1 + else: + json_data = json_data + ',' + json.dumps(dic) + counter = counter + 1 + + json_data = json_data + ']' + + if logJob.location == backupSchedule.LOCAL: + location = 'local' + else: + location = 'remote' + + + data = { + 'status': 1, + 'error_message': 'None', + 'logs': json_data, + 'pagination': pagination, + 'jobSuccessSites': logJob.jobSuccessSites, + 'jobFailedSites': logJob.jobFailedSites, + 'location': location + } + + + json_data = json.dumps(data) + return HttpResponse(json_data) + + except BaseException as msg: + data = {'remoteRestoreStatus': 0, 'error_message': str(msg)} + json_data = json.dumps(data) + return HttpResponse(json_data) diff --git a/backup/static/backup/backup.js b/backup/static/backup/backup.js index 9c158422b..59c654f87 100755 --- a/backup/static/backup/backup.js +++ b/backup/static/backup/backup.js @@ -416,7 +416,7 @@ app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) { }); -//*** Resotre site ends here ***/// +//*** Restore site ends here ***/// ///** Backup Destination ***// @@ -448,6 +448,7 @@ app.controller('backupDestinations', function ($scope, $http, $timeout) { var data = { IPAddress: $scope.IPAddress, password: $scope.password, + user: $scope.user, backupSSHPort: $scope.backupSSHPort, }; @@ -1346,6 +1347,7 @@ app.controller('remoteBackupControl', function ($scope, $http, $timeout) { $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { + $scope.backupProcessStarted = true; if (response.data.remoteTransferStatus === 1) { @@ -1539,4 +1541,68 @@ app.controller('remoteBackupControl', function ($scope, $http, $timeout) { }); -///** Backup site ends **/// \ No newline at end of file +///** Backup site ends **/// + + +//*** Remote Backup site ****// +app.controller('backupLogsScheduled', function ($scope, $http, $timeout) { + + $scope.cyberpanelLoading = true; + $scope.logDetails = true; + + $scope.currentPage = 1; + $scope.recordsToShow = 10; + + $scope.fetchLogs = function () { + + $scope.cyberpanelLoading = false; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + logFile: $scope.logFile, + recordsToShow: $scope.recordsToShow, + page: $scope.currentPage + }; + + dataurl = "/backup/fetchLogs"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + $scope.logDetails = false; + $scope.logs = JSON.parse(response.data.logs); + $scope.pagination = response.data.pagination; + $scope.jobSuccessSites = response.data.jobSuccessSites; + $scope.jobFailedSites = response.data.jobFailedSites; + $scope.location = response.data.location; + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + } + function cantLoadInitialData(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + + }; + + +}); + +///** Backup site ends **/// diff --git a/backup/templates/backup/backupDestinations.html b/backup/templates/backup/backupDestinations.html index 06a97e21b..5ab7e5ad9 100755 --- a/backup/templates/backup/backupDestinations.html +++ b/backup/templates/backup/backupDestinations.html @@ -33,6 +33,13 @@ +
+ +
+ +
+
+
@@ -48,7 +55,6 @@
-
diff --git a/backup/templates/backup/backupLogs.html b/backup/templates/backup/backupLogs.html new file mode 100755 index 000000000..2736eddef --- /dev/null +++ b/backup/templates/backup/backupLogs.html @@ -0,0 +1,125 @@ +{% extends "baseTemplate/index.html" %} +{% load i18n %} +{% block title %}{% trans "Backup Logs - CyberPanel" %}{% endblock %} +{% block content %} + + {% load static %} + + {% get_current_language as LANGUAGE_CODE %} + + + +
+
+

{% trans "Backup Logs" %}

+

{% trans "On this page you can view detailed logs of your local and remote scheduled backups." %}

+
+ +
+
+

+ {% trans "Backup Logs" %} +

+
+ +
+ + +
+ +
+ +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
{% trans "Successful Sites" %}{% trans "Failed Sites" %}{% trans "Location" %}
{$ jobSuccessSites $}{$ jobFailedSites $}{$ location $}
+
+
+ +
+ +
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + +
{% trans "LEVEL" %}{% trans "Message" %}
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ + +
+ + +{% endblock %} \ No newline at end of file diff --git a/backup/templates/backup/backupSchedule.html b/backup/templates/backup/backupSchedule.html index 69de37618..6fb11b5b5 100755 --- a/backup/templates/backup/backupSchedule.html +++ b/backup/templates/backup/backupSchedule.html @@ -11,7 +11,7 @@

{% trans "Schedule Back up" %} - {% trans "Remote Backups" %}

{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}

@@ -20,8 +20,11 @@

- {% trans "Schedule Back up" %} + {% trans "Schedule Back up" %} - {% trans "Backup Logs" %}

diff --git a/backup/urls.py b/backup/urls.py index 0a7164ba2..9d09770a5 100755 --- a/backup/urls.py +++ b/backup/urls.py @@ -48,7 +48,7 @@ urlpatterns = [ url(r'^localInitiate$', views.localInitiate, name='localInitiate'), - - + url(r'^backupLogs$', views.backupLogs, name='backupLogs'), + url(r'^fetchLogs$', views.fetchLogs, name='fetchLogs'), ] \ No newline at end of file diff --git a/backup/views.py b/backup/views.py index ef8842283..bf6512c25 100755 --- a/backup/views.py +++ b/backup/views.py @@ -327,6 +327,23 @@ def cancelRemoteBackup(request): except KeyError: return redirect(loadLoginPage) +def backupLogs(request): + try: + userID = request.session['userID'] + bm = BackupManager() + return bm.backupLogs(request, userID) + except KeyError: + return redirect(loadLoginPage) + +def fetchLogs(request): + try: + userID = request.session['userID'] + + wm = BackupManager() + return wm.fetchLogs(userID, json.loads(request.body)) + + except KeyError: + return redirect(loadLoginPage) @csrf_exempt def localInitiate(request): diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 789de56ea..0b3236ded 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -765,6 +765,9 @@
  • {% trans "Services Status" %}
  • +
  • {% trans "Package Manager" %} +
  • @@ -874,6 +877,9 @@
  • {% trans "Email Marketing" %}
  • +
  • {% trans "MailScanner" %} +
  • diff --git a/baseTemplate/urls.py b/baseTemplate/urls.py index 31a0ed8c5..b904ed09b 100755 --- a/baseTemplate/urls.py +++ b/baseTemplate/urls.py @@ -13,6 +13,4 @@ urlpatterns = [ url(r'^UpgradeStatus',views.upgradeStatus, name='UpgradeStatus'), url(r'^upgradeVersion',views.upgradeVersion, name='upgradeVersion'), - - ] \ No newline at end of file diff --git a/baseTemplate/views.py b/baseTemplate/views.py index e293bf359..2fee1a4d1 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -19,7 +19,7 @@ from plogical.processUtilities import ProcessUtilities # Create your views here. VERSION = '2.0' -BUILD = 0 +BUILD = 1 @ensure_csrf_cookie def renderBase(request): @@ -59,7 +59,7 @@ def getAdminStatus(request): pdns = PDNSStatus.objects.get(pk=1) currentACL['dnsAsWhole'] = pdns.serverStatus except: - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: pdnsPath = '/etc/powerdns' else: pdnsPath = '/etc/pdns' diff --git a/cli/cliParser.py b/cli/cliParser.py index 3fae89593..a6e6752b0 100755 --- a/cli/cliParser.py +++ b/cli/cliParser.py @@ -54,4 +54,13 @@ class cliParser: parser.add_argument('--userName', help='Email Username.') parser.add_argument('--password', help='Email password.') + ### Additional Arguments for user manager + + parser.add_argument('--firstName', help='First name while creating user.') + parser.add_argument('--lastName', help='First name while creating user.') + parser.add_argument('--websitesLimit', help='Website limit while creating user.') + parser.add_argument('--selectedACL', help='Select ACL while creating user.') + parser.add_argument('--securityLevel', help='Set security level while creating user.') + parser.add_argument('--state', help='State value used in user suspension.') + return parser.parse_args() \ No newline at end of file diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index e2e6c98c7..b04273bf5 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -1323,6 +1323,155 @@ def main(): currentversion = version + '.' + build print (currentversion) + ### User Functions + + elif args.function == "createUser": + + completeCommandExample = 'cyberpanel createUser --firstName Cyber --lastName Panel --email email@cyberpanel.net --userName cyberpanel --password securepassword --websitesLimit 10 --selectedACL user --securityLevel HIGH' + + if not args.firstName: + print("\n\nPlease enter First Name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.lastName: + print("\n\nPlease enter Last Name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.email: + print("\n\nPlease enter Email. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.userName: + print("\n\nPlease enter User name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.password: + print("\n\nPlease enter password. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.websitesLimit: + print("\n\nPlease enter website limit. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.selectedACL: + print("\n\nPlease enter select acl. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.securityLevel: + print("\n\nPlease set security level. For example:\n\n" + completeCommandExample + "\n\n") + return + + from userManagment.views import submitUserCreation + + data = {} + data['firstName'] = args.firstName + data['lastName'] = args.lastName + data['email'] = args.email + data['userName'] = args.userName + data['password'] = args.password + data['websitesLimit'] = args.websitesLimit + data['selectedACL'] = args.selectedACL + data['securityLevel'] = args.securityLevel + data['userID'] = 1 + + response = submitUserCreation(data) + + print(response.content.decode()) + + elif args.function == "deleteUser": + + completeCommandExample = 'cyberpanel deleteUser --userName cyberpanel' + + if not args.userName: + print("\n\nPlease enter User Name. For example:\n\n" + completeCommandExample + "\n\n") + return + + from userManagment.views import submitUserDeletion + + data = {} + data['accountUsername'] = args.userName + data['userID'] = 1 + + response = submitUserDeletion(data) + + print(response.content.decode()) + + elif args.function == "listUsers": + + from userManagment.views import fetchTableUsers + data = {} + data['userID'] = 1 + response = fetchTableUsers(data) + + print(response.content.decode()) + + elif args.function == "suspendUser": + + completeCommandExample = 'cyberpanel suspendUser --userName cyberpanel --state SUSPEND' + + if not args.userName: + print("\n\nPlease enter User Name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.state: + print("\n\nPlease enter state value i.e SUSPEND/UnSuspend. For example:\n\n" + completeCommandExample + "\n\n") + return + + from userManagment.views import controlUserState + + data = {} + data['accountUsername'] = args.userName + data['state'] = args.state + data['userID'] = 1 + + response = controlUserState(data) + + print(response.content.decode()) + + elif args.function == "editUser": + + completeCommandExample = 'cyberpanel editUser --userName cyberpanel --firstName Cyber --lastName Panel --email email@cyberpanel.net --password securepassword --securityLevel HIGH' + + if not args.firstName: + print("\n\nPlease enter First Name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.lastName: + print("\n\nPlease enter Last Name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.email: + print("\n\nPlease enter Email. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.userName: + print("\n\nPlease enter User name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.password: + print("\n\nPlease enter password. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.securityLevel: + print("\n\nPlease set security level. For example:\n\n" + completeCommandExample + "\n\n") + return + + from userManagment.views import saveModifications + + data = {} + data['accountUsername'] = args.userName + data['firstName'] = args.firstName + data['lastName'] = args.lastName + data['email'] = args.email + data['passwordByPass'] = args.password + data['securityLevel'] = args.securityLevel + data['userID'] = 1 + + response = saveModifications(data) + + print(response.content.decode()) + + if __name__ == "__main__": diff --git a/cloudAPI/cloudManager.py b/cloudAPI/cloudManager.py index 1cb8eb780..ffab613c2 100755 --- a/cloudAPI/cloudManager.py +++ b/cloudAPI/cloudManager.py @@ -948,6 +948,7 @@ class CloudManager: def systemStatus(self, request): try: + request.session['userID'] = self.admin.pk return topProcessesStatus(request) except BaseException as msg: return self.ajaxPre(0, str(msg)) @@ -1079,7 +1080,7 @@ class CloudManager: finalData['ramInGB'] = inGB - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: finalData['conf'] = ProcessUtilities.outputExecutioner('sudo cat /etc/my.cnf') else: finalData['conf'] = ProcessUtilities.outputExecutioner('sudo cat /etc/mysql/my.cnf') diff --git a/cloudAPI/urls.py b/cloudAPI/urls.py index 2c9619e7b..f87e369b5 100755 --- a/cloudAPI/urls.py +++ b/cloudAPI/urls.py @@ -3,4 +3,5 @@ from . import views urlpatterns = [ url(r'^$', views.router, name='router'), + url(r'^access$', views.access, name='access'), ] \ No newline at end of file diff --git a/cloudAPI/views.py b/cloudAPI/views.py index c8b98dcfe..d3d552dc3 100755 --- a/cloudAPI/views.py +++ b/cloudAPI/views.py @@ -4,8 +4,8 @@ from .cloudManager import CloudManager import json from loginSystem.models import Administrator -from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging from django.views.decorators.csrf import csrf_exempt +from django.shortcuts import HttpResponse @csrf_exempt def router(request): @@ -310,3 +310,26 @@ def router(request): except BaseException as msg: cm = CloudManager(None) return cm.ajaxPre(0, str(msg)) + +@csrf_exempt +def access(request): + try: + serverUserName = request.GET.get('serverUserName') + token = request.GET.get('token') + + admin = Administrator.objects.get(userName=serverUserName) + + if admin.api == 0: + return HttpResponse('API Access Disabled.') + + if token == admin.token.lstrip('Basic ').rstrip('='): + request.session['userID'] = admin.pk + from django.shortcuts import redirect + from baseTemplate.views import renderBase + return redirect(renderBase) + else: + return HttpResponse('Unauthorized access.') + + except BaseException as msg: + cm = CloudManager(None) + return cm.ajaxPre(0, str(msg)) diff --git a/cyberpanel.sh b/cyberpanel.sh index 3ca3db352..8baa63551 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1,11 +1,10 @@ #!/bin/bash -#CyberPanel installer script for CentOS 7.X, CentOS 8.X, CloudLinux 7.X and Ubuntu 18.04 +#CyberPanel installer script for CentOS 7.X, CentOS 8.X, CloudLinux 7.X, Ubuntu 18.04 and Ubuntu 20.04 SUDO_TEST=$(set) DEV="OFF" -BRANCH="stable" POSTFIX_VARIABLE="ON" POWERDNS_VARIABLE="ON" PUREFTPD_VARIABLE="ON" @@ -22,14 +21,28 @@ KEY_SIZE="" ADMIN_PASS="1234567" MEMCACHED="ON" REDIS="ON" -TOTAL_RAM=$(free -m | awk '/Mem\:/ { print $2 }') +TOTAL_RAM=$(free -m | awk '/Mem:/ { print $2 }') CENTOS_8="False" +UBUNTU_20="False" WATCHDOG="OFF" BRANCH_NAME="v${TEMP:12:3}.${TEMP:25:1}" VIRT_TYPE="" GIT_URL="github.com/usmannasir/cyberpanel" GIT_CONTENT_URL="raw.githubusercontent.com/usmannasir/cyberpanel" +disable_repos() { + +if [[ $SERVER_OS == "CentOS" ]] ; then + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Debuginfo.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Media.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Vault.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-CR.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-fasttrack.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Sources.repo +fi + +} check_return() { #check previous command result , 0 = ok , non-0 = something wrong. @@ -46,22 +59,6 @@ if [[ ! -f /usr/bin/cyberpanel_utility ]] ; then wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_utility.sh chmod 700 /usr/bin/cyberpanel_utility fi - -#BASH_PATH="/root/.bashrc" -#if ! cat $BASH_PATH | grep -q cyberpanel_utility ; then -#echo -e "\n\ncyberpanel() { -#if [[ \$1 == \"utility\" ]] ; then -#/usr/bin/cyberpanel_utility \${@:2:99} -#elif [[ \$1 == \"help\" ]] ; then -#/usr/bin/cyberpanel_utility --help -#elif [[ \$1 == \"upgrade\" ]] || [[ \$1 == \"update\" ]] ; then -#/usr/bin/cyberpanel_utility --upgrade -#else -#/usr/bin/cyberpanel \"\$@\" -#fi -#}" >> $BASH_PATH -#fi - } watchdog_setup() { @@ -193,6 +190,7 @@ special_change(){ sed -i 's|cyberpanel.sh|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|mirror.cyberpanel.net|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|git clone https://github.com/usmannasir/cyberpanel|echo downloaded|g' install.py + #change to CDN first, regardless country #sed -i 's|http://|https://|g' install.py @@ -257,44 +255,17 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then sed -i 's|wget -O - https://get.acme.sh \| sh|git clone https://gitee.com/qtwrk/acme.sh.git ; cd acme.sh ; ./acme.sh --install ; cd - ; rm -rf acme.sh|g' install.py sed -i 's|composer.sh|composer_cn.sh|g' install.py sed -i 's|yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm|wget -O /etc/yum.repos.d/lux.repo https://'$DOWNLOAD_SERVER'/lux/lux.repo|g' install.py + # global change for CN , regardless provider and system if [[ $SERVER_OS == "CentOS" ]] ; then - DIR=$(pwd) - cd $DIR/mysql - echo "[mariadb-tsinghua] -name = MariaDB -baseurl = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.1/centos7-amd64 -gpgkey = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum//RPM-GPG-KEY-MariaDB -gpgcheck = 1" > MariaDB.repo -#above to set mariadb db to Tsinghua repo - cd $DIR sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|https://cyberpanel.sh/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|g' installCyberPanel.py - mkdir /root/.config - mkdir /root/.config/pip - cat << EOF > /root/.config/pip/pip.conf -[global] -index-url = https://pypi.tuna.tsinghua.edu.cn/simple -[install] -trusted-host=pypi.tuna.tsinghua.edu.cn -EOF - echo -e "\nSet to Aliyun pip repo..." fi if [[ $SERVER_OS == "Ubuntu" ]] ; then echo $'\n89.208.248.38 rpms.litespeedtech.com\n' >> /etc/hosts echo -e "Mirror server set..." - pip config set global.index-url https://pypi.python.org/simple/ - mkdir /root/.config - mkdir /root/.config/pip - cat << EOF > /root/.config/pip/pip.conf -[global] -index-url = https://pypi.python.org/simple/ -[install] -trusted-host=pypi.python.org -EOF - echo -e "\nSet to Aliyun pip repo..." if [[ $PROVIDER == "Tencent Cloud" ]] ; then #tencent cloud and ubuntu system echo -e "\n Tencent Cloud detected ... bypass default repository" @@ -313,7 +284,6 @@ deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted univer deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse EOF DEBIAN_FRONTEND=noninteractive apt update -y - pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ fi fi fi @@ -398,19 +368,17 @@ fi install_required() { -if [[ $SERVER_COUNTRY == "CN" ]] ; then - mkdir /root/.config - mkdir /root/.config/pip - cat << EOF > /root/.config/pip/pip.conf -[global] -index-url = https://pypi.tuna.tsinghua.edu.cn/simple -[install] -trusted-host=pypi.tuna.tsinghua.edu.cn -EOF + +if [[ $CENTOS_8 == "True" ]] ; then + curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel8.repo > /etc/yum.repos.d/CyberPanel.repo + dnf install zip -y +elif [[ $CENTOS_8 == "False" ]] ; then + curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel.repo > /etc/yum.repos.d/CyberPanel.repo fi echo -e "\nInstalling necessary components..." if [[ $SERVER_OS == "CentOS" ]] ; then + timeout 10 rpm --import https://$DOWNLOAD_SERVER/mariadb/RPM-GPG-KEY-MariaDB timeout 10 rpm --import https://$DOWNLOAD_SERVER/litespeed/RPM-GPG-KEY-litespeed timeout 10 rpm --import https://$DOWNLOAD_SERVER/powerdns/FD380FBB-pub.asc @@ -420,63 +388,60 @@ if [[ $SERVER_OS == "CentOS" ]] ; then timeout 10 rpm --import https://$DOWNLOAD_SERVER/ius/RPM-GPG-KEY-IUS-7 timeout 10 rpm --import https://repo.dovecot.org/DOVECOT-REPO-GPG timeout 10 rpm --import https://copr-be.cloud.fedoraproject.org/results/copart/restic/pubkey.gpg + timeout 10 rpm --import https://rep8.cyberpanel.net/RPM-GPG-KEY-CP-EP-8 + timeout 10 rpm --import https://rep8.cyberpanel.net/RPM-GPG-KEY-CP-GF-8 + timeout 10 rpm --import https://rep8.cyberpanel.net/RPM-GPG-KEY-centosofficialcp + curl https://getfedora.org/static/fedora.gpg | gpg --import + yum clean all yum update -y yum autoremove epel-release -y rm -f /etc/yum.repos.d/epel.repo rm -f /etc/yum.repos.d/epel.repo.rpmsave - yum install epel-release -y if [[ $CENTOS_8 == "False" ]] ; then - yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc python-devel libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel python-pip git socat + yum --enablerepo=CyberPanel install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel gpgme-devel curl-devel git socat openssl-devel MariaDB-shared mariadb-devel yum-utils python36u python36u-pip python36u-devel + check_return + yum -y groupinstall development check_return fi if [[ $CENTOS_8 == "True" ]] ; then - yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar socat + dnf install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar socat python3 check_return dnf --enablerepo=PowerTools install gpgme-devel -y check_return fi -if [[ $DEV == "ON" ]] ; then - if [[ $CENTOS_8 == "False" ]] ; then - yum -y install yum-utils - yum -y groupinstall development - if [[ $SERVER_COUNTRY == "CN" ]] ; then - wget -O /etc/yum.repos.d/ius.repo https://$DOWNLOAD_SERVER/ius/ius.repo - else - yum -y install https://repo.ius.io/ius-release-el7.rpm - fi - yum -y install python36u python36u-pip python36u-devel - check_return - fi - if [[ $CENTOS_8 == "True" ]] ; then - dnf install python3 -y - check_return - fi - if [[ $SERVER_OS == "CentOS" ]] ; then - pip3.6 install virtualenv==16.7.9 - else - pip3.6 install virtualenv - fi - check_return - fi + + if [[ $SERVER_OS == "CentOS" ]] ; then + pip3.6 install virtualenv==16.7.9 + else + pip3.6 install virtualenv + fi + check_return + fi if [[ $SERVER_OS == "Ubuntu" ]] ; then + apt update -y DEBIAN_FRONTEND=noninteractive apt upgrade -y - DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet python-mysqldb python-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev python-gpg python python-minimal python-setuptools virtualenv python-dev python-pip git socat vim + DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev virtualenv git socat vim unzip zip check_return - if [[ $DEV == "ON" ]] ; then - DEBIAN_FRONTEND=noninteractive apt install -y python3-pip - check_return - ln -s /usr/bin/pip3 /usr/bin/pip3.6 - DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev - check_return - DEBIAN_FRONTEND=noninteractive apt install -y python3-venv - check_return - fi + + DEBIAN_FRONTEND=noninteractive apt install -y python3-pip + check_return + ln -s /usr/bin/pip3 /usr/bin/pip3.6 + DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev + check_return + DEBIAN_FRONTEND=noninteractive apt install -y python3-venv + check_return + + if [[ $UBUNTU_20 == "True" ]] ; then + pip3 install virtualenv==16.7.9 + fi + check_return + fi } @@ -600,6 +565,7 @@ fi check_OS() { echo -e "\nChecking OS..." OUTPUT=$(cat /etc/*release) + if echo $OUTPUT | grep -q "CentOS Linux 7" ; then echo -e "\nDetecting CentOS 7.X...\n" SERVER_OS="CentOS" @@ -618,12 +584,23 @@ elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then echo -e "\nUbuntu 18.04 x32 detected...ths only works on x64 system." exit fi +elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then + if uname -m | grep -q 64 ; then + echo -e "\nDetecting Ubuntu 20.04 ...\n" + SERVER_OS="Ubuntu" + UBUNTU_20="True" + else + echo -e "\nUbuntu 20 x32 detected...ths only works on x64 system." + exit + fi else cat /etc/*release echo -e "\nUnable to detect your OS...\n" - echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, CentOS 7.x, CentOS 8.x and CloudLinux 7.x...\n" + echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, CentOS 7.x, CentOS 8.x and CloudLinux 7.x...\n" exit 1 fi + + } check_root() { @@ -1041,11 +1018,14 @@ if [[ $debug == "0" ]] ; then exit fi + if [[ $debug == "1" ]] ; then - wget -O requirements.txt https://$GIT_CONTENT_URL/${BRANCH_NAME}/requirments.txt - check_return - /usr/local/CyberPanel/bin/pip3 install --ignore-installed -r requirements.txt - rm -f requirements.txt + + if [[ $UBUNTU_20 == "False" ]] ; then + pip3.6 install --ignore-installed /usr/local/pip-packs/* + else + pip3.6 install --ignore-installed /usr/local/packages/* + fi if [[ $REDIS_HOSTING == "Yes" ]] ; then /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable @@ -1068,6 +1048,7 @@ if [[ $REDIS == "ON" ]] ; then fi after_install fi + } pip_virtualenv() { @@ -1084,14 +1065,25 @@ export LC_ALL=en_US.UTF-8 if [[ $DEV == "ON" ]] ; then #install dev branch #wget https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt - cd /usr/local/ - virtualenv -p /usr/bin/python3 CyberPanel - source /usr/local/CyberPanel/bin/activate - wget -O requirements.txt https://$GIT_CONTENT_URL/${BRANCH_NAME}/requirments.txt - check_return - pip3.6 install --ignore-installed -r requirements.txt - check_return - cd - + virtualenv -p /usr/bin/python3 /usr/local/CyberPanel + + if [[ $UBUNTU_20 == "False" ]] ; then + source /usr/local/CyberPanel/bin/activate + wget -O /usr/local/cyberpanel-pip.zip https://rep.cyberpanel.net/cyberpanel-pip.zip + check_return + unzip /usr/local/cyberpanel-pip.zip -d /usr/local + check_return + pip3.6 install --ignore-installed /usr/local/pip-packs/* + check_return + else + . /usr/local/CyberPanel/bin/activate + wget -O /usr/local/cyberpanel-pip.zip https://rep.cyberpanel.net/ubuntu-pip.zip + check_return + unzip /usr/local/cyberpanel-pip.zip -d /usr/local + check_return + pip3 install --ignore-installed /usr/local/packages/* + check_return + fi fi if [ -f requirements.txt ] && [ -d cyberpanel ] ; then @@ -1179,15 +1171,24 @@ trusted-host=pypi.python.org EOF fi -virtualenv -p /usr/bin/python3 /usr/local/CyberCP -source /usr/local/CyberCP/bin/activate -wget -O requirements.txt https://$GIT_CONTENT_URL/${BRANCH_NAME}/requirments.txt -check_return -pip3.6 install --ignore-installed -r requirements.txt -check_return -systemctl restart lscpd fi +virtualenv -p /usr/bin/python3 /usr/local/CyberCP + +if [[ $UBUNTU_20 == "False" ]] ; then + source /usr/local/CyberCP/bin/activate + check_return + pip3 install --ignore-installed /usr/local/pip-packs/* + check_return +else + . /usr/local/CyberCP/bin/activate + check_return + pip3 install --ignore-installed /usr/local/packages/* + check_return +fi + +systemctl restart lscpd + for version in $(ls /usr/local/lsws | grep lsphp); do php_ini=$(find /usr/local/lsws/$version/ -name php.ini) @@ -1310,7 +1311,11 @@ fi fi #fix php.ini & issue -clear +if [[ $UBUNTU_20 == "True" ]] ; then + cp /usr/local/lsws/lsphp73/bin/php /usr/bin +fi + +#clear echo "###################################################################" echo " CyberPanel Successfully Installed " echo " " @@ -1441,6 +1446,8 @@ else fi } +##START + if [ $# -eq 0 ] ; then echo -e "\nInitializing...\n" else @@ -1539,6 +1546,8 @@ else DOWNLOAD_SERVER="cdn.cyberpanel.sh" fi +##END + check_OS check_virtualization check_root @@ -1547,9 +1556,6 @@ check_process check_provider - - - if [[ $SILENT = "ON" ]] ; then argument_mode else @@ -1566,3 +1572,8 @@ pip_virtualenv system_tweak main_install + + +### Disable Centos Default Repos + +disable_repos \ No newline at end of file diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 49a5fa5ea..2f49f7edf 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -1,4 +1,5 @@ #!/bin/bash + #CyberPanel Upgrade script export LC_CTYPE=en_US.UTF-8 @@ -11,6 +12,27 @@ GIT_URL="github.com/usmannasir/cyberpanel" GIT_CONTENT_URL="raw.githubusercontent.com/usmannasir/cyberpanel" SERVER_COUNTRY="unknow" SERVER_COUNTRY=$(curl --silent --max-time 5 https://cyberpanel.sh/?country) +UBUNTU_20="False" + +### Update and remove not needed repos + +rm -f /etc/yum.repos.d/ius-archive.repo +rm -f /etc/yum.repos.d/copart-restic-epel-7.repo +rm -f /etc/yum.repos.d/dovecot.repo +rm -f /etc/yum.repos.d/epel.repo +rm -f /etc/yum.repos.d/epel-testing.repo +rm -f /etc/yum.repos.d/frank.repo +rm -f /etc/yum.repos.d/ius.repo +rm -f /etc/yum.repos.d/ius-testing.repo +rm -f /etc/yum.repos.d/MariaDB.repo +rm -f /etc/yum.repos.d/lux.repo +rm -f /etc/yum.repos.d/gf.repo +rm -f /etc/yum.repos.d/powerdns-auth-42.repo +rm -rf /etc/yum.repos.d/powerdns-auth-master.repo +rm -rf /etc/yum.repos.d/gf.repo.rpmnew + +## + if [[ ${#SERVER_COUNTRY} == "2" ]] || [[ ${#SERVER_COUNTRY} == "6" ]] ; then echo -e "\nChecking server..." else @@ -138,24 +160,41 @@ check_root echo -e "\nChecking OS..." OUTPUT=$(cat /etc/*release) + if echo $OUTPUT | grep -q "CentOS Linux 7" ; then echo -e "\nDetecting CentOS 7.X...\n" SERVER_OS="CentOS7" + curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel.repo > /etc/yum.repos.d/CyberPanel.repo yum clean all yum update -y + yum autoremove epel-release -y + rm -f /etc/yum.repos.d/epel.repo + rm -f /etc/yum.repos.d/epel.repo.rpmsave elif echo $OUTPUT | grep -q "CloudLinux 7" ; then echo -e "\nDetecting CloudLinux 7.X...\n" SERVER_OS="CentOS7" + curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel.repo > /etc/yum.repos.d/CyberPanel.repo yum clean all yum update -y + yum autoremove epel-release -y + rm -f /etc/yum.repos.d/epel.repo + rm -f /etc/yum.repos.d/epel.repo.rpmsave elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then + curl https://raw.githubusercontent.com/usmannasir/cyberpanel/v2.0.1/install/CyberPanel8.repo > /etc/yum.repos.d/CyberPanel.repo echo -e "\nDetecting CentOS 8.X...\n" SERVER_OS="CentOS8" yum clean all yum update -y + yum autoremove epel-release -y + rm -f /etc/yum.repos.d/epel.repo + rm -f /etc/yum.repos.d/epel.repo.rpmsave elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then echo -e "\nDetecting Ubuntu 18.04...\n" SERVER_OS="Ubuntu" +elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then + echo -e "\nDetecting Ubuntu 20.04...\n" + SERVER_OS="Ubuntu" + UBUNTU_20="True" else cat /etc/*release echo -e "\nUnable to detect your OS...\n" @@ -166,16 +205,15 @@ fi if [ $SERVER_OS = "CentOS7" ] ; then yum -y install yum-utils yum -y groupinstall development - yum -y install https://centos7.iuscommunity.org/ius-release.rpm - yum -y install python36u python36u-pip python36u-devel + yum --enablerepo=CyberPanel install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel gpgme-devel curl-devel git socat openssl-devel MariaDB-shared mariadb-devel python36u python36u-pip python36u-devel elif [ $SERVER_OS = "CentOS8" ] ; then - yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar + dnf install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar socat dnf --enablerepo=PowerTools install gpgme-devel -y dnf install python3 -y else apt update -y DEBIAN_FRONTEND=noninteractive apt upgrade -y - DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet python-mysqldb python-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev python-gpg python python-minimal python-setuptools virtualenv python-dev python-pip git + DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev virtualenv git DEBIAN_FRONTEND=noninteractive apt install -y python3-pip DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev DEBIAN_FRONTEND=noninteractive apt install -y python3-venv @@ -189,65 +227,114 @@ else check_return fi -rm -rf /usr/local/CyberPanel -virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel -check_return + +if [[ -f /usr/local/CyberPanel/bin/python2 ]] ; then + echo -e "\nPython 2 dectected, doing resetup...\n" + rm -rf /usr/local/CyberPanel/bin + virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel + check_return +elif [[ -d /usr/local/CyberPanel/bin/ ]] ; then + echo -e "\nNo need to resetup virtualenv at /usr/local/CyberPanel...\n" +else + echo -e "\nNothing found, need fresh setup...\n" + virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel + check_return +fi + rm -f requirments.txt -wget -O requirements.txt https://$GIT_CONTENT_URL/${BRANCH_NAME}/requirments.txt + +if [[ $UBUNTU_20 == "False" ]] ; then + wget -O /usr/local/cyberpanel-pip.zip https://rep.cyberpanel.net/cyberpanel-pip.zip +else + wget -O /usr/local/cyberpanel-pip.zip https://rep.cyberpanel.net/ubuntu-pip.zip +fi + +check_return +rm -rf /usr/local/pip-packs/ +rm -rf /usr/local/packages + +unzip /usr/local/cyberpanel-pip.zip -d /usr/local +check_return . /usr/local/CyberPanel/bin/activate check_return if [ $SERVER_OS = "Ubuntu" ] ; then . /usr/local/CyberPanel/bin/activate check_return - pip3 install --ignore-installed -r requirements.txt + if [[ $UBUNTU_20 == "False" ]] ; then + pip3 install --ignore-installed /usr/local/pip-packs/* + else + pip3 install --ignore-installed /usr/local/packages/* + fi check_return else source /usr/local/CyberPanel/bin/activate check_return - pip3.6 install --ignore-installed -r requirements.txt + pip3.6 install --ignore-installed /usr/local/pip-packs/* check_return fi +## Doing again to prevent an error - dont confuse later + virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel check_return + +## + rm -rf upgrade.py wget https://$GIT_CONTENT_URL/${BRANCH_NAME}/plogical/upgrade.py if [[ $SERVER_COUNTRY == "CN" ]] ; then sed -i 's|wget https://raw.githubusercontent.com/usmannasir/cyberpanel/v1.9.4/lscpd-0.2.4 -P /usr/local/lscp/bin/|cp -f /usr/local/CyberCP/lscpd-0.2.4 /usr/local/lscp/bin/lscpd-0.2.4|g' upgrade.py sed -i 's|wget https://raw.githubusercontent.com/usmannasir/cyberpanel/%s/lscpd-0.2.4 -P /usr/local/lscp/bin/|cp -f /usr/local/CyberCP/lscpd-0.2.4 /usr/local/lscp/bin/lscpd-0.2.4|g' upgrade.py -sed -i $'s/0.2.4\' % (branch)/0.2.4\'/' upgrade.py +#sed -i $'s/0.2.4\' % (branch)/0.2.4\'/' upgrade.py sed -i 's|raw.githubusercontent.com/usmannasir/cyberpanel|'${GIT_CONTENT_URL}'|g' upgrade.py sed -i 's|git clone https://github.com/usmannasir/cyberpanel|git clone https://'${GIT_URL}'|g' upgrade.py fi /usr/local/CyberPanel/bin/python upgrade.py $BRANCH_NAME check_return -virtualenv -p /usr/bin/python3 /usr/local/CyberCP + +if [[ -f /usr/local/CyberCP/bin/python2 ]] ; then + rm -rf /usr/local/CyberCP/bin + virtualenv -p /usr/bin/python3 /usr/local/CyberCP +elif [[ -d /usr/local/CyberCP/bin/ ]] ; then + echo -e "\nNo need to resetup virtualenv at /usr/local/CyberCP...\n" +else + virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberCP + check_return +fi + check_return -wget -O requirements.txt https://$GIT_CONTENT_URL/${BRANCH_NAME}/requirments.txt if [ $SERVER_OS = "Ubuntu" ] ; then . /usr/local/CyberCP/bin/activate check_return - pip3 install --ignore-installed -r requirements.txt + if [[ $UBUNTU_20 == "False" ]] ; then + pip3 install --ignore-installed /usr/local/pip-packs/* + else + pip3 install --ignore-installed /usr/local/packages/* + fi check_return else source /usr/local/CyberCP/bin/activate check_return - pip3.6 install --ignore-installed -r requirements.txt + pip3.6 install --ignore-installed /usr/local/pip-packs/* check_return fi ## +rm -f wsgi-lsapi-1.4.tgz rm -f wsgi-lsapi-1.5.tgz +rm -f wsgi-lsapi-1.6.tgz rm -rf wsgi-lsapi-1.4 -wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.5.tgz -tar xf wsgi-lsapi-1.5.tgz -cd wsgi-lsapi-1.5 +rm -rf wsgi-lsapi-1.5 +rm -rf wsgi-lsapi-1.6 +wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.6.tgz +tar xf wsgi-lsapi-1.6.tgz +cd wsgi-lsapi-1.6 /usr/local/CyberPanel/bin/python ./configure.py make @@ -341,6 +428,25 @@ rm -f /usr/local/composer.sh # clean up +### Disable Centos Default Repos + + +disable_repos() { + +if [[ $SERVER_OS == "CentOS" ]] ; then + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Base.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Debuginfo.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Media.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Vault.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-CR.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-fasttrack.repo + sed -i 's|enabled=1|enabled=0|g' /etc/yum.repos.d/CentOS-Sources.repo +fi + +} + +disable_repos + echo "###################################################################" echo " CyberPanel Upgraded " echo "###################################################################" diff --git a/dns/models.py b/dns/models.py index c926566db..c42b663ad 100755 --- a/dns/models.py +++ b/dns/models.py @@ -23,7 +23,7 @@ class Records(models.Model): domain_id = models.IntegerField(blank=True, null=True) name = models.CharField(max_length=255, blank=True, null=True) type = models.CharField(max_length=10, blank=True, null=True) - content = models.CharField(max_length=64000, blank=True, null=True) + content = models.CharField(max_length=1000, blank=True, null=True) ttl = models.IntegerField(blank=True, null=True) prio = models.IntegerField(blank=True, null=True) change_date = models.IntegerField(blank=True, null=True) @@ -41,7 +41,7 @@ class Comments(models.Model): type = models.CharField(max_length=10) modified_at = models.IntegerField() account = models.CharField(max_length=40) - comment = models.CharField(max_length=64000) + comment = models.TextField() class Meta: db_table = 'comments' diff --git a/dockerManager/dockerInstall.py b/dockerManager/dockerInstall.py index 8b5220169..83589ad27 100755 --- a/dockerManager/dockerInstall.py +++ b/dockerManager/dockerInstall.py @@ -18,7 +18,9 @@ class DockerInstall: logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Starting Docker Installation..\n", 1) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + command = 'sudo dnf install -y docker-ce --nobest' + elif ProcessUtilities.decideDistro() == ProcessUtilities.centos: command = 'sudo yum install -y docker' else: command = 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io' diff --git a/emailPremium/static/emailPremium/emailPremium.js b/emailPremium/static/emailPremium/emailPremium.js index 48f7109fc..eb1ec4b83 100755 --- a/emailPremium/static/emailPremium/emailPremium.js +++ b/emailPremium/static/emailPremium/emailPremium.js @@ -4,7 +4,7 @@ /* Java script code to list accounts */ -app.controller('listDomains', function($scope,$http) { +app.controller('listDomains', function ($scope, $http) { $scope.listFail = true; $scope.emailLimitsLoading = true; @@ -13,7 +13,7 @@ app.controller('listDomains', function($scope,$http) { var globalPageNumber; - $scope.getFurtherWebsitesFromDB = function(pageNumber) { + $scope.getFurtherWebsitesFromDB = function (pageNumber) { globalPageNumber = pageNumber; $scope.emailLimitsLoading = false; @@ -23,37 +23,36 @@ app.controller('listDomains', function($scope,$http) { var data = {page: pageNumber}; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.listWebSiteStatus === 1) { + if (response.data.listWebSiteStatus === 1) { - $scope.WebSitesList = JSON.parse(response.data.data); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.WebSitesList = JSON.parse(response.data.data); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getFurtherWebsitesFromDB(1); $scope.enableDisableEmailLimits = function (operationVal, domainName) { @@ -69,33 +68,32 @@ app.controller('listDomains', function($scope,$http) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.getFurtherWebsitesFromDB(globalPageNumber); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.getFurtherWebsitesFromDB(globalPageNumber); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } } }); @@ -104,7 +102,7 @@ app.controller('listDomains', function($scope,$http) { /* Java script code for email domain page */ -app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { +app.controller('emailDomainPage', function ($scope, $http, $timeout, $window) { $scope.listFail = true; $scope.emailLimitsLoading = true; @@ -115,7 +113,7 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { var globalPageNumber; - $scope.getFurtherEmailsFromDB = function(pageNumber) { + $scope.getFurtherEmailsFromDB = function (pageNumber) { globalPageNumber = pageNumber; $scope.emailLimitsLoading = false; @@ -128,37 +126,36 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.emailList = JSON.parse(response.data.data); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.emailList = JSON.parse(response.data.data); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getFurtherEmailsFromDB(1); $scope.enableDisableEmailLimits = function (operationVal, domainName) { @@ -174,29 +171,34 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $timeout(function() { $window.location.reload(); }, 0); + $timeout(function () { + $window.location.reload(); + }, 0); + } else { + $timeout(function () { + $window.location.reload(); + }, 0); + } } - else - { - $timeout(function() { $window.location.reload(); }, 0); - } - } + function cantLoadInitialData(response) { - $timeout(function() { $window.location.reload(); }, 0); - } + $timeout(function () { + $window.location.reload(); + }, 0); + } }; @@ -219,27 +221,27 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; $scope.changeDomainEmailLimits = function (domainName) { - $scope.emailLimitsLoading = false; + $scope.emailLimitsLoading = false; - url = "/emailPremium/changeDomainLimit"; + url = "/emailPremium/changeDomainLimit"; - var data = { - domainName: domainName, - newLimit: $scope.monthlyLimit - }; + var data = { + domainName: domainName, + newLimit: $scope.monthlyLimit + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); - function ListInitialData(response) { + function ListInitialData(response) { - $scope.emailLimitsLoading = true; + $scope.emailLimitsLoading = true; if (response.data.status === 1) { @@ -248,10 +250,10 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { $scope.changeLimitsFail = true; $scope.changeLimitsSuccess = false; $scope.couldNotConnect = true; - $timeout(function() { $window.location.reload(); }, 3000); - } - else - { + $timeout(function () { + $window.location.reload(); + }, 3000); + } else { $scope.changeLimitsForm = false; $scope.changeLimitsFail = false; $scope.changeLimitsSuccess = true; @@ -260,12 +262,13 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { } } - function cantLoadInitialData(response) { - $scope.emailLimitsLoading = true; - $scope.changeLimitsForm = false; - $scope.changeLimitsFail = true; - $scope.changeLimitsSuccess = true; - $scope.couldNotConnect = false; + + function cantLoadInitialData(response) { + $scope.emailLimitsLoading = true; + $scope.changeLimitsForm = false; + $scope.changeLimitsFail = true; + $scope.changeLimitsSuccess = true; + $scope.couldNotConnect = false; } } @@ -283,28 +286,27 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { - $scope.getFurtherEmailsFromDB(1); + if (response.data.status === 1) { + $scope.getFurtherEmailsFromDB(1); + } else { + $scope.getFurtherEmailsFromDB(1); + } } - else - { - $scope.getFurtherEmailsFromDB(1); - } - } + function cantLoadInitialData(response) { $scope.getFurtherEmailsFromDB(1); - } + } }; }); @@ -313,7 +315,7 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { /* Java script code for Email Page */ -app.controller('emailPage', function($scope,$http, $timeout, $window) { +app.controller('emailPage', function ($scope, $http, $timeout, $window) { $scope.emailLimitsLoading = true; @@ -322,7 +324,7 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { // Global page number, to be used in later function to refresh the domains var globalPageNumber; - $scope.getEmailStats = function() { + $scope.getEmailStats = function () { $scope.emailLimitsLoading = false; @@ -338,56 +340,55 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.monthlyLimit = response.data.monthlyLimit; - $scope.monthlyUsed = response.data.monthlyUsed; - $scope.hourlyLimit = response.data.hourlyLimit; - $scope.hourlyUsed = response.data.hourlyUsed; + $scope.monthlyLimit = response.data.monthlyLimit; + $scope.monthlyUsed = response.data.monthlyUsed; + $scope.hourlyLimit = response.data.hourlyLimit; + $scope.hourlyUsed = response.data.hourlyUsed; + + if (response.data.limitStatus === 1) { + $scope.limitsOn = false; + $scope.limitsOff = true; + } else { + $scope.limitsOn = true; + $scope.limitsOff = false; + } + + if (response.data.logsStatus === 1) { + $scope.loggingOn = false; + $scope.loggingOff = true; + } else { + $scope.loggingOn = true; + $scope.loggingOff = false; + } + + } else { + + $scope.errorMessage = response.data.error_message; - if(response.data.limitStatus === 1){ - $scope.limitsOn = false; - $scope.limitsOff = true; - }else{ - $scope.limitsOn = true; - $scope.limitsOff = false; } - - if(response.data.logsStatus === 1){ - $scope.loggingOn = false; - $scope.loggingOff = true; - }else{ - $scope.loggingOn = true; - $scope.loggingOff = false; - } - } - else - { - $scope.errorMessage = response.data.error_message; - - } - } function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getEmailStats(); $scope.enableDisableIndividualEmailLimits = function (operationVal, emailAddress) { @@ -403,12 +404,12 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { @@ -416,15 +417,14 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { if (response.data.status === 1) { $scope.getEmailStats(); - } - else - { + } else { $scope.getEmailStats(); } - } + } + function cantLoadInitialData(response) { $scope.getEmailStats(); - } + } }; $scope.enableDisableIndividualEmailLogs = function (operationVal, emailAddress) { @@ -439,12 +439,12 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { @@ -452,15 +452,14 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { if (response.data.status === 1) { $scope.getEmailStats(); - } - else - { + } else { $scope.getEmailStats(); } - } + } + function cantLoadInitialData(response) { $scope.getEmailStats(); - } + } }; @@ -477,29 +476,34 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $timeout(function() { $window.location.reload(); }, 0); + $timeout(function () { + $window.location.reload(); + }, 0); + } else { + $timeout(function () { + $window.location.reload(); + }, 0); + } } - else - { - $timeout(function() { $window.location.reload(); }, 0); - } - } + function cantLoadInitialData(response) { - $timeout(function() { $window.location.reload(); }, 0); - } + $timeout(function () { + $window.location.reload(); + }, 0); + } }; @@ -521,28 +525,28 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; $scope.changeDomainEmailLimitsIndividual = function () { - $scope.emailLimitsLoading = false; + $scope.emailLimitsLoading = false; - url = "/emailPremium/changeDomainEmailLimitsIndividual"; + url = "/emailPremium/changeDomainEmailLimitsIndividual"; - var data = { - emailAddress: globalEamilAddress, - monthlyLimit: $scope.monthlyLimitForm, - hourlyLimit: $scope.hourlyLimitForm - }; + var data = { + emailAddress: globalEamilAddress, + monthlyLimit: $scope.monthlyLimitForm, + hourlyLimit: $scope.hourlyLimitForm + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); - function ListInitialData(response) { + function ListInitialData(response) { - $scope.emailLimitsLoading = true; + $scope.emailLimitsLoading = true; if (response.data.status === 1) { @@ -553,9 +557,7 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { $scope.couldNotConnect = true; $scope.getEmailStats(); - } - else - { + } else { $scope.changeLimitsForm = false; $scope.changeLimitsFail = false; $scope.changeLimitsSuccess = true; @@ -564,18 +566,19 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { } } - function cantLoadInitialData(response) { - $scope.emailLimitsLoading = true; - $scope.changeLimitsForm = false; - $scope.changeLimitsFail = true; - $scope.changeLimitsSuccess = true; - $scope.couldNotConnect = false; + + function cantLoadInitialData(response) { + $scope.emailLimitsLoading = true; + $scope.changeLimitsForm = false; + $scope.changeLimitsFail = true; + $scope.changeLimitsSuccess = true; + $scope.couldNotConnect = false; } }; /// Get email logs - $scope.getLogEntries = function(pageNumber) { + $scope.getLogEntries = function (pageNumber) { globalPageNumber = pageNumber; $scope.emailLimitsLoading = false; @@ -588,41 +591,40 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.logs = JSON.parse(response.data.data); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.logs = JSON.parse(response.data.data); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getLogEntries(1); - $scope.flushLogs = function(emailAddress) { + $scope.flushLogs = function (emailAddress) { $scope.emailLimitsLoading = false; @@ -633,36 +635,35 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { - $scope.getLogEntries(1); + if (response.data.status === 1) { + $scope.getLogEntries(1); - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; } } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; } - }; + }; }); @@ -670,286 +671,285 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { /* Java script code for SpamAssassin */ -app.controller('SpamAssassin', function($scope, $http, $timeout, $window) { +app.controller('SpamAssassin', function ($scope, $http, $timeout, $window) { - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = true; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + $scope.installSpamAssassin = function () { - $scope.installSpamAssassin = function(){ + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = true; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; + url = "/emailPremium/installSpamAssassin"; - url = "/emailPremium/installSpamAssassin"; + var data = {}; - var data = {}; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; - getRequestStatus(); + getRequestStatus(); - } - else{ - $scope.errorMessage = response.data.error_message; + } else { + $scope.errorMessage = response.data.error_message; - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = true; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = false; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = false; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + } + + }; + + function getRequestStatus() { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/emailPremium/installStatusSpamAssassin"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.abort === 0) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.requestData = response.data.requestStatus; + $timeout(getRequestStatus, 1000); + } else { + // Notifications + $timeout.cancel(); + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + + $scope.requestData = response.data.requestStatus; + + if (response.data.installed === 0) { + $scope.installationFailed = false; + $scope.errorMessage = response.data.error_message; + } else { + $scope.SpamAssassinSuccessfullyInstalled = false; + $timeout(function () { + $window.location.reload(); + }, 3000); + } + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + + } + + } + + ///// SpamAssassin configs + + var report_safe = false; + + + $('#report_safe').change(function () { + report_safe = $(this).prop('checked'); + }); + + fetchSpamAssassinSettings(); + + function fetchSpamAssassinSettings() { + + $scope.SpamAssassinLoading = false; + + $('#report_safe').bootstrapToggle('off'); + + url = "/emailPremium/fetchSpamAssassinSettings"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + $scope.SpamAssassinLoading = true; + + if (response.data.fetchStatus === 1) { + + if (response.data.installed === 1) { + + if (response.data.report_safe === 1) { + $('#report_safe').bootstrapToggle('on'); } - } - function cantLoadInitialDatas(response) { - - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = false; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - } - - }; - - function getRequestStatus(){ - - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - - url = "/emailPremium/installStatusSpamAssassin"; - - var data = {}; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - - if(response.data.abort === 0){ - - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - - $scope.requestData = response.data.requestStatus; - $timeout(getRequestStatus,1000); - } - else{ - // Notifications - $timeout.cancel(); - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - - $scope.requestData = response.data.requestStatus; - - if(response.data.installed === 0) { - $scope.installationFailed = false; - $scope.errorMessage = response.data.error_message; - }else{ - $scope.SpamAssassinSuccessfullyInstalled = false; - $timeout(function() { $window.location.reload(); }, 3000); - } - - } - - } - function cantLoadInitialDatas(response) { - - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = false; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - + $scope.required_hits = response.data.required_hits; + $scope.rewrite_header = response.data.rewrite_header; + $scope.required_score = response.data.required_score; } - } + } - ///// SpamAssassin configs + } - var report_safe = false; + function cantLoadInitialDatas(response) { + $scope.SpamAssassinLoading = true; + } + + } - $('#report_safe').change(function() { - report_safe = $(this).prop('checked'); - }); + ///// - fetchSpamAssassinSettings(); - function fetchSpamAssassinSettings(){ + /// Save SpamAssassin Changes - $scope.SpamAssassinLoading = false; + $scope.failedToSave = true; + $scope.successfullySaved = true; - $('#report_safe').bootstrapToggle('off'); + $scope.saveSpamAssassinConfigurations = function () { - url = "/emailPremium/fetchSpamAssassinSettings"; - - var data = {}; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $scope.failedToSave = true; + $scope.successfullySaved = true; + $scope.SpamAssassinLoading = false; + $scope.couldNotConnect = true; + url = "/emailPremium/saveSpamAssassinConfigurations"; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + var data = { + report_safe: report_safe, + required_hits: $scope.required_hits, + rewrite_header: $scope.rewrite_header, + required_score: $scope.required_score + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - function ListInitialDatas(response) { - - $scope.SpamAssassinLoading = true; - - if(response.data.fetchStatus === 1){ - - if(response.data.installed === 1) { - - if (response.data.report_safe === 1) { - $('#report_safe').bootstrapToggle('on'); - } - - $scope.required_hits = response.data.required_hits; - $scope.rewrite_header = response.data.rewrite_header; - $scope.required_score = response.data.required_score; - - } - - } - - } - function cantLoadInitialDatas(response) { - $scope.SpamAssassinLoading = true; - } - - } + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - ///// - - /// Save SpamAssassin Changes - - $scope.failedToSave = true; - $scope.successfullySaved = true; - - $scope.saveSpamAssassinConfigurations = function () { - - $scope.failedToSave = true; - $scope.successfullySaved = true; - $scope.SpamAssassinLoading = false; - $scope.couldNotConnect = true; + function ListInitialDatas(response) { - url = "/emailPremium/saveSpamAssassinConfigurations"; + if (response.data.saveStatus === 1) { - var data = { - report_safe:report_safe, - required_hits:$scope.required_hits, - rewrite_header:$scope.rewrite_header, - required_score:$scope.required_score - }; + $scope.failedToSave = true; + $scope.successfullySaved = false; + $scope.SpamAssassinLoading = true; + $scope.couldNotConnect = true; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + } else { + $scope.errorMessage = response.data.error_message; + + $scope.failedToSave = false; + $scope.successfullySaved = true; + $scope.SpamAssassinLoading = true; + $scope.couldNotConnect = true; + } + + } + + function cantLoadInitialDatas(response) { + $scope.failedToSave = true; + $scope.successfullySaved = false; + $scope.SpamAssassinLoading = true; + $scope.couldNotConnect = true; + } - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - - if(response.data.saveStatus === 1){ - - $scope.failedToSave = true; - $scope.successfullySaved = false; - $scope.SpamAssassinLoading = true; - $scope.couldNotConnect = true; - - } - else{ - $scope.errorMessage = response.data.error_message; - - $scope.failedToSave = false; - $scope.successfullySaved = true; - $scope.SpamAssassinLoading = true; - $scope.couldNotConnect = true; - } - - } - function cantLoadInitialDatas(response) { - $scope.failedToSave = true; - $scope.successfullySaved = false; - $scope.SpamAssassinLoading = true; - $scope.couldNotConnect = true; - } - - - }; + }; }); @@ -957,129 +957,128 @@ app.controller('SpamAssassin', function($scope, $http, $timeout, $window) { /* Java script code for Email Policy Server */ -app.controller('policyServer', function($scope, $http, $timeout, $window) { +app.controller('policyServer', function ($scope, $http, $timeout, $window) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - ///// SpamAssassin configs + ///// SpamAssassin configs - var report_safe = false; + var report_safe = false; - $('#policServerStatus').change(function() { - policServerStatus = $(this).prop('checked'); - }); + $('#policServerStatus').change(function () { + policServerStatus = $(this).prop('checked'); + }); - fetchPolicServerStatus(); - function fetchPolicServerStatus(){ + fetchPolicServerStatus(); - $scope.policyServerLoading = false; + function fetchPolicServerStatus() { - $('#policServerStatus').bootstrapToggle('off'); + $scope.policyServerLoading = false; - url = "/emailPremium/fetchPolicyServerStatus"; + $('#policServerStatus').bootstrapToggle('off'); - var data = {}; + url = "/emailPremium/fetchPolicyServerStatus"; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.policyServerLoading = true; + $scope.policyServerLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#policServerStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#policServerStatus').bootstrapToggle('on'); } - } + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } - $scope.savePolicServerStatus = function () { + $scope.savePolicServerStatus = function () { - $scope.policyServerLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.policyServerLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + url = "/emailPremium/savePolicyServerStatus"; - url = "/emailPremium/savePolicyServerStatus"; + var data = { + policServerStatus: policServerStatus + }; - var data = { - policServerStatus:policServerStatus - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.policyServerLoading = true; + function ListInitialDatas(response) { + $scope.policyServerLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; - } - else{ - $scope.errorMessage = response.data.error_message; + } else { + $scope.errorMessage = response.data.error_message; - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } - } - function cantLoadInitialDatas(response) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - }; + }; }); @@ -1087,7 +1086,7 @@ app.controller('policyServer', function($scope, $http, $timeout, $window) { /* Java script code to manage mail queue */ -app.controller('mailQueue', function($scope,$http) { +app.controller('mailQueue', function ($scope, $http) { $scope.currentPage = 1; $scope.recordsToShow = 10; @@ -1248,8 +1247,7 @@ app.controller('mailQueue', function($scope,$http) { } }; - var data = { - }; + var data = {}; dataurl = "/emailPremium/flushQueue"; @@ -1287,4 +1285,159 @@ app.controller('mailQueue', function($scope,$http) { }; }); -/* Java script code to manage mail queue ends here */ \ No newline at end of file +/* Java script code to manage mail queue ends here */ + +app.controller('MailScanner', function ($scope, $http, $timeout, $window) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.installSpamAssassin = function () { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/emailPremium/installMailScanner"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.status === 1) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + getRequestStatus(); + + } else { + $scope.errorMessage = response.data.error_message; + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = false; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + } + + }; + + function getRequestStatus() { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/emailPremium/installStatusMailScanner"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.abort === 0) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.requestData = response.data.requestStatus; + $timeout(getRequestStatus, 1000); + } else { + // Notifications + $timeout.cancel(); + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + + $scope.requestData = response.data.requestStatus; + + if (response.data.installed === 0) { + $scope.installationFailed = false; + $scope.errorMessage = response.data.error_message; + } else { + $scope.SpamAssassinSuccessfullyInstalled = false; + $timeout(function () { + $window.location.reload(); + }, 3000); + } + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + + } + + } +}); \ No newline at end of file diff --git a/emailPremium/templates/emailPremium/MailScanner.html b/emailPremium/templates/emailPremium/MailScanner.html new file mode 100755 index 000000000..2728ff45b --- /dev/null +++ b/emailPremium/templates/emailPremium/MailScanner.html @@ -0,0 +1,107 @@ +{% extends "baseTemplate/index.html" %} +{% load i18n %} +{% block title %}{% trans "MailScanner - CyberPanel" %}{% endblock %} +{% block content %} + + {% load static %} + {% get_current_language as LANGUAGE_CODE %} + + + +
    +
    +

    {% trans "MailScanner" %}

    +

    {% trans "Install/Access MailScanner" %}

    +
    + +
    +
    +

    + {% trans "MailScanner" %} +

    + +
    +
    + + {% if checkIfMailScannerInstalled == 0 %} + +
    +

    {% trans "MailScanner is not installed " %} +

    + +
    + + + +
    + +
    + +
    +

    {% trans "Failed to start installation, Error message: " %} {$ errorMessage + $}

    +
    + +
    +

    {% trans "Could not connect. Please refresh this page." %}

    +
    + +
    +

    {% trans "Installation failed." %} {$ errorMessage $}

    +
    + +
    +

    {% trans "MailScanner successfully installed, refreshing page in 3 seconds.." %}

    +
    +
    +
    + + +
    + +
    +
    +
    +

    {% trans "Winter is coming, but so is MailScanner." %} + +

    +
    +
    + +
    +
    +
    +
    + + + + {% else %} + +
    +

    {% trans "MailScanner is installed. " %} +

    + + +
    + + {% endif %} + + +
    +
    +
    +
    + + +
    + + +{% endblock %} diff --git a/emailPremium/urls.py b/emailPremium/urls.py index 50bff1050..240a31f73 100755 --- a/emailPremium/urls.py +++ b/emailPremium/urls.py @@ -38,6 +38,9 @@ urlpatterns = [ url(r'^fetchMessage$', views.fetchMessage, name='fetchMessage'), url(r'^flushQueue$', views.flushQueue, name='flushQueue'), url(r'^delete$', views.delete, name='delete'), + url(r'^MailScanner$', views.MailScanner, name='MailScanner'), + url(r'^installMailScanner$', views.installMailScanner, name='installMailScanner'), + url(r'^installStatusMailScanner$', views.installStatusMailScanner, name='installStatusMailScanner'), url(r'^(?P(.*))$', views.emailLimits, name='emailLimits'), diff --git a/emailPremium/views.py b/emailPremium/views.py index 54478c894..62f224844 100755 --- a/emailPremium/views.py +++ b/emailPremium/views.py @@ -832,6 +832,11 @@ def installStatusSpamAssassin(request): output = ProcessUtilities.outputExecutioner(execPath, 'root') if output.find("1,None") > -1: + + import os + if os.path.exists(mailUtilities.mailScannerInstallLogPath): + os.remove(mailUtilities.mailScannerInstallLogPath) + final_json = json.dumps({ 'error_message': "None", 'requestStatus': installStatus, @@ -1166,4 +1171,111 @@ def delete(request): except KeyError as msg: dic = {'status': 0, 'error_message': str(msg)} json_data = json.dumps(dic) - return HttpResponse(json_data) \ No newline at end of file + return HttpResponse(json_data) + +## MailScanner + +def MailScanner(request): + try: + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + checkIfMailScannerInstalled = 0 + + ipFile = "/etc/cyberpanel/machineIP" + f = open(ipFile) + ipData = f.read() + ipAddress = ipData.split('\n', 1)[0] + + if mailUtilities.checkIfMailScannerInstalled() == 1: + checkIfMailScannerInstalled = 1 + + return render(request, 'emailPremium/MailScanner.html',{'checkIfMailScannerInstalled': checkIfMailScannerInstalled, 'ipAddress': ipAddress}) + + except KeyError: + return redirect(loadLoginPage) + +def installMailScanner(request): + try: + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson() + try: + + execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = execPath + " installMailScanner" + ProcessUtilities.popenExecutioner(execPath) + + final_json = json.dumps({'status': 1, 'error_message': "None"}) + return HttpResponse(final_json) + except BaseException as msg: + final_dic = {'status': 0, 'error_message': str(msg)} + final_json = json.dumps(final_dic) + return HttpResponse(final_json) + except KeyError: + final_dic = {'status': 0, 'error_message': "Not Logged In, please refresh the page or login again."} + final_json = json.dumps(final_dic) + return HttpResponse(final_json) + +def installStatusMailScanner(request): + try: + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson() + + try: + if request.method == 'POST': + + command = "sudo cat " + mailUtilities.mailScannerInstallLogPath + installStatus = ProcessUtilities.outputExecutioner(command) + + if installStatus.find("[200]")>-1: + + final_json = json.dumps({ + 'error_message': "None", + 'requestStatus': installStatus, + 'abort': 1, + 'installed': 1, + }) + return HttpResponse(final_json) + + elif installStatus.find("[404]") > -1: + + final_json = json.dumps({ + 'abort':1, + 'installed':0, + 'error_message': "None", + 'requestStatus': installStatus, + }) + return HttpResponse(final_json) + + else: + final_json = json.dumps({ + 'abort':0, + 'error_message': "None", + 'requestStatus': installStatus, + }) + return HttpResponse(final_json) + + + except BaseException as msg: + final_dic = {'abort':1,'installed':0, 'error_message': str(msg)} + final_json = json.dumps(final_dic) + return HttpResponse(final_json) + except KeyError: + final_dic = {'abort':1,'installed':0, 'error_message': "Not Logged In, please refresh the page or login again."} + final_json = json.dumps(final_dic) + return HttpResponse(final_json) \ No newline at end of file diff --git a/filemanager/filemanager.py b/filemanager/filemanager.py index 5a8b1c2c7..9f6e9a32a 100755 --- a/filemanager/filemanager.py +++ b/filemanager/filemanager.py @@ -5,7 +5,6 @@ from plogical.processUtilities import ProcessUtilities from websiteFunctions.models import Websites from random import randint from django.core.files.storage import FileSystemStorage -import html.parser from plogical.acl import ACLManager class FileManager: @@ -540,5 +539,5 @@ class FileManager: command = 'chmod 755 %s' % (childs.path) ProcessUtilities.popenExecutioner(command) - command = 'chmod %s:%s %s' % (externalApp, groupName, childs.path) + command = 'chown %s:%s %s' % (externalApp, groupName, childs.path) ProcessUtilities.popenExecutioner(command) \ No newline at end of file diff --git a/filemanager/static/filemanager/js/fileManager.js b/filemanager/static/filemanager/js/fileManager.js index 725224dbb..19e175118 100755 --- a/filemanager/static/filemanager/js/fileManager.js +++ b/filemanager/static/filemanager/js/fileManager.js @@ -1479,7 +1479,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, // Download files $scope.downloadFile = function () { - url = "/filemanager/downloadFile"; var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0]; window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL; diff --git a/filemanager/views.py b/filemanager/views.py index cf91e7d42..57a3d5d0f 100755 --- a/filemanager/views.py +++ b/filemanager/views.py @@ -64,8 +64,12 @@ def downloadFile(request): try: userID = request.session['userID'] admin = Administrator.objects.get(pk=userID) + from urllib.parse import quote + from django.utils.encoding import iri_to_uri + + fileToDownload = request.build_absolute_uri().split('fileToDownload')[1][1:] + fileToDownload = iri_to_uri(fileToDownload) - fileToDownload = request.GET.get('fileToDownload') domainName = request.GET.get('domainName') currentACL = ACLManager.loadedACL(userID) diff --git a/firewall/static/firewall/firewall.js b/firewall/static/firewall/firewall.js index a0acd1f53..eaa372adb 100755 --- a/firewall/static/firewall/firewall.js +++ b/firewall/static/firewall/firewall.js @@ -2171,8 +2171,6 @@ app.controller('installImunify', function ($scope, $http, $timeout, $window) { text: 'Could not connect to server, please refresh this page', type: 'error' }); - - } } diff --git a/highAvailability/haManager.py b/highAvailability/haManager.py index 077ada262..dcda19b6d 100755 --- a/highAvailability/haManager.py +++ b/highAvailability/haManager.py @@ -36,7 +36,7 @@ class HAManager(multi.Thread): def setupNode(self): try: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: mesg = 'Clusters are only supported on Ubuntu 18.04. [404]' logging.statusWriter(self.data['tempStatusPath'], mesg) return 0 diff --git a/install/CyberPanel.repo b/install/CyberPanel.repo new file mode 100644 index 000000000..4dc23d316 --- /dev/null +++ b/install/CyberPanel.repo @@ -0,0 +1,5 @@ +[CyberPanel] +name=CyberPanel +baseurl=https://rep.cyberpanel.net/ +gpgkey=https://rep.cyberpanel.net/RPM-GPG-KEY-cyberpanel +gpgcheck=1 \ No newline at end of file diff --git a/install/CyberPanel8.repo b/install/CyberPanel8.repo new file mode 100644 index 000000000..eff2f1345 --- /dev/null +++ b/install/CyberPanel8.repo @@ -0,0 +1,5 @@ +[CyberPanel] +name=CyberPanel +baseurl=https://rep8.cyberpanel.net/ +gpgkey=https://rep.cyberpanel.net/RPM-GPG-KEY-cyberpanel +gpgcheck=1 \ No newline at end of file diff --git a/install/cyberpanel.repo b/install/cyberpanel.repo index 7723bb480..4dc23d316 100755 --- a/install/cyberpanel.repo +++ b/install/cyberpanel.repo @@ -1,4 +1,5 @@ -[cyberpanel] -name=Cyber Panel -baseurl=http://repo.cyberpersons.com -gpgcheck=0 \ No newline at end of file +[CyberPanel] +name=CyberPanel +baseurl=https://rep.cyberpanel.net/ +gpgkey=https://rep.cyberpanel.net/RPM-GPG-KEY-cyberpanel +gpgcheck=1 \ No newline at end of file diff --git a/install/firewallUtilities.py b/install/firewallUtilities.py index 8884eae16..e3a97d330 100755 --- a/install/firewallUtilities.py +++ b/install/firewallUtilities.py @@ -25,6 +25,9 @@ class FirewallUtilities: @staticmethod def addRule(proto,port): + + print('Adding port: %s' % (port)) + if port == "21": command = "sudo firewall-cmd --add-service=ftp --permanent" else: @@ -56,6 +59,7 @@ class FirewallUtilities: @staticmethod def deleteRule(proto, port): + if port=="21": command = "sudo firewall-cmd --remove-service=ftp --permanent" else: diff --git a/install/install.py b/install/install.py index bef8f5683..8d7d6df38 100755 --- a/install/install.py +++ b/install/install.py @@ -15,7 +15,7 @@ from stat import * import stat VERSION = '2.0' -BUILD = 0 +BUILD = 1 char_set = {'small': 'abcdefghijklmnopqrstuvwxyz', 'nums': '0123456789', @@ -304,10 +304,6 @@ class preFlightsChecks: except BaseException as msg: logging.InstallLog.writeToFile("[ERROR] setup_account_cyberpanel. " + str(msg)) - def yum_update(self): - command = 'yum update -y' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - def installCyberPanelRepo(self): self.stdOut("Install Cyberpanel repo") @@ -333,60 +329,6 @@ class preFlightsChecks: command = 'rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm' preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - def enableEPELRepo(self): - command = 'yum -y install epel-release' - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - def install_pip(self): - self.stdOut("Install pip") - if self.distro == ubuntu: - command = "apt-get -y install python-pip" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - elif self.distro == centos: - command = "yum -y install python-pip" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - - def install_python_dev(self): - self.stdOut("Install python development environment") - - if self.distro == centos: - command = "yum -y install python-devel" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - elif self.distro == ubuntu: - command = "apt-get -y install python-dev" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - - - def install_gcc(self): - self.stdOut("Install gcc") - - if self.distro == centos: - command = "yum -y install gcc" - else: - command = "apt-get -y install gcc" - - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - def install_python_setup_tools(self): - command = "yum -y install python-setuptools" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - def install_python_mysql_library(self): - self.stdOut("Install MySQL python library") - - if self.distro == centos: - command = "yum install mariadb-devel gcc python36u-devel -y" - else: - command = "apt-get -y install libmysqlclient-dev" - - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - if self.distro == ubuntu: - command = "pip install MySQL-python" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - def fix_selinux_issue(self): try: cmd = [] @@ -415,24 +357,11 @@ class preFlightsChecks: preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - def installGit(self): - if os.path.exists("/etc/lsb-release"): - command = 'apt -y install git' - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - else: - command = 'yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - command = 'yum install git -y' - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - def download_install_CyberPanel(self, mysqlPassword, mysql): ## os.chdir(self.path) - self.installGit() - os.chdir('/usr/local') command = "git clone https://github.com/usmannasir/cyberpanel" @@ -748,24 +677,8 @@ class preFlightsChecks: def install_postfix_davecot(self): self.stdOut("Install dovecot - first remove postfix") - if self.distro == centos: - path = '/etc/yum.repos.d/dovecot.repo' - content = """[dovecot-2.3-latest] -name=Dovecot 2.3 CentOS $releasever - $basearch -baseurl=http://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch -gpgkey=https://repo.dovecot.org/DOVECOT-REPO-GPG -gpgcheck=1 -enabled=1""" - writeToFile = open(path, 'w') - writeToFile.write(content) - writeToFile.close() - try: if self.distro == centos: - - command = 'yum -y install http://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = 'yum remove postfix -y' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) elif self.distro == ubuntu: @@ -773,13 +686,12 @@ enabled=1""" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - self.stdOut("Install dovecot - do the install") if self.distro == centos: - command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre' + command = 'yum install --enablerepo=CyberPanel -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre' elif self.distro == cent8: - command = 'dnf install postfix postfix-mysql -y' + command = 'dnf --enablerepo=CyberPanel install postfix3 postfix3-mysql -y ' else: command = 'apt-get -y debconf-utils' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) @@ -805,8 +717,10 @@ enabled=1""" ## - if self.distro == centos or self.distro == cent8: - command = 'yum -y install dovecot dovecot-mysql' + if self.distro == centos: + command = 'yum --enablerepo=CyberPanel -y install dovecot dovecot-mysql' + elif self.distro == cent8: + command = 'dnf --enablerepo=CyberPanel install dovecot23 dovecot23-mysql -y' else: command = 'apt-get -y install dovecot-mysql' @@ -1330,8 +1244,6 @@ imap_folder_list_limit = 0 def installFirewalld(self): - if self.distro == cent8: - return 0 if self.distro == ubuntu: self.removeUfw() @@ -1346,7 +1258,7 @@ imap_folder_list_limit = 0 preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) ###### - if self.distro == centos or self.distro == cent8: + if self.distro == centos: # Not available in ubuntu command = 'systemctl restart dbus' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) @@ -1416,7 +1328,25 @@ imap_folder_list_limit = 0 preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) command = 'tar zxf lscp.tar.gz -C /usr/local/' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + + ### + + lscpdPath = '/usr/local/lscp/bin/lscpd' + + command = 'cp -f /usr/local/CyberCP/lscpd-0.2.5 /usr/local/lscp/bin/lscpd-0.2.5' + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + + command = 'rm -f /usr/local/lscp/bin/lscpd' + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + + command = 'mv /usr/local/lscp/bin/lscpd-0.2.5 /usr/local/lscp/bin/lscpd' + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + + command = 'chmod 755 %s' % (lscpdPath) + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + + ## command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /usr/local/lscp/conf/key.pem -out /usr/local/lscp/conf/cert.pem' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) @@ -1562,13 +1492,13 @@ imap_folder_list_limit = 0 def setupPythonWSGI(self): try: - command = "wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.4.tgz" + command = "wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.6.tgz" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - command = "tar xf wsgi-lsapi-1.4.tgz" + command = "tar xf wsgi-lsapi-1.6.tgz" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - os.chdir("wsgi-lsapi-1.4") + os.chdir("wsgi-lsapi-1.6") command = "/usr/local/CyberPanel/bin/python ./configure.py" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) @@ -1789,8 +1719,10 @@ imap_folder_list_limit = 0 def installOpenDKIM(self): try: - if self.distro == centos or self.distro == cent8: + if self.distro == centos: command = 'yum -y install opendkim' + elif self.distro == cent8: + command = 'dnf --enablerepo=CyberPanel install opendkim -y' else: command = 'apt-get -y install opendkim' @@ -1919,60 +1851,6 @@ milter_default_action = accept return res # Though probably not used - def setupVirtualEnv(self, distro): - try: - - ## - - count = 0 - if distro == ubuntu: - # You can't install all at once! So install one at a time. - preFlightsChecks.stdOut("Installing python prerequisites", 1) - preFlightsChecks.installOne('libcurl4-gnutls-dev') - preFlightsChecks.installOne('libgnutls-dev') - preFlightsChecks.installOne('libgcrypt20-dev') - preFlightsChecks.installOne('libattr1') - preFlightsChecks.installOne('libattr1-dev') - preFlightsChecks.installOne('liblzma-dev') - preFlightsChecks.installOne('libgpgme-dev') - preFlightsChecks.installOne('libmariadbclient-dev') - preFlightsChecks.installOne('libcurl4-gnutls-dev') - preFlightsChecks.installOne('libssl-dev') - preFlightsChecks.installOne('nghttp2') - preFlightsChecks.installOne('libnghttp2-dev') - preFlightsChecks.installOne('idn2') - preFlightsChecks.installOne('libidn2-dev') - preFlightsChecks.installOne('libidn2-0-dev') - preFlightsChecks.installOne('librtmp-dev') - preFlightsChecks.installOne('libpsl-dev') - preFlightsChecks.installOne('nettle-dev') - preFlightsChecks.installOne('libgnutls28-dev') - preFlightsChecks.installOne('libldap2-dev') - preFlightsChecks.installOne('libgssapi-krb5-2') - preFlightsChecks.installOne('libk5crypto3') - preFlightsChecks.installOne('libkrb5-dev') - preFlightsChecks.installOne('libcomerr2') - preFlightsChecks.installOne('libldap2-dev') - preFlightsChecks.installOne('python-gpg') - preFlightsChecks.installOne('python-gpgme') - else: - command = "yum install -y libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel" - preFlightsChecks.call(command, distro, command, command, 1, 1, os.EX_OSERR) - - ## - - os.chdir(self.cwd) - - command = "chmod +x venvsetup.sh" - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - command = "./venvsetup.sh" - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - except OSError as msg: - logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setupVirtualEnv]") - return 0 - @staticmethod def enableDisableDNS(state): try: @@ -2059,62 +1937,6 @@ milter_default_action = accept except: pass - @staticmethod - def p3(distro): - ### Virtual Env 3 - - if distro == centos: - command = 'yum -y install python36 -y' - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - command = 'virtualenv -p python3 /usr/local/CyberPanel/p3' - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - env_path = '/usr/local/CyberPanel/p3' - subprocess.call(['virtualenv', env_path]) - activate_this = os.path.join(env_path, 'bin', 'activate_this.py') - exec(compile(open(activate_this, "rb").read(), activate_this, 'exec'), dict(__file__=activate_this)) - - command = "pip3 install --ignore-installed -r %s" % ('/usr/local/CyberCP/WebTerminal/requirments.txt') - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - else: - command = 'apt install -y python3-pip' - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - command = 'apt install build-essential libssl-dev libffi-dev python3-dev -y' - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - command = 'apt install -y python3-venv' - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - command = 'virtualenv -p python3 /usr/local/CyberPanel/p3' - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - - env_path = '/usr/local/CyberPanel/p3' - subprocess.call(['virtualenv', env_path]) - activate_this = os.path.join(env_path, 'bin', 'activate_this.py') - exec(compile(open(activate_this, "rb").read(), activate_this, 'exec'), dict(__file__=activate_this)) - - command = "pip3 install --ignore-installed -r %s" % ('/usr/local/CyberCP/WebTerminal/requirments.txt') - preFlightsChecks.call(command, distro, '[install python36]', - 'install python36', - 1, 0, os.EX_OSERR) - def installRestic(self): try: @@ -2122,13 +1944,11 @@ milter_default_action = accept if os.path.exists(CentOSPath): - command = 'yum install yum-utils -y' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + if self.distro == centos: + command = 'yum --enablerepo=CyberPanel install restic -y' + else: + command = 'dnf --enablerepo=CyberPanel install restic -y --nogpgcheck' - command = 'yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo' - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - command = 'yum install restic -y' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) else: command = 'apt-get update -y' @@ -2137,10 +1957,6 @@ milter_default_action = accept command = 'apt-get install restic -y' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - cronTab = '/etc/crontab' - - data = open(cronTab, 'r').read() - except: pass @@ -2236,8 +2052,17 @@ vmail command = 'systemctl enable redis' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + def disablePackegeUpdates(self): + if self.distro == centos: + mainConfFile = '/etc/yum.conf' + content = 'exclude=MariaDB-client MariaDB-common MariaDB-devel MariaDB-server MariaDB-shared ' \ + 'pdns pdns-backend-mysql dovecot dovecot-mysql postfix3 postfix3-ldap postfix3-mysql ' \ + 'postfix3-pcre restic opendkim libopendkim pure-ftpd ftp\n' + writeToFile = open(mainConfFile, 'a') + writeToFile.write(content) + writeToFile.close() def main(): parser = argparse.ArgumentParser(description='CyberPanel Installer') @@ -2307,10 +2132,6 @@ def main(): checks.checkPythonVersion() checks.setup_account_cyberpanel() checks.installCyberPanelRepo() - #checks.install_gcc() - if distro == centos: - checks.install_python_setup_tools() - #checks.install_python_mysql_library() import installCyberPanel @@ -2348,7 +2169,6 @@ def main(): checks.setup_cron() checks.installRestic() checks.installAcme() - # checks.installdnsPython() ## Install and Configure OpenDKIM. @@ -2390,6 +2210,7 @@ def main(): checks.enableDisableFTP('on', distro) checks.installCLScripts() + #checks.disablePackegeUpdates() logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index b7b5e2058..ec9bd9974 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -7,12 +7,32 @@ import randomPassword import errno import MySQLdb as mariadb import install +from os.path import exists #distros centos=0 ubuntu=1 cent8=2 +def get_Ubuntu_release(): + release = -1 + if exists("/etc/lsb-release"): + distro_file = "/etc/lsb-release" + with open(distro_file) as f: + for line in f: + if line[:16] == "DISTRIB_RELEASE=": + release = float(line[16:]) + + if release == -1: + print("Can't find distro release name in " + distro_file + " - fatal error") + + else: + logging.InstallLog.writeToFile("Can't find linux release file - fatal error") + print("Can't find linux release file - fatal error") + os._exit(os.EX_UNAVAILABLE) + + return release + class InstallCyberPanel: mysql_Root_password = "" @@ -165,16 +185,14 @@ class InstallCyberPanel: if res != 0: InstallCyberPanel.stdOut("Failed to install PHP on Ubuntu.", 1, 1) - elif self.distro == cent8 or self.distro == centos: + elif self.distro == centos: command = 'yum -y groupinstall lsphp-all' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!", 1) ## only php 71 - if self.distro == centos or self.distro == cent8: + if self.distro == centos: command = 'yum install lsphp71 lsphp71-json lsphp71-xmlrpc lsphp71-xml lsphp71-soap lsphp71-snmp ' \ 'lsphp71-recode lsphp71-pspell lsphp71-process lsphp71-pgsql lsphp71-pear lsphp71-pdo lsphp71-opcache ' \ @@ -207,27 +225,9 @@ class InstallCyberPanel: install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - def setup_mariadb_repo(self): - try: - - if self.distro == ubuntu: - # Only needed if the repo is broken or we need the latest version. - # command = "apt-get -y install software-properties-common" - # command = "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8" - # command = "add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'" - return - - InstallCyberPanel.stdOut("Setting up MariaDB Repo..", 1) - - os.chdir(self.cwd) - shutil.copy("mysql/MariaDB.repo","/etc/yum.repos.d/MariaDB.repo") - - InstallCyberPanel.stdOut("MariaDB repo set!", 1) - - - except BaseException as msg: - logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setup_mariadb_repo]") - return 0 + if self.distro == cent8: + command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* --exclude lsphp73-pecl-zip -y' + subprocess.call(command, shell=True) def installMySQL(self, mysql): @@ -235,8 +235,10 @@ class InstallCyberPanel: if self.distro == ubuntu: command = "apt-get -y install mariadb-server" - else: - command = 'yum -y install mariadb-server' + elif self.distro == centos: + command = 'yum --enablerepo=CyberPanel -y install mariadb-server' + elif self.distro == cent8: + command = 'dnf --enablerepo=CyberPanel -y install mariadb-server' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) @@ -326,8 +328,11 @@ class InstallCyberPanel: conn = mariadb.connect(user='root', passwd=self.mysql_Root_password) cursor = conn.cursor() cursor.execute('set global innodb_file_per_table = on;') - cursor.execute('set global innodb_file_format = Barracuda;') - cursor.execute('set global innodb_large_prefix = on;') + try: + cursor.execute('set global innodb_file_format = Barracuda;') + cursor.execute('set global innodb_large_prefix = on;') + except BaseException as msg: + self.stdOut('%s. [ERROR:335]' % (str(msg))) cursor.close() conn.close() @@ -351,21 +356,26 @@ class InstallCyberPanel: command = 'DEBIAN_FRONTEND=noninteractive apt install pure-ftpd-mysql -y' os.system(command) - command = 'wget https://rep.cyberpanel.net/pure-ftpd-common_1.0.47-3_all.deb' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + if get_Ubuntu_release() == 18.10: + command = 'wget https://rep.cyberpanel.net/pure-ftpd-common_1.0.47-3_all.deb' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - command = 'wget https://rep.cyberpanel.net/pure-ftpd-mysql_1.0.47-3_amd64.deb' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + command = 'wget https://rep.cyberpanel.net/pure-ftpd-mysql_1.0.47-3_amd64.deb' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - command = 'dpkg --install --force-confold pure-ftpd-common_1.0.47-3_all.deb' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + command = 'dpkg --install --force-confold pure-ftpd-common_1.0.47-3_all.deb' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - command = 'dpkg --install --force-confold pure-ftpd-mysql_1.0.47-3_amd64.deb' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + command = 'dpkg --install --force-confold pure-ftpd-mysql_1.0.47-3_amd64.deb' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - else: + elif self.distro == centos: command = "yum install -y pure-ftpd" install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + elif self.distro == cent8: + command = 'dnf --enablerepo=CyberPanel install pure-ftpd -y' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + ####### Install pureftpd to system startup @@ -399,8 +409,11 @@ class InstallCyberPanel: except: logging.InstallLog.writeToFile("[ERROR] Could not create directory for FTP SSL") + if (self.distro == centos or self.distro == cent8) or (self.distro == ubuntu and get_Ubuntu_release() == 18.14): + command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem' + else: + command = 'openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem' - command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem' install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) os.chdir(self.cwd) @@ -463,6 +476,7 @@ class InstallCyberPanel: command = 'echo "/etc/pure-ftpd/db/mysql.conf" > /etc/pure-ftpd/conf/MySQLConfigFile' subprocess.call(command, shell=True) + command = 'ln -s /etc/pure-ftpd/conf/MySQLConfigFile /etc/pure-ftpd/auth/30mysql' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) @@ -511,17 +525,12 @@ class InstallCyberPanel: # ". This may need to be fixed manually as 'echo \"nameserver 8.8.8.8\"> " # "/etc/resolv.conf'", 1, 1, os.EX_OSERR) - if self.distro == centos: - command = 'curl -o /etc/yum.repos.d/powerdns-auth-42.repo ' \ - 'https://repo.powerdns.com/repo-files/centos-auth-42.repo' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - if self.distro == cent8: - command = 'dnf config-manager --set-enabled PowerTools' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - command = 'curl -o /etc/yum.repos.d/powerdns-auth-master.repo https://repo.powerdns.com/repo-files/centos-auth-master.repo' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + # if self.distro == cent8: + # command = 'dnf config-manager --set-enabled PowerTools' + # install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + # + # command = 'curl -o /etc/yum.repos.d/powerdns-auth-master.repo https://repo.powerdns.com/repo-files/centos-auth-master.repo' + # install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) if self.distro == ubuntu: command = "DEBIAN_FRONTEND=noninteractive apt-get -y install pdns-server pdns-backend-mysql" @@ -636,8 +645,6 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns if ent == 0: installer.fix_ols_configs() - - installer.setup_mariadb_repo() installer.installMySQL(mysql) installer.changeMYSQLRootPassword() #installer.changeMYSQLRootPasswordCyberPanel(mysql) diff --git a/install/pure-ftpd-one/pure-ftpd.conf b/install/pure-ftpd-one/pure-ftpd.conf index 1c0af0529..299252b61 100755 --- a/install/pure-ftpd-one/pure-ftpd.conf +++ b/install/pure-ftpd-one/pure-ftpd.conf @@ -18,7 +18,7 @@ MaxLoad 4 AntiWarez yes Umask 133:022 MinUID 1000 -UseFtpUsers no +#UseFtpUsers no AllowUserFXP no AllowAnonymousFXP no ProhibitDotFilesWrite no diff --git a/install/pure-ftpd/pure-ftpd.conf b/install/pure-ftpd/pure-ftpd.conf index 1c0af0529..299252b61 100755 --- a/install/pure-ftpd/pure-ftpd.conf +++ b/install/pure-ftpd/pure-ftpd.conf @@ -18,7 +18,7 @@ MaxLoad 4 AntiWarez yes Umask 133:022 MinUID 1000 -UseFtpUsers no +#UseFtpUsers no AllowUserFXP no AllowAnonymousFXP no ProhibitDotFilesWrite no diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 4fb5a2f4c..7e87d0a8c 100644 Binary files a/locale/de/LC_MESSAGES/django.mo and b/locale/de/LC_MESSAGES/django.mo differ diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index ab5945318..879f60b6f 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -3,28 +3,20 @@ # This file is distributed under the same license as the CyberPanel package. # FIRST AUTHOR , 2017. # -#: baseTemplate/templates/baseTemplate/index.html:219 -#: baseTemplate/templates/baseTemplate/index.html:272 -#: baseTemplate/templates/baseTemplate/index.html:279 -#: baseTemplate/templates/baseTemplate/index.html:286 -#: baseTemplate/templates/baseTemplate/index.html:293 -#: baseTemplate/templates/baseTemplate/index.html:300 -#: baseTemplate/templates/baseTemplate/index.html:307 -#: emailMarketing/templates/emailMarketing/sendEmails.html:93 msgid "" msgstr "" "Project-Id-Version: CyberPanel\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-21 19:54+0500\n" -"PO-Revision-Date: 2019-08-14 18:39+0200\n" -"Last-Translator: \n" -"Language-Team: GERMAN \n" +"PO-Revision-Date: 2020-05-26 08:47+0200\n" +"Last-Translator: Linunaut \n" +"Language-Team: Linunaut \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.2.3\n" +"X-Generator: Poedit 2.3.1\n" #: CLManager/templates/CLManager/createPackage.html:3 msgid "Create Cloud Linux Package - CyberPanel" @@ -110,12 +102,12 @@ msgstr "NPROC" #: CLManager/templates/CLManager/createPackage.html:105 #: CLManager/templates/CLManager/listPackages.html:164 msgid "INODES soft" -msgstr "INODES weich" +msgstr "INODES soft" #: CLManager/templates/CLManager/createPackage.html:113 #: CLManager/templates/CLManager/listPackages.html:175 msgid "INODES hard" -msgstr "INODES hart" +msgstr "INODES hard" #: CLManager/templates/CLManager/listPackages.html:3 msgid "Manage CloudLinux Packages - CyberPanel" @@ -328,7 +320,7 @@ msgstr "Italienisch" #: CyberCP/settings.py:189 msgid "Deutsch" -msgstr "" +msgstr "Deutsch" #: IncBackups/templates/IncBackups/backupSchedule.html:3 #: backup/templates/backup/backupSchedule.html:3 @@ -376,10 +368,8 @@ msgstr "Frequenz bestimmen" #: IncBackups/templates/IncBackups/backupSchedule.html:54 #: IncBackups/templates/IncBackups/createBackup.html:56 -#, fuzzy -#| msgid "Backup Management" msgid "Backup Content" -msgstr "Sicherungsverwaltung" +msgstr "Backup-Inhalt" #: IncBackups/templates/IncBackups/backupSchedule.html:98 #: IncBackups/templates/IncBackups/incrementalDestinations.html:72 @@ -398,6 +388,7 @@ msgstr "Suche Konten..." #: IncBackups/templates/IncBackups/backupSchedule.html:124 msgid "Select sites to be included in this job" msgstr "" +"Wähle die Webseiten aus, die in diesen Auftrag einbezogen werden sollen" #: IncBackups/templates/IncBackups/backupSchedule.html:150 #: IncBackups/templates/IncBackups/createBackup.html:127 @@ -460,10 +451,8 @@ msgid "Delete" msgstr "Löschen" #: IncBackups/templates/IncBackups/createBackup.html:3 -#, fuzzy -#| msgid "Cancel Backup" msgid "Create Incremental Backup" -msgstr "Sicherung abbrechen" +msgstr "Erstellen einer inkrementellen Sicherung" #: IncBackups/templates/IncBackups/createBackup.html:13 #: IncBackups/templates/IncBackups/createBackup.html:23 @@ -481,10 +470,10 @@ msgid "Backup Docs" msgstr "Sicherung Docs" #: IncBackups/templates/IncBackups/createBackup.html:17 -#, fuzzy -#| msgid "This page can be used to Back up your websites" msgid "This page can be used to create incremental backups for your websites." -msgstr "Diese Seite kann zum sichern der Webseite benutzt werden" +msgstr "" +"Diese Seite kann verwendet werden, um inkrementelle Sicherungen für deine " +"Webseiten zu erstellen." #: IncBackups/templates/IncBackups/createBackup.html:33 #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:35 @@ -538,13 +527,13 @@ msgstr "Job ID" #: IncBackups/templates/IncBackups/createBackup.html:162 #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:97 msgid "Snapshot ID" -msgstr "" +msgstr "Snapshot ID" #: IncBackups/templates/IncBackups/createBackup.html:163 #: dns/templates/dns/addDeleteDNSRecords.html:327 #: pluginHolder/templates/pluginHolder/plugins.html:29 msgid "Type" -msgstr "Art" +msgstr "Typ" #: IncBackups/templates/IncBackups/createBackup.html:165 #: websiteFunctions/templates/websiteFunctions/listCron.html:52 @@ -558,30 +547,22 @@ msgid "Set up Back up Destinations" msgstr "Zielort der Sicherung" #: IncBackups/templates/IncBackups/incrementalDestinations.html:14 -#, fuzzy -#| msgid "Set up Back up Destinations" msgid "Set up Incremental Back up Destinations" -msgstr "Zielort der Sicherung" +msgstr "Zielort der inkrementellen Sicherung" #: IncBackups/templates/IncBackups/incrementalDestinations.html:20 -#, fuzzy -#| msgid "On this page you can set up your Back up destinations. (SFTP)" msgid "On this page you can set up your Back up destinations. (SFTP and AWS)" msgstr "" "Auf dieser Seite kannst du die Zielorte für deine Sicherungen definieren. " -"(SFTP)" +"(SFTP und AWS)" #: IncBackups/templates/IncBackups/incrementalDestinations.html:26 -#, fuzzy -#| msgid "Set up Back up Destinations" msgid "Set up Back up Destinations." -msgstr "Zielort der Sicherung" +msgstr "Zielort der Sicherung definieren." #: IncBackups/templates/IncBackups/incrementalDestinations.html:35 -#, fuzzy -#| msgid "Select Template" msgid "Select Type" -msgstr "Template auswählen" +msgstr "Typ auswählen" #: IncBackups/templates/IncBackups/incrementalDestinations.html:47 #: backup/templates/backup/backupDestinations.html:30 @@ -635,30 +616,28 @@ msgstr "IP" #: IncBackups/templates/IncBackups/incrementalDestinations.html:117 #: IncBackups/templates/IncBackups/incrementalDestinations.html:153 msgid "AWS_ACCESS_KEY_ID" -msgstr "" +msgstr "AWS_ACCESS_KEY_ID" #: IncBackups/templates/IncBackups/incrementalDestinations.html:124 msgid "AWS_SECRET_ACCESS_KEY" -msgstr "" +msgstr "AWS_SECRET_ACCESS_KEY" #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:3 #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:13 -#, fuzzy -#| msgid "Cancel Backup" msgid "Restore Remote Incremental Backups" -msgstr "Sicherung abbrechen" +msgstr "Wiederherstellen von inkrementellen Remotesicherungen" #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:19 -#, fuzzy -#| msgid "This page can be used to Back up your websites" msgid "" "This page can be used to restore remote incremental backups for your " "websites." -msgstr "Diese Seite kann zum sichern der Webseite benutzt werden" +msgstr "" +"Diese Seite kann verwendet werden, um inkrementelle Remotesicherungen für " +"deine Webseiten wiederherzustellen." #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:69 msgid "Fetch Restore Points" -msgstr "" +msgstr "Abrufen von Wiederherstellungspunkten" #: IncBackups/templates/IncBackups/restoreRemoteBackups.html:99 #: emailMarketing/templates/emailMarketing/manageSMTPHosts.html:76 @@ -692,33 +671,31 @@ msgid "Actions" msgstr "Aktionen" #: WebTerminal/templates/WebTerminal/WebTerminal.html:3 -#, fuzzy -#| msgid "Domains - CyberPanel" msgid "Terminal - CyberPanel" -msgstr "Domains - CyberPanel" +msgstr "Terminal - CyberPanel" #: WebTerminal/templates/WebTerminal/WebTerminal.html:16 #: baseTemplate/templates/baseTemplate/index.html:641 #: baseTemplate/templates/baseTemplate/index.html:650 msgid "Terminal" -msgstr "" +msgstr "Terminal" #: WebTerminal/templates/WebTerminal/WebTerminal.html:18 msgid "Web Terminal Docs" -msgstr "" +msgstr "Web Terminal Docs" #: WebTerminal/templates/WebTerminal/WebTerminal.html:19 msgid "Execute your terminal commands." -msgstr "" +msgstr "Führen deine Terminalbefehle aus." #: WebTerminal/templates/WebTerminal/WebTerminal.html:26 #: baseTemplate/templates/baseTemplate/index.html:643 msgid "Web Terminal" -msgstr "" +msgstr "Web Terminal" #: WebTerminal/templates/WebTerminal/WebTerminal.html:28 msgid "Reboot SSH Server" -msgstr "" +msgstr "SSH Server neu starten" #: backup/templates/backup/backup.html:15 msgid "This page can be used to Back up your websites" @@ -872,11 +849,13 @@ msgstr "Verbindung überprüfen" #: backup/templates/backup/backupSchedule.html:54 msgid "Local Path" -msgstr "" +msgstr "Lokaler Pfad" #: backup/templates/backup/backupSchedule.html:57 msgid "Local directory where backups will be moved after creation." msgstr "" +"Lokales Verzeichnis, in dem Sicherungen nach der Erstellung verschoben " +"werden." #: backup/templates/backup/backupSchedule.html:82 msgid "Cannot add schedule. Error message:" @@ -1501,16 +1480,12 @@ msgid "Create Nameserver" msgstr "Nameserver erstellen" #: baseTemplate/templates/baseTemplate/index.html:488 -#, fuzzy -#| msgid "Create Nameserver" msgid "Configure Default Nameservers" -msgstr "Nameserver erstellen" +msgstr "Konfigurieren von Standardnameservern" #: baseTemplate/templates/baseTemplate/index.html:488 -#, fuzzy -#| msgid "Create Nameserver" msgid "Config Default Nameservers" -msgstr "Nameserver erstellen" +msgstr "Konfiguriere Standardnameserver" #: baseTemplate/templates/baseTemplate/index.html:491 #: dns/templates/dns/createDNSZone.html:12 @@ -1647,43 +1622,31 @@ msgstr "Zielorte hinzufügen/löschen" #: baseTemplate/templates/baseTemplate/index.html:590 msgid "Incremental Back up - Beta" -msgstr "" +msgstr "Inkrementelles Sichern - Beta" #: baseTemplate/templates/baseTemplate/index.html:592 -#, fuzzy -#| msgid "Cancel Backup" msgid "Incremental Back up" -msgstr "Sicherung abbrechen" +msgstr "Inkrementelles Sichern" #: baseTemplate/templates/baseTemplate/index.html:598 -#, fuzzy -#| msgid "Restore Back up" msgid "Create/Restore Back up" -msgstr "Sicherung wiederherstellen" +msgstr "Sicherung erstellen/wiederherstellen" #: baseTemplate/templates/baseTemplate/index.html:601 -#, fuzzy -#| msgid "Add/Delete Destinations" msgid "Add/Remove Destinations" msgstr "Hinzufügen/Löschen von Zielorten" #: baseTemplate/templates/baseTemplate/index.html:604 -#, fuzzy -#| msgid "Schedule Back up" msgid "Schedule Back ups" msgstr "Sicherung planen" #: baseTemplate/templates/baseTemplate/index.html:607 -#, fuzzy -#| msgid "Transfer Websites from Remote Server - CyberPanel" msgid "Restore from Remote Server" -msgstr "Webseiten vom Remote-Server übertragen - CybaerPanel" +msgstr "Wiederherstellen vom Remote-Server" #: baseTemplate/templates/baseTemplate/index.html:607 -#, fuzzy -#| msgid "Restore Website" msgid "Restore from Remote" -msgstr "Webseite wiederherstellen" +msgstr "Wiederherstellen von Remote" #: baseTemplate/templates/baseTemplate/index.html:624 #: manageSSL/templates/manageSSL/index.html:29 @@ -1725,7 +1688,7 @@ msgstr "NEU" #: baseTemplate/templates/baseTemplate/index.html:650 msgid "Web Based Terminal" -msgstr "" +msgstr "Web Basiertes Terminal" #: baseTemplate/templates/baseTemplate/index.html:657 #: baseTemplate/templates/baseTemplate/index.html:659 @@ -2408,16 +2371,12 @@ msgid "Record Successfully Added." msgstr "Record erfolgreich hinzugefügt." #: dns/templates/dns/configureDefaultNameServers.html:3 -#, fuzzy -#| msgid "Create Nameserver - CyberPanel" msgid "Configure Default Nameserver - CyberPanel" -msgstr "Nameserver erstellen - CyberPanel" +msgstr "Konfigurieren von Standardnameserver - CyberPanel" #: dns/templates/dns/configureDefaultNameServers.html:12 -#, fuzzy -#| msgid "Create Nameserver" msgid "Configure Default Nameserver" -msgstr "Nameserver erstellen" +msgstr "Konfigurieren von Standardnameserver" #: dns/templates/dns/configureDefaultNameServers.html:13 #: dns/templates/dns/createNameServer.html:13 @@ -2439,22 +2398,16 @@ msgid "First Nameserver" msgstr "Erster Nameserver" #: dns/templates/dns/configureDefaultNameServers.html:45 -#, fuzzy -#| msgid "Second Nameserver (Back up)" msgid "Second Nameserver" -msgstr "Zweiter Nameserver (ersatz)" +msgstr "Zweiter Nameserver" #: dns/templates/dns/configureDefaultNameServers.html:52 -#, fuzzy -#| msgid "First Nameserver" msgid "Third Nameserver" -msgstr "Erster Nameserver" +msgstr "Dritter Nameserver" #: dns/templates/dns/configureDefaultNameServers.html:59 -#, fuzzy -#| msgid "First Nameserver" msgid "Forth Nameserver" -msgstr "Erster Nameserver" +msgstr "Vierter Nameserver" #: dns/templates/dns/configureDefaultNameServers.html:68 #: emailMarketing/templates/emailMarketing/website.html:656 @@ -3759,10 +3712,8 @@ msgstr "SpamAssassin Konfigurationen erfolgreich gespeichert." #: emailPremium/templates/emailPremium/emailLimits.html:13 #: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/policyServer.html:13 -#, fuzzy -#| msgid "Emai Limits Docs" msgid "Email Limits Docs" -msgstr "E-Mai Limits Docs" +msgstr "E-Mail Limits Docs" #: emailPremium/templates/emailPremium/emailLimits.html:14 msgid "View and change email limits for a domain name." @@ -3832,7 +3783,7 @@ msgstr "Verwalten" #: emailPremium/templates/emailPremium/emailPage.html:13 msgid "Emai Limits Docs" -msgstr "E-Mai Limits Docs" +msgstr "E-Mai Grenzwerte Docs" #: emailPremium/templates/emailPremium/emailPage.html:14 msgid "View and change limits for an Email Address." @@ -4789,10 +4740,8 @@ msgstr "" "Mails." #: mailServer/templates/mailServer/emailForwarding.html:61 -#, fuzzy -#| msgid "Forwarding Docs" msgid "Forwarding Options" -msgstr "Weiterleitung Docs" +msgstr "Weiterleitungsoptionen" #: mailServer/templates/mailServer/emailForwarding.html:97 #: mailServer/templates/mailServer/emailForwarding.html:118 @@ -4801,7 +4750,7 @@ msgstr "Quelle" #: mailServer/templates/mailServer/emailForwarding.html:101 msgid "or path to the program" -msgstr "" +msgstr "oder Pfad zum Programm" #: mailServer/templates/mailServer/emailForwarding.html:106 msgid "Forward Email" @@ -5442,10 +5391,8 @@ msgid "Switch to LiteSpeed Enterprise Web Server" msgstr "Wechseln zu LiteSpeed Enterprise Web Server" #: serverStatus/templates/serverStatus/litespeedStatus.html:149 -#, fuzzy -#| msgid "LiteSpeed Processes" msgid "LiteSpeed Serial No. (License Key)" -msgstr "LiteSpeed Prozesse" +msgstr "LiteSpeed Seriennummer (Lizenzschlüssel)" #: serverStatus/templates/serverStatus/litespeedStatus.html:160 msgid "Switch" @@ -5453,7 +5400,7 @@ msgstr "Wechseln" #: serverStatus/templates/serverStatus/litespeedStatus.html:162 msgid "Get 15 Days Trial" -msgstr "" +msgstr "Erhalte eine 15 Tage Testversion" #: serverStatus/templates/serverStatus/litespeedStatus.html:175 msgid "" @@ -5461,6 +5408,9 @@ msgid "" "CyberPanel will auto fetch 15 days trial key for you. Make sure this server " "have not used trial already." msgstr "" +"Hinweis: Wenn die 15 Tage Testversion ausgewählt wird, muss der Serial key " +"nicht eingegeben werden, CyberPanel ruft automatisch den 15-Tage-Testkey ab. " +"Stelle sicher, dass dieser Server noch keine Testversion verwendet hat." #: serverStatus/templates/serverStatus/litespeedStatus.html:193 msgid "With great wisdom comes great responsibility." @@ -5970,10 +5920,8 @@ msgstr "Webseiten Grenzwerte" #: userManagment/templates/userManagment/createUser.html:107 #: userManagment/templates/userManagment/modifyUser.html:85 -#, fuzzy -#| msgid "Security" msgid "Security Level" -msgstr "Sicherheit" +msgstr "Sicherheitsstufe" #: userManagment/templates/userManagment/createUser.html:120 #: userManagment/templates/userManagment/index.html:49 @@ -6309,38 +6257,32 @@ msgid "Installation successful. Visit:" msgstr "Installation erfolgreich. Besuche:" #: websiteFunctions/templates/websiteFunctions/installMagento.html:3 -#, fuzzy -#| msgid "Install PrestaShop - CyberPanel" msgid "Install Magento - CyberPanel" -msgstr "PrestaShop installieren - CyberPanel" +msgstr "Magento installieren - CyberPanel" #: websiteFunctions/templates/websiteFunctions/installMagento.html:12 #: websiteFunctions/templates/websiteFunctions/launchChild.html:724 #: websiteFunctions/templates/websiteFunctions/launchChild.html:728 #: websiteFunctions/templates/websiteFunctions/website.html:1029 #: websiteFunctions/templates/websiteFunctions/website.html:1033 -#, fuzzy -#| msgid "Install Packages" msgid "Install Magento" -msgstr "Pakete installieren" +msgstr "Magento installieren" #: websiteFunctions/templates/websiteFunctions/installMagento.html:13 -#, fuzzy -#| msgid "One-click PrestaShop Install!" msgid "One-click Magento Install!" -msgstr "1-Klick PrestaShop Installation!" +msgstr "1-Klick Magento Installation!" #: websiteFunctions/templates/websiteFunctions/installMagento.html:51 -#, fuzzy -#| msgid "Username" msgid "Admin Username" -msgstr "用户名" +msgstr "Admin Benutzername" #: websiteFunctions/templates/websiteFunctions/installMagento.html:93 msgid "" "does not work on OpenLiteSpeed. It is highly recommended to use this " "installer with LiteSpeed Enterprise only." msgstr "" +"funktioniert nicht mit OpenLiteSpeed. Es wird dringend empfohlen, dieses " +"Installationsprogramm nur mit LiteSpeed Enterprise zu verwenden." #: websiteFunctions/templates/websiteFunctions/installPrestaShop.html:3 msgid "Install PrestaShop - CyberPanel" @@ -6387,7 +6329,7 @@ msgstr "WP + LSCache" #: websiteFunctions/templates/websiteFunctions/launchChild.html:729 #: websiteFunctions/templates/websiteFunctions/website.html:1034 msgid "Magento" -msgstr "" +msgstr "Magento" #: websiteFunctions/templates/websiteFunctions/listCron.html:3 msgid "Cron Management - CyberPanel" diff --git a/locale/id/LC_MESSAGES/django.mo b/locale/id/LC_MESSAGES/django.mo index 188a54c15..5a428914d 100755 Binary files a/locale/id/LC_MESSAGES/django.mo and b/locale/id/LC_MESSAGES/django.mo differ diff --git a/locale/pt-BR/LC_MESSAGES/django.mo b/locale/pt-BR/LC_MESSAGES/django.mo index 8700c1561..ec8862658 100644 Binary files a/locale/pt-BR/LC_MESSAGES/django.mo and b/locale/pt-BR/LC_MESSAGES/django.mo differ diff --git a/locale/pt/LC_MESSAGES/django.mo b/locale/pt/LC_MESSAGES/django.mo index 8700c1561..ec8862658 100755 Binary files a/locale/pt/LC_MESSAGES/django.mo and b/locale/pt/LC_MESSAGES/django.mo differ diff --git a/loginSystem/templates/loginSystem/login.html b/loginSystem/templates/loginSystem/login.html index 17b3ced2f..06aecce9b 100755 --- a/loginSystem/templates/loginSystem/login.html +++ b/loginSystem/templates/loginSystem/login.html @@ -204,6 +204,7 @@ + diff --git a/loginSystem/views.py b/loginSystem/views.py index a12262af4..cfb93a717 100644 --- a/loginSystem/views.py +++ b/loginSystem/views.py @@ -19,7 +19,7 @@ from django.utils import translation # Create your views here. VERSION = '2.0' -BUILD = 0 +BUILD = 1 def verifyLogin(request): try: @@ -69,6 +69,8 @@ def verifyLogin(request): user_Language = "it" elif data['languageSelection'] == "German": user_Language = "de" + elif data['languageSelection'] == "Indonesian": + user_Language = "id" translation.activate(user_Language) response = HttpResponse() diff --git a/lscpd-0.2.4 b/lscpd-0.2.5 old mode 100644 new mode 100755 similarity index 79% rename from lscpd-0.2.4 rename to lscpd-0.2.5 index 8dc0b63ba..5ce38f60d Binary files a/lscpd-0.2.4 and b/lscpd-0.2.5 differ diff --git a/mailServer/mailserverManager.py b/mailServer/mailserverManager.py index 2463bb94f..a67006543 100755 --- a/mailServer/mailserverManager.py +++ b/mailServer/mailserverManager.py @@ -226,6 +226,38 @@ class MailServerManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) + def fixMailSSL(self): + try: + + userID = self.request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + data = json.loads(self.request.body) + selectedDomain = data['selectedDomain'] + + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(selectedDomain, admin, currentACL) == 1: + pass + else: + return ACLManager.loadErrorJson('status', 0) + + website = Websites.objects.get(domain=selectedDomain) + + execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = '%s setupAutoDiscover --virtualHostName %s --websiteOwner %s' % (execPath, selectedDomain, website.admin.userName) + + ProcessUtilities.executioner(execPath) + + data_ret = {'status': 1, 'error_message': "None"} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + def emailForwarding(self): try: userID = self.request.session['userID'] @@ -476,6 +508,19 @@ class MailServerManager: except: raise BaseException('No emails exist for this domain.') + postfixMapPath = '/etc/postfix/vmail_ssl.map' + + if os.path.exists(postfixMapPath): + + postfixMapData = open(postfixMapPath, 'r').read() + + if postfixMapData.find(selectedDomain) == -1: + mailConfigured = 0 + else: + mailConfigured = 1 + else: + mailConfigured = 0 + records = emailDomain.eusers_set.all() json_data = "[" @@ -492,7 +537,7 @@ class MailServerManager: json_data = json_data + ',' + json.dumps(dic) json_data = json_data + ']' - final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data}) + final_json = json.dumps({'status': 1, 'fetchStatus': 1,'serverHostname': 'mail.%s' % (selectedDomain), 'mailConfigured': mailConfigured, 'error_message': "None", "data": json_data}) return HttpResponse(final_json) except BaseException as msg: @@ -607,6 +652,12 @@ class MailServerManager: return ACLManager.loadError() try: + + import tldextract + + extractDomain = tldextract.extract(domainName) + domainName = extractDomain.domain + '.' + extractDomain.suffix + path = "/etc/opendkim/keys/" + domainName + "/default.txt" command = "sudo cat " + path output = ProcessUtilities.outputExecutioner(command, 'opendkim') @@ -617,6 +668,8 @@ class MailServerManager: command = "sudo cat " + path privateKey = ProcessUtilities.outputExecutioner(command, 'opendkim') + DNS.createDKIMRecords(domainName) + data_ret = {'status': 1, 'fetchStatus': 1, 'keysAvailable': 1, 'publicKey': output[leftIndex:rightIndex], 'privateKey': privateKey, 'dkimSuccessMessage': 'Keys successfully fetched!', 'error_message': "None"} diff --git a/mailServer/static/mailServer/mailServer.js b/mailServer/static/mailServer/mailServer.js index 3bf1db1c3..f46bb4d4a 100755 --- a/mailServer/static/mailServer/mailServer.js +++ b/mailServer/static/mailServer/mailServer.js @@ -1124,6 +1124,7 @@ app.controller('listEmails', function ($scope, $http) { $scope.cyberpanelLoading = true; $scope.emailsAccounts = true; + $scope.mailConfigured = 1; $scope.populateCurrentRecords = function () { $scope.cyberpanelLoading = false; @@ -1151,6 +1152,9 @@ app.controller('listEmails', function ($scope, $http) { if (response.data.status === 1) { $scope.emailsAccounts = false; $scope.records = JSON.parse(response.data.data); + $scope.mailConfigured = response.data.mailConfigured; + $scope.serverHostname = response.data.serverHostname; + new PNotify({ title: 'Success!', text: 'Emails Successfully Fetched.', @@ -1229,6 +1233,55 @@ app.controller('listEmails', function ($scope, $http) { } + }; + + $scope.fixMailSSL = function (email) { + + $scope.cyberpanelLoading = false; + + var url = "/email/fixMailSSL"; + + var data = { + selectedDomain: $scope.selectedDomain, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + if (response.data.status === 1) { + $scope.populateCurrentRecords(); + new PNotify({ + title: 'Success!', + text: 'Configurations applied successfully.', + type: 'success' + }); + + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + + } + + } + + function cantLoadInitialDatas(response) { + new PNotify({ + title: 'Error!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + + }; $scope.changePasswordInitial = function (email) { diff --git a/mailServer/templates/mailServer/listEmails.html b/mailServer/templates/mailServer/listEmails.html index 955cdf4f8..8b86a7786 100755 --- a/mailServer/templates/mailServer/listEmails.html +++ b/mailServer/templates/mailServer/listEmails.html @@ -56,7 +56,106 @@
    -
    +
    +
    +

    {% trans "SSL for email is not configured properly, you may get Self-Signed error on mail clients such as Outlook and Thunderbird. More details " %}here.

    +
    + + + +
    + +
    + +

    {% trans "Details To Configure Mail Clients" %}

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {% trans "POP3" %}{% trans "Details" %}
    {% trans "Server Hostname" %}{$ serverHostname $}
    {% trans "Port" %}110
    {% trans "Port" %}995 (SSL)
    {% trans "SSL" %}STARTTLS
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {% trans "IMAP" %}{% trans "Details" %}
    {% trans "Server Hostname" %}{$ serverHostname $}
    {% trans "Port" %}143
    {% trans "Port" %}993 (SSL)
    {% trans "SSL" %}STARTTLS
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {% trans "SMTP" %}{% trans "Details" %}
    {% trans "Server Hostname" %}{$ serverHostname $}
    {% trans "Port" %}25
    {% trans "Port" %}587 (SSL)
    {% trans "Port" %}465 (SSL)
    {% trans "SSL" %}STARTTLS
    +
    + +
    @@ -74,7 +173,8 @@ class="btn btn-border btn-alt border-purple btn-link font-purple" href="#" title="">{% trans 'Change Password' %} - {% trans 'Delete' %} diff --git a/mailServer/urls.py b/mailServer/urls.py index 74d902484..a974c6b64 100755 --- a/mailServer/urls.py +++ b/mailServer/urls.py @@ -20,6 +20,7 @@ urlpatterns = [ url(r'^deleteEmailAccount', views.deleteEmailAccount, name='deleteEmailAccount'), url(r'^getEmailsForDomain$', views.getEmailsForDomain, name='getEmailsForDomain'), url(r'^submitEmailDeletion', views.submitEmailDeletion, name='submitEmailDeletion'), + url(r'^fixMailSSL', views.fixMailSSL, name='fixMailSSL'), ## Change email password diff --git a/mailServer/views.py b/mailServer/views.py index 337567c07..12ce04a91 100755 --- a/mailServer/views.py +++ b/mailServer/views.py @@ -91,6 +91,18 @@ def submitEmailDeletion(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) +def fixMailSSL(request): + try: + + msM = MailServerManager(request) + coreResult = msM.fixMailSSL() + + return coreResult + except KeyError as msg: + data_ret = {'deleteEmailStatus': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + def emailForwarding(request): try: msM = MailServerManager(request) diff --git a/managePHP/views.py b/managePHP/views.py index 4ef3a6ecc..62e9d0f26 100755 --- a/managePHP/views.py +++ b/managePHP/views.py @@ -1085,7 +1085,7 @@ def installExtensions(request): phpPath = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php70.xml') else: phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp70.xml') @@ -1116,7 +1116,7 @@ def installExtensions(request): phpPath = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php71.xml') else: phpPath = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp71.xml') @@ -1144,7 +1144,7 @@ def installExtensions(request): php72Path = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: php72Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php72.xml') else: php72Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp72.xml') @@ -1172,7 +1172,7 @@ def installExtensions(request): php73Path = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: php73Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php73.xml') else: php73Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp73.xml') @@ -1200,7 +1200,7 @@ def installExtensions(request): php74Path = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: php74Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'php74.xml') else: php74Path = os.path.join('/usr', 'local', 'CyberCP', 'managePHP', 'ubuntuphp74.xml') @@ -1344,7 +1344,7 @@ def getRequestStatus(request): checkCommand = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: checkCommand = 'yum list installed' checkCommand = shlex.split(checkCommand) else: @@ -1469,7 +1469,7 @@ def getRequestStatusApache(request): checkCommand = '' - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: checkCommand = 'yum list installed' checkCommand = shlex.split(checkCommand) else: @@ -1607,7 +1607,7 @@ def getCurrentPHPConfig(request): phpVers = "php" + PHPManager.getPHPString(phpVers) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini" else: initial = phpVers[3] @@ -1767,7 +1767,7 @@ def getCurrentAdvancedPHPConfig(request): phpVers = "php" + PHPManager.getPHPString(phpVers) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini" else: initial = phpVers[3] @@ -1809,7 +1809,7 @@ def savePHPConfigAdvance(request): phpVers = "php" + PHPManager.getPHPString(phpVers) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini" else: initial = phpVers[3] diff --git a/manageSSL/views.py b/manageSSL/views.py index 05ec7e988..0dfdb16c5 100755 --- a/manageSSL/views.py +++ b/manageSSL/views.py @@ -126,7 +126,7 @@ def sslForHostName(request): else: return ACLManager.loadError() - websitesName = ACLManager.findAllSites(currentACL, userID) + websitesName = ACLManager.findAllSites(currentACL, userID, 1) return render(request, 'manageSSL/sslForHostName.html', {'websiteList': websitesName}) except KeyError: @@ -151,11 +151,15 @@ def obtainHostNameSSL(request): data = json.loads(request.body) virtualHost = data['virtualHost'] - path = "/home/" + virtualHost + "/public_html" + try: + website = Websites.objects.get(domain=virtualHost) + path = "/home/" + virtualHost + "/public_html" + except: + website = ChildDomains.objects.get(domain=virtualHost) + path = website.path - data = json.loads(request.body) - virtualHost = data['virtualHost'] admin = Administrator.objects.get(pk=userID) + if ACLManager.checkOwnership(virtualHost, admin, currentACL) == 1: pass else: diff --git a/manageServices/serviceManager.py b/manageServices/serviceManager.py index c37468a3b..05ef80e92 100755 --- a/manageServices/serviceManager.py +++ b/manageServices/serviceManager.py @@ -6,6 +6,8 @@ from manageServices.models import SlaveServers class ServiceManager: + slaveConfPath = '/home/cyberpanel/slaveConf' + def __init__(self, extraArgs): self.extraArgs = extraArgs @@ -24,14 +26,14 @@ class ServiceManager: ipStringNoSubnet = '' for items in SlaveServers.objects.all(): - ipsString = ipsString + '%s/32 ' % (items.slaveServerIP) - ipStringNoSubnet = ipStringNoSubnet + '%s ' % (items.slaveServerIP) - - ipsString = ipsString.rstrip(' ') - ipStringNoSubnet = ipStringNoSubnet.rstrip(' ') - + ipsString = ipsString + '%s/32, ' % (items.slaveServerIP) + ipStringNoSubnet = ipStringNoSubnet + '%s, ' % (items.slaveServerIP) + ipsString = ipsString.rstrip(', ') + ipStringNoSubnet = ipStringNoSubnet.rstrip(', ') + tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + writeToFile = open(tempPath, 'w') for items in data: if items.find('allow-axfr-ips') > -1: @@ -49,14 +51,14 @@ class ServiceManager: if items.find('slave') > -1: continue + if items.find('master') > -1: + continue + counter = counter + 1 - tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) - writeToFile = open(tempPath, 'w') - - for items in data: writeToFile.writelines(items + '\n') + writeToFile.writelines('allow-axfr-ips=' + ipsString + '\n') writeToFile.writelines('also-notify=' + ipStringNoSubnet + '\n') writeToFile.writelines('daemon=no\n') @@ -64,33 +66,42 @@ class ServiceManager: writeToFile.writelines('master=yes\n') writeToFile.close() else: - counter = 0 + import os - for items in data: - if items.find('allow-axfr-ips') > -1: - continue + if not os.path.exists(ServiceManager.slaveConfPath): - if items.find('also-notify') > -1: - continue + writeToFile = open(ServiceManager.slaveConfPath, 'w') + writeToFile.write('configured') + writeToFile.close() - if items.find('daemon=') > -1: - continue + counter = 0 - if items.find('disable-axfr') > -1: - continue + for items in data: + if items.find('allow-axfr-ips') > -1: + continue - if items.find('slave') > -1: - continue + if items.find('also-notify') > -1: + continue - counter = counter + 1 + if items.find('daemon=') > -1: + continue - tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) - writeToFile = open(tempPath, 'w') + if items.find('disable-axfr') > -1: + continue - for items in data: - writeToFile.writelines(items + '\n') + if items.find('slave') > -1: + continue - slaveData = """slave=yes + counter = counter + 1 + + tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + writeToFile = open(tempPath, 'w') + + for items in data: + writeToFile.writelines(items + '\n') + + slaveData = """ +slave=yes daemon=yes disable-axfr=yes guardian=yes @@ -103,15 +114,14 @@ setuid=pdns superslave=yes """ - writeToFile.writelines(slaveData) - writeToFile.close() + writeToFile.writelines(slaveData) + writeToFile.close() + + command = 'sudo mv ' + tempPath + ' ' + path + ProcessUtilities.executioner(command) for items in Supermasters.objects.all(): items.delete() Supermasters(ip=self.extraArgs['masterServerIP'], nameserver=self.extraArgs['slaveServerNS'], account='').save() - command = 'sudo mv ' + tempPath + ' ' + path - #subprocess.call(shlex.split(command)) - ProcessUtilities.executioner(command) - diff --git a/manageServices/templates/manageServices/managePowerDNS.html b/manageServices/templates/manageServices/managePowerDNS.html index 685f53474..013dd0533 100755 --- a/manageServices/templates/manageServices/managePowerDNS.html +++ b/manageServices/templates/manageServices/managePowerDNS.html @@ -51,57 +51,57 @@
    -
    +
    -
    +
    -
    +
    -
    +
    -
    +
    -
    +
    -
    +
    -
    - +
    +
    diff --git a/manageServices/views.py b/manageServices/views.py index 1facec6a0..b95965ed6 100755 --- a/manageServices/views.py +++ b/manageServices/views.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - from django.shortcuts import render from django.shortcuts import HttpResponse, redirect import plogical.CyberCPLogFileWriter as logging @@ -14,19 +13,41 @@ from .serviceManager import ServiceManager from plogical.processUtilities import ProcessUtilities # Create your views here. - def managePowerDNS(request): try: userID = request.session['userID'] currentACL = ACLManager.loadedACL(userID) + if currentACL['admin'] == 1: pass else: return ACLManager.loadError() try: - return render(request, 'manageServices/managePowerDNS.html', {"status": 1}) + data = {} + data['status'] = 1 + + pdnsStatus = PDNSStatus.objects.get(pk=1) + + if pdnsStatus.type == 'MASTER': + counter = 1 + + for items in SlaveServers.objects.all(): + + if counter == 1: + data['slaveServer'] = items.slaveServer + data['slaveServerIP'] = items.slaveServerIP + else: + data['slaveServer%s' % (str(counter))] = items.slaveServer + data['slaveServerIP%s' % (str(counter))] = items.slaveServerIP + + counter = counter + 1 + else: + data['slaveServerNS'] = pdnsStatus.masterServer + data['masterServerIP'] = pdnsStatus.masterIP + + return render(request, 'manageServices/managePowerDNS.html', data) except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg)) return HttpResponse("See CyberCP main log file.") diff --git a/plogical/acl.py b/plogical/acl.py index a79139059..e3ae1f63f 100755 --- a/plogical/acl.py +++ b/plogical/acl.py @@ -405,13 +405,19 @@ class ACLManager: return admin.package_set.all() @staticmethod - def findAllSites(currentACL, userID): + def findAllSites(currentACL, userID, fetchChilds = 0): websiteNames = [] if currentACL['admin'] == 1: allWebsites = Websites.objects.all() + for items in allWebsites: websiteNames.append(items.domain) + + if fetchChilds: + for child in items.childdomains_set.all(): + websiteNames.append(child.domain) + else: admin = Administrator.objects.get(pk=userID) @@ -421,11 +427,19 @@ class ACLManager: for items in websites: websiteNames.append(items.domain) + if fetchChilds: + for child in items.childdomains_set.all(): + websiteNames.append(child.domain) + for items in admins: webs = items.websites_set.all() for web in webs: websiteNames.append(web.domain) + if fetchChilds: + for child in web.childdomains_set.all(): + websiteNames.append(child.domain) + return websiteNames diff --git a/plogical/adminPass.py b/plogical/adminPass.py index fc45d27d4..653e3039a 100755 --- a/plogical/adminPass.py +++ b/plogical/adminPass.py @@ -13,7 +13,7 @@ from packages.models import Package from baseTemplate.models import version VERSION = '2.0' -BUILD = 0 +BUILD = 1 if not os.geteuid() == 0: sys.exit("\nOnly root can run this script\n") diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 3e817d665..6a438fd43 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -33,6 +33,7 @@ class ApplicationInstaller(multi.Thread): def run(self): try: + if self.installApp == 'wordpress': self.installWordPress() elif self.installApp == 'joomla': @@ -51,10 +52,55 @@ class ApplicationInstaller(multi.Thread): self.installMagento() elif self.installApp == 'convertDomainToSite': self.convertDomainToSite() + elif self.installApp == 'updatePackage': + self.updatePackage() except BaseException as msg: logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]') + def updatePackage(self): + try: + + package = self.extraArgs['package'] + + from serverStatus.serverStatusUtil import ServerStatusUtil + + f = open(ServerStatusUtil.lswsInstallStatusPath, 'a') + + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: + + if package == 'all': + command = 'DEBIAN_FRONTEND=noninteractive apt-get update -y' + f.write(ProcessUtilities.outputExecutioner(command)) + + f.flush() + + command = 'apt-get upgrade -y' + f.write(ProcessUtilities.outputExecutioner(command)) + else: + command = 'apt-get install --only-upgrade %s -y' % (package) + f.write(ProcessUtilities.outputExecutioner(command)) + + f.close() + elif ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + if package == 'all': + command = 'yum update -y' + f.write(ProcessUtilities.outputExecutioner(command)) + else: + command = 'yum update %s -y' % (package) + f.write(ProcessUtilities.outputExecutioner(command)) + + f.close() + + logging.statusWriter(ServerStatusUtil.lswsInstallStatusPath, + 'Package(s) upgraded successfully. [200]', + 1) + + except BaseException as msg: + from serverStatus.serverStatusUtil import ServerStatusUtil + logging.statusWriter(ServerStatusUtil.lswsInstallStatusPath, 'Failed. Error: %s. [404]' % (str(msg)), 1) + return 0 + def convertDomainToSite(self): try: @@ -123,10 +169,10 @@ class ApplicationInstaller(multi.Thread): command = 'mv %s /home/%s/public_html' % (path, domainName) ProcessUtilities.executioner(command) - website = Websites.objects.get(domain=domainName) + from filemanager.filemanager import FileManager - command = 'chown %s:%s /home/%s/public_html' % (website.externalApp, website.externalApp, domainName) - ProcessUtilities.executioner(command) + fm = FileManager(None, None) + fm.fixPermissions(domainName) statusFile = open(self.tempStatusPath, 'w') statusFile.writelines('Successfully converted. [200]') @@ -166,8 +212,6 @@ class ApplicationInstaller(multi.Thread): command = 'apt -y install git' ProcessUtilities.executioner(command) else: - command = 'yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm' - ProcessUtilities.executioner(command) command = 'yum install git -y' ProcessUtilities.executioner(command) @@ -266,7 +310,7 @@ class ApplicationInstaller(multi.Thread): statusFile.close() dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website.master) - self.permPath = '/home/%s/public_html' % (website.master.domain) + self.permPath = website.path except: website = Websites.objects.get(domain=domainName) @@ -370,7 +414,7 @@ class ApplicationInstaller(multi.Thread): homeDir = "/home/" + domainName + "/public_html" - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -442,7 +486,7 @@ class ApplicationInstaller(multi.Thread): statusFile.close() dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website.master) - self.permPath = '/home/%s/public_html' % (website.master.domain) + self.permPath = website.path except: website = Websites.objects.get(domain=domainName) @@ -546,7 +590,7 @@ class ApplicationInstaller(multi.Thread): homeDir = "/home/" + domainName + "/public_html" - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -706,7 +750,7 @@ class ApplicationInstaller(multi.Thread): shutil.rmtree(finalPath + "installation") - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -732,7 +776,7 @@ class ApplicationInstaller(multi.Thread): homeDir = "/home/" + domainName + "/public_html" - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -804,7 +848,7 @@ class ApplicationInstaller(multi.Thread): statusFile.close() dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website.master) - self.permPath = '/home/%s/public_html' % (website.master.domain) + self.permPath = website.path except: website = Websites.objects.get(domain=domainName) @@ -920,7 +964,7 @@ class ApplicationInstaller(multi.Thread): homeDir = "/home/" + domainName + "/public_html" - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index cfcab181f..d9d800b8e 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -12,7 +12,7 @@ import os import time from plogical.backupUtilities import backupUtilities from re import match,I,M -from websiteFunctions.models import Backups +from websiteFunctions.models import Backups, BackupJob, BackupJobLogs from plogical.processUtilities import ProcessUtilities from random import randint import json, requests @@ -22,14 +22,23 @@ import signal class backupSchedule: now = datetime.now() + LOCAL = 0 + REMOTE = 1 + INFO = 0 + ERROR = 1 + backupLog = '' + runningPath = '/home/cyberpanel/remoteBackupPID' @staticmethod - def remoteBackupLogging(fileName, message): + def remoteBackupLogging(fileName, message, status = 0): try: file = open(fileName,'a') file.writelines("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n") print(("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n")) file.close() + + BackupJobLogs(owner=backupSchedule.backupLog, status=status, message="[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message).save() + except IOError as msg: return "Can not write to error file." @@ -74,11 +83,45 @@ class backupSchedule: except: fileName = "Fetching.." + ifRunning = ProcessUtilities.outputExecutioner('ps aux') + + if (ifRunning.find('startBackup') > -1 or ifRunning.find('BackupRoot') > -1) and ifRunning.find('/%s/' % (backupDomain)): + pass + else: + if os.path.exists(status): + + status = open(status, 'r').read() + time.sleep(2) + + if status.find("Completed") > -1: + + ### Removing Files + + command = 'sudo rm -f ' + status + ProcessUtilities.normalExecutioner(command) + + command = 'sudo rm -f ' + backupFileNamePath + ProcessUtilities.normalExecutioner(command) + + command = 'sudo rm -f ' + pid + ProcessUtilities.normalExecutioner(command) + + backupSchedule.remoteBackupLogging(backupLogPath, "Backup Completed for: " + virtualHost) + try: + os.remove(pathToFile) + except: + pass + return 1, tempStoragePath + else: + return 0, 'Backup process killed without reporting any error.' + else: + + return 0, 'Backup process killed without reporting any error.' + ## file name read ends if os.path.exists(status): status = open(status, 'r').read() - print(status) time.sleep(2) if status.find("Completed") > -1: @@ -120,22 +163,29 @@ class backupSchedule: except: pass - backupSchedule.remoteBackupLogging(backupLogPath, "An error occurred, Error message: " + status) + backupSchedule.remoteBackupLogging(backupLogPath, "Local backup creating failed for %s, Error message: %s" % (virtualHost, status), backupSchedule.ERROR) + try: os.remove(pathToFile) except: pass return 0, tempStoragePath + elif os.path.exists(schedulerPath): + backupSchedule.remoteBackupLogging(backupLogPath, 'Backup process killed without reporting any error.', + backupSchedule.ERROR) os.remove(schedulerPath) return 0, 'Backup process killed without reporting any error.' except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [119:startBackup]") + backupSchedule.remoteBackupLogging(backupLogPath, + "Local backup creating failed for %s, Error message: %s" % ( + virtualHost, str(msg)), backupSchedule.ERROR) return 0, str(msg) @staticmethod - def createBackup(virtualHost, ipAddress, backupLogPath , port): + def createBackup(virtualHost, ipAddress, backupLogPath , port='22', user='root'): try: backupSchedule.remoteBackupLogging(backupLogPath, "Preparing to create backup for: " + virtualHost) @@ -152,7 +202,7 @@ class backupSchedule: backupSchedule.remoteBackupLogging(backupLogPath, "Preparing to send backup for: " + virtualHost +" to " + ipAddress) - backupSchedule.sendBackup(backupPath+".tar.gz", ipAddress, backupLogPath, port) + backupSchedule.sendBackup(backupPath+".tar.gz", ipAddress, backupLogPath, port, user) backupSchedule.remoteBackupLogging(backupLogPath, "Backup for: " + virtualHost + " is sent to " + ipAddress) @@ -166,8 +216,11 @@ class backupSchedule: backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "") + return 1 else: + backupSchedule.remoteBackupLogging(backupLogPath, 'Remote backup creation failed for %s.' % (virtualHost) ) + backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "") @@ -175,12 +228,13 @@ class backupSchedule: backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "") + return 0 except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupSchedule.createBackup]") @staticmethod - def sendBackup(backupPath, IPAddress, backupLogPath , port): + def sendBackup(backupPath, IPAddress, backupLogPath , port='22', user='root'): try: ## IPAddress of local server @@ -193,9 +247,12 @@ class backupSchedule: ## writeToFile = open(backupLogPath, "a") - command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/" + command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " " + user + "@" + IPAddress+":~/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/" subprocess.call(shlex.split(command), stdout=writeToFile) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + ## Remove backups already sent to remote destinations os.remove(backupPath) @@ -206,9 +263,51 @@ class backupSchedule: @staticmethod def prepare(): try: + + if os.path.exists(backupSchedule.runningPath): + pid = open(backupSchedule.runningPath, 'r').read() + + output = ProcessUtilities.outputExecutioner('ps aux') + + if output.find('/usr/local/CyberCP/plogical/backupSchedule.py') > -1 and output.find(pid) > -1: + print( + '\n\nRemote backup is already running with PID: %s. If you want to run again kindly kill the backup process: \n\n kill -9 %s.\n\n' % ( + pid, pid)) + return 0 + else: + os.remove(backupSchedule.runningPath) + + + writeToFile = open(backupSchedule.runningPath, 'w') + writeToFile.write(str(os.getpid())) + writeToFile.close() + + ## IP of Remote server. + + destinations = backupUtilities.destinationsPath + data = json.loads(open(destinations, 'r').read()) + port = data['port'] + + try: + user = data['user'] + except: + user = 'root' + + ipAddress = data['ipAddress'] + + jobSuccessSites = 0 + jobFailedSites = 0 + + backupLogPath = "/usr/local/lscp/logs/backup_log." + time.strftime("%m.%d.%Y_%H-%M-%S") + + backupSchedule.backupLog = BackupJob(logFile=backupLogPath, location=backupSchedule.REMOTE, + jobSuccessSites=jobSuccessSites, jobFailedSites=jobFailedSites, + ipAddress=ipAddress, port=port) + backupSchedule.backupLog.save() + + destinations = backupUtilities.destinationsPath - backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%m.%d.%Y_%H-%M-%S") backupSchedule.remoteBackupLogging(backupLogPath,"#################################################") backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%m.%d.%Y_%H-%M-%S")) @@ -217,12 +316,6 @@ class backupSchedule: backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "") - ## IP of Remote server. - - data = open(destinations,'r').readlines() - ipAddress = data[0].strip("\n") - port = data[1].strip("\n") - ## IPAddress of local server ipFile = "/etc/cyberpanel/machineIP" @@ -241,21 +334,28 @@ class backupSchedule: "Connection to: " + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting.") return 0 else: - ## Create backup dir on remote server + ## Create backup dir on remote server in ~/backup - command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + ipAddress + " mkdir -p /home/backup/" + ipAddressLocal + "/" + time.strftime( + command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel " + user + "@" + ipAddress + " mkdir -p ~/backup/" + ipAddressLocal + "/" + time.strftime( "%a-%b") subprocess.call(shlex.split(command)) pass for virtualHost in os.listdir("/home"): if match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', virtualHost, M | I): - backupSchedule.createBackup(virtualHost, ipAddress, backupLogPath, port) + if backupSchedule.createBackup(virtualHost, ipAddress, backupLogPath, port, user): + jobSuccessSites = jobSuccessSites + 1 + else: + jobFailedSites = jobFailedSites + 1 + backupSchedule.backupLog.jobFailedSites = jobFailedSites + backupSchedule.backupLog.jobSuccessSites = jobSuccessSites + backupSchedule.backupLog.save() backupSchedule.remoteBackupLogging(backupLogPath, "Remote backup job completed.\n") - + if os.path.exists(backupSchedule.runningPath): + os.remove(backupSchedule.runningPath) except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [prepare]") diff --git a/plogical/backupScheduleLocal.py b/plogical/backupScheduleLocal.py index a2c7f5f93..345d7b610 100755 --- a/plogical/backupScheduleLocal.py +++ b/plogical/backupScheduleLocal.py @@ -17,18 +17,40 @@ from plogical.processUtilities import ProcessUtilities from re import match,I,M import signal from datetime import datetime +from websiteFunctions.models import BackupJob, BackupJobLogs class backupScheduleLocal: localBackupPath = '/home/cyberpanel/localBackupPath' + runningPath = '/home/cyberpanel/localBackupPID' now = datetime.now() - @staticmethod def prepare(): try: + + if os.path.exists(backupScheduleLocal.runningPath): + output = ProcessUtilities.outputExecutioner('ps aux') + pid = open(backupScheduleLocal.runningPath, 'r').read() + + if output.find('/usr/local/CyberCP/plogical/backupScheduleLocal.py') > -1 and output.find(pid) > -1: + print('\n\nLocal backup is already running with PID: %s. If you want to run again kindly kill the backup process: \n\n kill -9 %s.\n\n' % (pid, pid)) + return 0 + else: + os.remove(backupScheduleLocal.runningPath) + + writeToFile = open(backupScheduleLocal.runningPath, 'w') + writeToFile.write(str(os.getpid())) + writeToFile.close() + backupRunTime = time.strftime("%m.%d.%Y_%H-%M-%S") backupLogPath = "/usr/local/lscp/logs/local_backup_log." + backupRunTime + jobSuccessSites = 0 + jobFailedSites = 0 + + backupSchedule.backupLog = BackupJob(logFile=backupLogPath, location=backupSchedule.LOCAL, jobSuccessSites=jobSuccessSites, jobFailedSites=jobFailedSites) + backupSchedule.backupLog.save() + writeToFile = open(backupLogPath, "a") backupSchedule.remoteBackupLogging(backupLogPath, "#################################################") @@ -43,6 +65,11 @@ class backupScheduleLocal: try: retValues = backupSchedule.createLocalBackup(virtualHost, backupLogPath) + if retValues[0] == 0: + backupSchedule.remoteBackupLogging(backupLogPath, '[ERROR] Backup failed for %s, error: %s moving on..' % (virtualHost, retValues[1]), backupSchedule.ERROR) + jobFailedSites = jobFailedSites + 1 + continue + if os.path.exists(backupScheduleLocal.localBackupPath): backupPath = retValues[1] + ".tar.gz" localBackupPath = '%s/%s' % (open(backupScheduleLocal.localBackupPath, 'r').read().rstrip('/'), backupRunTime) @@ -52,12 +79,14 @@ class backupScheduleLocal: command = 'mv %s %s' % (backupPath, localBackupPath) ProcessUtilities.normalExecutioner(command) + + jobSuccessSites = jobSuccessSites + 1 except BaseException as msg: + + jobFailedSites = jobFailedSites + 1 + backupSchedule.remoteBackupLogging(backupLogPath, - '[ERROR] Backup failed for %s, error: %s moving on..' % (virtualHost, str(msg))) - - - + '[ERROR] Backup failed for %s, error: %s moving on..' % (virtualHost, str(msg)), backupSchedule.ERROR) backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "") @@ -71,6 +100,14 @@ class backupScheduleLocal: writeToFile.close() + job = BackupJob.objects.get(logFile=backupLogPath) + job.jobFailedSites = jobFailedSites + job.jobSuccessSites = jobSuccessSites + job.save() + + if os.path.exists(backupScheduleLocal.runningPath): + os.remove(backupScheduleLocal.runningPath) + except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [214:startBackup]") diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 08621d459..bf6b11b17 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -1,6 +1,8 @@ -import os,sys +import os, sys + sys.path.append('/usr/local/CyberCP') import django + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") try: django.setup() @@ -10,13 +12,14 @@ import pexpect from plogical import CyberCPLogFileWriter as logging import subprocess import shlex -from shutil import make_archive,rmtree +from shutil import make_archive, rmtree from plogical import mysqlUtilities import tarfile from multiprocessing import Process import signal from plogical.installUtilities import installUtilities import argparse + try: from plogical.virtualHostUtilities import virtualHostUtilities from plogical.sslUtilities import sslUtilities @@ -29,8 +32,10 @@ from xml.etree import ElementTree from xml.dom import minidom import time from shutil import copy +from distutils.dir_util import copy_tree from random import randint from plogical.processUtilities import ProcessUtilities + try: from websiteFunctions.models import Websites, ChildDomains, Backups from databases.models import Databases @@ -41,12 +46,16 @@ try: except: pass +VERSION = '2.0' +BUILD = 1 + + ## I am not the monster that you think I am.. class backupUtilities: Server_root = "/usr/local/lsws" - completeKeyPath = "/home/cyberpanel/.ssh" + completeKeyPath = "/home/cyberpanel/.ssh" destinationsPath = "/home/cyberpanel/destinations" licenseKey = '/usr/local/lsws/conf/license.key' @@ -66,6 +75,12 @@ class backupUtilities: metaFileXML = Element('metaFile') + child = SubElement(metaFileXML, 'VERSION') + child.text = VERSION + + child = SubElement(metaFileXML, 'BUILD') + child.text = str(BUILD) + child = SubElement(metaFileXML, 'masterDomain') child.text = backupDomain @@ -180,11 +195,9 @@ class backupUtilities: except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile( 'While creating backup for %s, we failed to backup database %s. Error message: %s' % ( - backupDomain, items.dbName, str(msg))) + backupDomain, items.dbName, str(msg))) continue - - databaseXML = Element('database') child = SubElement(databaseXML, 'dbName') @@ -266,7 +279,6 @@ class backupUtilities: ## Email meta generated! - def prettify(elem): """Return a pretty-printed XML string for the Element. """ @@ -274,8 +286,6 @@ class backupUtilities: reparsed = minidom.parseString(rough_string) return reparsed.toprettyxml(indent=" ") - - ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath metaPath = '/tmp/%s' % (str(randint(1000, 9999))) @@ -288,22 +298,21 @@ class backupUtilities: ## meta generated - newBackup = Backups(website=website, fileName=backupName, date=time.strftime("%m.%d.%Y_%H-%M-%S"), size=0, status=1) newBackup.save() logging.CyberCPLogFileWriter.statusWriter(status, 'Meta data is ready..') - return 1,'None', metaPath + return 1, 'None', metaPath except BaseException as msg: logging.CyberCPLogFileWriter.statusWriter(status, "%s [207][5009]" % (str(msg))) - return 0,str(msg) + return 0, str(msg) @staticmethod - def startBackup(tempStoragePath, backupName, backupPath, metaPath = None): + def startBackup(tempStoragePath, backupName, backupPath, metaPath=None): try: ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath @@ -317,12 +326,12 @@ class backupUtilities: writeToFile.writelines(str(os.getpid())) writeToFile.close() - backupFileNamePath = os.path.join(backupPath,"backupFileName") + backupFileNamePath = os.path.join(backupPath, "backupFileName") logging.CyberCPLogFileWriter.statusWriter(backupFileNamePath, backupName) ##### - status = os.path.join(backupPath,'status') + status = os.path.join(backupPath, 'status') logging.CyberCPLogFileWriter.statusWriter(status, "Making archive of home directory.\n") @@ -330,7 +339,7 @@ class backupUtilities: ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath - metaPathInBackup = os.path.join(tempStoragePath,'meta.xml') + metaPathInBackup = os.path.join(tempStoragePath, 'meta.xml') if metaPath != None: writeToFile = open(metaPathInBackup, 'w') @@ -339,7 +348,6 @@ class backupUtilities: backupMetaData = ElementTree.parse(metaPathInBackup) - ##### Making archive of home directory domainName = backupMetaData.find('masterDomain').text @@ -354,14 +362,20 @@ class backupUtilities: ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath ## shutil.make_archive - make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) + ## Stop making archive of document_root and copy instead + + copy_tree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) + + # make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) + + ## logging.CyberCPLogFileWriter.statusWriter(status, "Backing up databases..") print('1,None') except BaseException as msg: try: - os.remove(os.path.join(backupPath,backupName+".tar.gz")) + os.remove(os.path.join(backupPath, backupName + ".tar.gz")) except: pass @@ -371,8 +385,8 @@ class backupUtilities: pass status = os.path.join(backupPath, 'status') - logging.CyberCPLogFileWriter.statusWriter(status, "Aborted, "+ str(msg) + ".[365] [5009]") - print(("Aborted, "+ str(msg) + ".[365] [5009]")) + logging.CyberCPLogFileWriter.statusWriter(status, "Aborted, " + str(msg) + ".[365] [5009]") + print(("Aborted, " + str(msg) + ".[365] [5009]")) os.remove(pidFile) @@ -412,6 +426,7 @@ class backupUtilities: for childDomain in childDomains: actualChildDomain = childDomain.find('domain').text + childPath = childDomain.find('path').text if os.path.exists(backupUtilities.licenseKey): completPathToConf = backupUtilities.Server_root + '/conf/vhosts/' + actualChildDomain + '/vhost.conf' @@ -433,6 +448,10 @@ class backupUtilities: sslStoragePath) except: pass + + if childPath.find('/home/%s/public_html' % domainName) == -1: + copy_tree(childPath, '%s/%s-docroot' % (tempStoragePath, actualChildDomain)) + except BaseException as msg: pass @@ -440,7 +459,8 @@ class backupUtilities: domainName = backupMetaData.find('masterDomain').text - if os.path.islink(status) or os.path.islink(tempStoragePath or os.path.islink(backupPath)) or os.path.islink(metaPath): + if os.path.islink(status) or os.path.islink(tempStoragePath or os.path.islink(backupPath)) or os.path.islink( + metaPath): logging.CyberCPLogFileWriter.writeToFile('symlinked.') logging.CyberCPLogFileWriter.statusWriter(status, 'Symlink attack. [365][5009]') return 0 @@ -449,11 +469,10 @@ class backupUtilities: logging.CyberCPLogFileWriter.statusWriter(status, "Backing up email accounts..\n") - try: - make_archive(os.path.join(tempStoragePath, domainName), 'gztar', os.path.join("/home", "vmail", domainName)) - except BaseException as msg: - pass + emailPath = '/home/vmail/%s' % (domainName) + if os.path.exists(emailPath): + copy_tree(emailPath, '%s/vmail' % (tempStoragePath)) ## shutil.make_archive. Creating final package. @@ -461,37 +480,36 @@ class backupUtilities: rmtree(tempStoragePath) ### - backupFileNamePath = os.path.join(backupPath,"backupFileName") - fileName = open(backupFileNamePath, 'r').read() - backupObs = Backups.objects.filter(fileName=fileName) + backupObs = Backups.objects.filter(fileName=backupName) ## adding backup data to database. + + filePath = '%s/%s.tar.gz' % (backupPath, backupName) + totalSize = '%sMB' % (str(int(os.path.getsize(filePath) / 1048576))) + try: for items in backupObs: items.status = 1 - items.size = str(int(float( - os.path.getsize(os.path.join(backupPath,backupName+".tar.gz"))) / ( - 1024.0 * 1024.0))) + "MB" + items.size = totalSize items.save() - except: + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile('%s. [backupRoot:499]' % str(msg)) for items in backupObs: items.status = 1 - items.size = str(int(float( - os.path.getsize(os.path.join(backupPath,backupName+".tar.gz"))) / ( - 1024.0 * 1024.0))) + "MB" + items.size = totalSize items.save() - command = 'chmod 600 %s' % (os.path.join(backupPath,backupName+".tar.gz")) + command = 'chmod 600 %s' % (os.path.join(backupPath, backupName + ".tar.gz")) ProcessUtilities.executioner(command) logging.CyberCPLogFileWriter.statusWriter(status, "Completed\n") os.remove(pidFile) @staticmethod - def initiateBackup(tempStoragePath,backupName,backupPath): + def initiateBackup(tempStoragePath, backupName, backupPath): try: - p = Process(target=backupUtilities.startBackup, args=(tempStoragePath,backupName,backupPath,)) + p = Process(target=backupUtilities.startBackup, args=(tempStoragePath, backupName, backupPath,)) p.start() pid = open(backupPath + 'pid', "w") pid.write(str(p.pid)) @@ -560,14 +578,11 @@ class backupUtilities: if Websites.objects.filter(domain=domain).count() > 0: raise BaseException('This website already exists.') - if ChildDomains.objects.filter(domain=domain).count() > 0: raise BaseException("This website already exists as child domain.") - ####### Pre-creation checks ends - ## Create Configurations result = virtualHostUtilities.createVirtualHost(domain, siteUser.email, phpSelection, externalApp, 0, 1, 0, @@ -602,7 +617,6 @@ class backupUtilities: zone = DNS.getZoneObject(domain) for dnsrecord in dnsrecords: - recordType = dnsrecord.find('type').text value = dnsrecord.find('name').text content = dnsrecord.find('content').text @@ -610,8 +624,7 @@ class backupUtilities: DNS.createDNSRecord(zone, value, recordType, content, prio, 3600) - - return 1,'None' + return 1, 'None' except BaseException as msg: return 0, str(msg) @@ -622,30 +635,28 @@ class backupUtilities: if dir == "CyberPanelRestore": backupFileName = backupName.strip(".tar.gz") - completPath = os.path.join("/home","backup",backupFileName) ## without extension - originalFile = os.path.join("/home","backup",backupName) ## with extension + completPath = os.path.join("/home", "backup", backupFileName) ## without extension + originalFile = os.path.join("/home", "backup", backupName) ## with extension elif dir == 'CLI': completPath = backupName.strip(".tar.gz") ## without extension originalFile = backupName ## with extension else: backupFileName = backupName.strip(".tar.gz") - completPath = "/home/backup/transfer-"+str(dir)+"/"+backupFileName ## without extension - originalFile = "/home/backup/transfer-"+str(dir)+"/"+backupName ## with extension + completPath = "/home/backup/transfer-" + str(dir) + "/" + backupFileName ## without extension + originalFile = "/home/backup/transfer-" + str(dir) + "/" + backupName ## with extension - - - pathToCompressedHome = os.path.join(completPath,"public_html.tar.gz") + pathToCompressedHome = os.path.join(completPath, "public_html.tar.gz") if not os.path.exists(completPath): os.mkdir(completPath) ## Writing pid of restore process - pid = os.path.join(completPath,'pid') + pid = os.path.join(completPath, 'pid') logging.CyberCPLogFileWriter.statusWriter(pid, str(os.getpid())) - status = os.path.join(completPath,'status') + status = os.path.join(completPath, 'status') logging.CyberCPLogFileWriter.statusWriter(status, "Extracting Main Archive!") ## Converting /home/backup/backup-example.com-02.13.2018_10-24-52.tar.gz -> /home/backup/backup-example.com-02.13.2018_10-24-52 @@ -654,7 +665,6 @@ class backupUtilities: tar.extractall(completPath) tar.close() - logging.CyberCPLogFileWriter.statusWriter(status, "Creating Accounts,Databases and DNS records!") ########### Creating website and its dabases @@ -663,6 +673,14 @@ class backupUtilities: backupMetaData = ElementTree.parse(os.path.join(completPath, "meta.xml")) masterDomain = backupMetaData.find('masterDomain').text + twoPointO = 0 + try: + version = backupMetaData.find('VERSION').text + build = backupMetaData.find('BUILD').text + twoPointO = 1 + except: + twoPointO = 0 + result = backupUtilities.createWebsiteFromBackup(backupName, dir) if result[0] == 1: @@ -686,7 +704,8 @@ class backupUtilities: logging.CyberCPLogFileWriter.writeToFile('%s. [555:startRestore]' % (str(msg))) else: - logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + result[1] + ". Not able to create Account, Databases and DNS Records, aborting. [575][5009]") + logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + result[ + 1] + ". Not able to create Account, Databases and DNS Records, aborting. [575][5009]") return 0 ########### Creating child/sub/addon/parked domains @@ -696,7 +715,7 @@ class backupUtilities: ## Reading meta file to create subdomains externalApp = backupMetaData.find('externalApp').text - websiteHome = os.path.join("/home",masterDomain,"public_html") + websiteHome = os.path.join("/home", masterDomain, "public_html") ### Restoring Child Domains if any. @@ -719,7 +738,8 @@ class backupUtilities: phpSelection = childDomain.find('phpSelection').text path = childDomain.find('path').text - retValues = virtualHostUtilities.createDomain(masterDomain, domain, phpSelection, path, 0, 0, 0, 'admin', 0) + retValues = virtualHostUtilities.createDomain(masterDomain, domain, phpSelection, path, 0, 0, 0, + 'admin', 0) if retValues[0] == 1: if os.path.exists(websiteHome): @@ -752,16 +772,22 @@ class backupUtilities: except: pass except: - logging.CyberCPLogFileWriter.writeToFile('While restoring backup we had minor issues for rebuilding vhost conf for: ' + domain + '. However this will be auto healed.') + logging.CyberCPLogFileWriter.writeToFile( + 'While restoring backup we had minor issues for rebuilding vhost conf for: ' + domain + '. However this will be auto healed.') + + if float(version) > 2.0 or float(build) > 0: + if path.find('/home/%s/public_html' % masterDomain) == -1: + copy_tree('%s/%s-docroot' % (completPath, domain), path) continue else: logging.CyberCPLogFileWriter.writeToFile('Error domain %s' % (domain)) - logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + retValues[1] + ". Not able to create child domains, aborting. [635][5009]") + logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + retValues[ + 1] + ". Not able to create child domains, aborting. [635][5009]") return 0 except BaseException as msg: - status = open(os.path.join(completPath,'status'), "w") - status.write("Error Message: " + str(msg) +". Not able to create child domains, aborting. [638][5009]") + status = open(os.path.join(completPath, 'status'), "w") + status.write("Error Message: " + str(msg) + ". Not able to create child domains, aborting. [638][5009]") status.close() logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]") return 0 @@ -791,9 +817,9 @@ class backupUtilities: result = mailUtilities.createEmailAccount(masterDomain, username, password, 'restore') if result[0] == 0: raise BaseException(result[1]) - except BaseException as msg: - logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + str(msg) +". Not able to create email accounts, aborting. [671][5009]") + logging.CyberCPLogFileWriter.statusWriter(status, "Error Message: " + str( + msg) + ". Not able to create email accounts, aborting. [671][5009]") logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]") return 0 @@ -816,30 +842,46 @@ class backupUtilities: logging.CyberCPLogFileWriter.statusWriter(status, "Extracting web home data!") # /home/backup/backup-example.com-02.13.2018_10-24-52/public_html.tar.gz + ## Moving above v2.0.0 extracting webhome data is not required, thus commenting below lines - tar = tarfile.open(pathToCompressedHome) - tar.extractall(websiteHome) - tar.close() + if not twoPointO: + tar = tarfile.open(pathToCompressedHome) + tar.extractall(websiteHome) + tar.close() + else: + if float(version) > 2.0 or float(build) > 0: + copy_tree('%s/public_html' % (completPath), websiteHome) ## extracting email accounts logging.CyberCPLogFileWriter.statusWriter(status, "Extracting email accounts!") - try: - pathToCompressedEmails = os.path.join(completPath, masterDomain + ".tar.gz") - emailHome = os.path.join("/home","vmail",masterDomain) + if not twoPointO: - tar = tarfile.open(pathToCompressedEmails) - tar.extractall(emailHome) - tar.close() + try: + pathToCompressedEmails = os.path.join(completPath, masterDomain + ".tar.gz") + emailHome = os.path.join("/home", "vmail", masterDomain) - ## Change permissions + tar = tarfile.open(pathToCompressedEmails) + tar.extractall(emailHome) + tar.close() - command = "chmod -r vmail:vmail " + emailHome - subprocess.call(shlex.split(command)) + ## Change permissions - except: - pass + command = "chown -R vmail:vmail " + emailHome + subprocess.call(shlex.split(command)) + + except: + pass + else: + + emailsPath = '%s/vmail' % (completPath) + + if os.path.exists(emailsPath): + copy_tree(emailsPath, '/home/vmail/%s' % (masterDomain)) + + command = "chown -R vmail:vmail /home/vmail/%s" % (masterDomain) + ProcessUtilities.executioner(command) ## emails extracted @@ -852,18 +894,12 @@ class backupUtilities: installUtilities.reStartLiteSpeed() - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: - groupName = 'nobody' - else: - groupName = 'nogroup' + ## Fix permissions - command = "chown -R " + externalApp + ":%s " % (groupName) + websiteHome - cmd = shlex.split(command) - subprocess.call(cmd) + from filemanager.filemanager import FileManager - command = 'chmod 750 %s' % (websiteHome) - cmd = shlex.split(command) - subprocess.call(cmd) + fm = FileManager(None, None) + fm.fixPermissions(masterDomain) except BaseException as msg: status = os.path.join(completPath, 'status') @@ -871,7 +907,7 @@ class backupUtilities: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]") @staticmethod - def initiateRestore(backupName,dir): + def initiateRestore(backupName, dir): try: p = Process(target=backupUtilities.startRestore, args=(backupName, dir,)) p.start() @@ -879,7 +915,7 @@ class backupUtilities: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [initiateRestore]") @staticmethod - def sendKey(IPAddress, password,port): + def sendKey(IPAddress, password, port='22', user='root'): try: expectation = [] @@ -888,9 +924,17 @@ class backupUtilities: expectation.append("Permission denied") expectation.append("100%") - command = "scp -o StrictHostKeyChecking=no -P "+ port +" /root/.ssh/cyberpanel.pub root@" + IPAddress + ":/root/.ssh/authorized_keys" + ## Temp changes + + command = 'chmod 600 %s' % ('/root/.ssh/cyberpanel.pub') + ProcessUtilities.executioner(command) + + command = "scp -o StrictHostKeyChecking=no -P " + port + " /root/.ssh/cyberpanel.pub " + user + "@" + IPAddress + ":~/.ssh/authorized_keys" setupKeys = pexpect.spawn(command, timeout=3) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + index = setupKeys.expect(expectation) ## on first login attempt send password @@ -910,20 +954,37 @@ class backupUtilities: else: raise BaseException + ## Temp changes + + command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel.pub') + ProcessUtilities.executioner(command) + return [1, "None"] except pexpect.TIMEOUT as msg: + + command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel.pub') + ProcessUtilities.executioner(command) + logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]") return [0, "TIMEOUT [sendKey]"] except pexpect.EOF as msg: + + command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel.pub') + ProcessUtilities.executioner(command) + logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]") - return [0, "EOF [sendKey]"] + return [0, "EOF [sendKey]"] except BaseException as msg: + + command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel.pub') + ProcessUtilities.executioner(command) + logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]") return [0, str(msg) + " [sendKey]"] @staticmethod - def setupSSHKeys(IPAddress, password,port): + def setupSSHKeys(IPAddress, password, port='22', user='root'): try: ## Checking for host verification @@ -933,7 +994,7 @@ class backupUtilities: pass else: logging.CyberCPLogFileWriter.writeToFile("Host is Down.") - #return [0,"Host is Down."] + # return [0,"Host is Down."] expectation = [] expectation.append("password:") @@ -941,9 +1002,12 @@ class backupUtilities: expectation.append("Permission denied") expectation.append("File exists") - command = "ssh -o StrictHostKeyChecking=no -p "+ port +" root@"+IPAddress+' "mkdir /root/.ssh || rm -f /root/.ssh/temp && rm -f /root/.ssh/authorized_temp && cp /root/.ssh/authorized_keys /root/.ssh/temp"' + command = "ssh -o StrictHostKeyChecking=no -p " + port + ' ' + user + "@" + IPAddress + ' "mkdir ~/.ssh || rm -f ~/.ssh/temp && rm -f ~/.ssh/authorized_temp && cp ~/.ssh/authorized_keys ~/.ssh/temp || chmod 700 ~/.ssh || chmod g-w ~"' setupKeys = pexpect.spawn(command, timeout=3) + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + index = setupKeys.expect(expectation) ## on first login attempt send password @@ -969,18 +1033,18 @@ class backupUtilities: index = setupKeys.expect(expectation) if index == 0: - return [0,"Wrong Password!"] + return [0, "Wrong Password!"] elif index == 1: return [0, "Wrong Password!"] elif index == 2: setupKeys.wait() - sendKey = backupUtilities.sendKey(IPAddress, password, port) + sendKey = backupUtilities.sendKey(IPAddress, password, port, user) if sendKey[0] == 1: return [1, "None"] else: - return [0,sendKey[1]] + return [0, sendKey[1]] except pexpect.TIMEOUT as msg: @@ -999,13 +1063,15 @@ class backupUtilities: logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIfHostIsUp]") @staticmethod - def checkConnection(IPAddress): + def checkConnection(IPAddress, port='22', user='root'): try: try: + import json destinations = backupUtilities.destinationsPath - data = open(destinations, 'r').readlines() - port = data[1].strip("\n") + data = json.loads(open(destinations, 'r').read()) + port = data['port'] + user = data['user'] except: port = "22" @@ -1016,13 +1082,19 @@ class backupUtilities: expectation.append(pexpect.EOF) expectation.append(pexpect.TIMEOUT) - checkConn = pexpect.spawn("sudo ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no -p "+ port+" root@"+IPAddress, timeout=3) + command = "sudo ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no -p " + port + ' ' + user + "@" + IPAddress + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + + checkConn = pexpect.spawn(command,timeout=3) index = checkConn.expect(expectation) if index == 0: subprocess.call(['kill', str(checkConn.pid)]) - logging.CyberCPLogFileWriter.writeToFile("Remote Server is not able to authenticate for transfer to initiate, IP Address:" + IPAddress) - return [0,"Remote Server is not able to authenticate for transfer to initiate."] + logging.CyberCPLogFileWriter.writeToFile( + "Remote Server is not able to authenticate for transfer to initiate, IP Address:" + IPAddress) + return [0, "Remote Server is not able to authenticate for transfer to initiate."] elif index == 1: subprocess.call(['kill', str(checkConn.pid)]) logging.CyberCPLogFileWriter.writeToFile( @@ -1039,28 +1111,28 @@ class backupUtilities: return [1, "None"] except pexpect.TIMEOUT as msg: - logging.CyberCPLogFileWriter.writeToFile("Timeout "+IPAddress+ " [checkConnection]") + logging.CyberCPLogFileWriter.writeToFile("Timeout " + IPAddress + " [checkConnection]") return [0, "371 Timeout while making connection to this server [checkConnection]"] except pexpect.EOF as msg: - logging.CyberCPLogFileWriter.writeToFile("EOF "+IPAddress+ "[checkConnection]") + logging.CyberCPLogFileWriter.writeToFile("EOF " + IPAddress + "[checkConnection]") return [0, "374 Remote Server is not able to authenticate for transfer to initiate. [checkConnection]"] except BaseException as msg: - logging.CyberCPLogFileWriter.writeToFile(str(msg)+" " +IPAddress+ " [checkConnection]") + logging.CyberCPLogFileWriter.writeToFile(str(msg) + " " + IPAddress + " [checkConnection]") return [0, "377 Remote Server is not able to authenticate for transfer to initiate. [checkConnection]"] @staticmethod - def verifyHostKey(IPAddress): + def verifyHostKey(IPAddress, port='22', user='root'): try: backupUtilities.host_key_verification(IPAddress) - password = "hello" ## dumb password, not used anywhere. + password = "hello" ## dumb password, not used anywhere. expectation = [] expectation.append("continue connecting (yes/no)?") expectation.append("password:") - setupSSHKeys = pexpect.spawn("ssh cyberpanel@" + IPAddress, timeout=3) + setupSSHKeys = pexpect.spawn("ssh -p " + port + user + "@" + IPAddress, timeout=3) index = setupSSHKeys.expect(expectation) @@ -1075,7 +1147,6 @@ class backupUtilities: expectation.append("password:") expectation.append(pexpect.EOF) - innerIndex = setupSSHKeys.expect(expectation) if innerIndex == 0: @@ -1107,25 +1178,38 @@ class backupUtilities: except pexpect.TIMEOUT as msg: logging.CyberCPLogFileWriter.writeToFile("Timeout [verifyHostKey]") - return [0,"Timeout [verifyHostKey]"] + return [0, "Timeout [verifyHostKey]"] except pexpect.EOF as msg: logging.CyberCPLogFileWriter.writeToFile("EOF [verifyHostKey]") - return [0,"EOF [verifyHostKey]"] + return [0, "EOF [verifyHostKey]"] except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [verifyHostKey]") - return [0,str(msg)+" [verifyHostKey]"] + return [0, str(msg) + " [verifyHostKey]"] @staticmethod - def createBackupDir(IPAddress,port): + def createBackupDir(IPAddress, port='22', user='root'): try: - command = "sudo ssh -o StrictHostKeyChecking=no -p "+ port +" -i /root/.ssh/cyberpanel root@"+IPAddress+" mkdir /home/backup" + command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel " + user + "@" + IPAddress + " mkdir ~/backup" + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + subprocess.call(shlex.split(command)) - command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + IPAddress + ' "cat /root/.ssh/authorized_keys /root/.ssh/temp > /root/.ssh/authorized_temp"' + command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel " + user + "@" + IPAddress + ' "cat ~/.ssh/authorized_keys ~/.ssh/temp > ~/.ssh/authorized_temp"' + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + subprocess.call(shlex.split(command)) - command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + IPAddress + ' "cat /root/.ssh/authorized_temp > /root/.ssh/authorized_keys"' + + command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel " + user + "@" + IPAddress + ' "cat ~/.ssh/authorized_temp > ~/.ssh/authorized_keys"' + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + subprocess.call(shlex.split(command)) except BaseException as msg: @@ -1230,10 +1314,8 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): writeToFile.close() return 0 - result = backupUtilities.prepareBackupMeta(backupDomain, backupName, tempStoragePath, backupPath) - if result[0] == 0: writeToFile = open(schedulerPath, 'w') writeToFile.writelines('error') @@ -1246,7 +1328,8 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " startBackup --tempStoragePath " + tempStoragePath + " --backupName " \ - + backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % (result[2]) + + backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % ( + result[2]) output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) if output.find('[5009') > -1: @@ -1283,7 +1366,7 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " BackupRoot --tempStoragePath " + tempStoragePath + " --backupName " \ + backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % ( - result[2]) + result[2]) ProcessUtilities.executioner(execPath, 'root') else: @@ -1299,7 +1382,8 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): logging.CyberCPLogFileWriter.writeToFile( str(msg) + " [submitBackupCreation]") -def cancelBackupCreation(backupCancellationDomain,fileName): + +def cancelBackupCreation(backupCancellationDomain, fileName): try: path = "/home/" + backupCancellationDomain + "/backup/pid" @@ -1331,9 +1415,10 @@ def cancelBackupCreation(backupCancellationDomain,fileName): except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile( str(msg) + " [cancelBackupCreation]") - print("0,"+str(msg)) + print("0," + str(msg)) -def submitRestore(backupFile,dir): + +def submitRestore(backupFile, dir): try: p = Process(target=backupUtilities.startRestore, args=(backupFile, dir,)) @@ -1344,13 +1429,14 @@ def submitRestore(backupFile,dir): except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile( str(msg) + " [cancelBackupCreation]") - print("0,"+str(msg)) + print("0," + str(msg)) -def submitDestinationCreation(ipAddress, password, port): - setupKeys = backupUtilities.setupSSHKeys(ipAddress, password, port) + +def submitDestinationCreation(ipAddress, password, port='22', user='root'): + setupKeys = backupUtilities.setupSSHKeys(ipAddress, password, port, user) if setupKeys[0] == 1: - backupUtilities.createBackupDir(ipAddress, port) + backupUtilities.createBackupDir(ipAddress, port, user) print("1,None") else: print(setupKeys[1]) @@ -1368,8 +1454,8 @@ def getConnectionStatus(ipAddress): except BaseException as msg: print(str(msg)) -def main(): +def main(): parser = argparse.ArgumentParser(description='CyberPanel Installer') parser.add_argument('function', help='Specific a function to call!') parser.add_argument('--tempStoragePath', help='') @@ -1383,6 +1469,7 @@ def main(): parser.add_argument('--ipAddress', help='') parser.add_argument('--password', help='') parser.add_argument('--port', help='') + parser.add_argument('--user', help='') ## backup cancellation arguments @@ -1394,19 +1481,16 @@ def main(): parser.add_argument('--backupFile', help='') parser.add_argument('--dir', help='') - - - args = parser.parse_args() if args.function == "submitBackupCreation": - submitBackupCreation(args.tempStoragePath,args.backupName,args.backupPath, args.backupDomain) + submitBackupCreation(args.tempStoragePath, args.backupName, args.backupPath, args.backupDomain) elif args.function == "cancelBackupCreation": - cancelBackupCreation(args.backupCancellationDomain,args.fileName) + cancelBackupCreation(args.backupCancellationDomain, args.fileName) elif args.function == "submitRestore": - submitRestore(args.backupFile,args.dir) + submitRestore(args.backupFile, args.dir) elif args.function == "submitDestinationCreation": - submitDestinationCreation(args.ipAddress, args.password, args.port) + submitDestinationCreation(args.ipAddress, args.password, args.port, args.user) elif args.function == "getConnectionStatus": getConnectionStatus(args.ipAddress) elif args.function == "startBackup": @@ -1414,5 +1498,6 @@ def main(): elif args.function == "BackupRoot": backupUtilities.BackupRoot(args.tempStoragePath, args.backupName, args.backupPath, args.metaPath) + if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index 98f92df18..29971c5ea 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -715,23 +715,9 @@ class cPanelImporter: return 0 def FixPermissions(self): - externalApp = self.externalApp - command = "sudo chown -R " + externalApp + ":" + externalApp + " /home/" + self.mainDomain - ProcessUtilities.normalExecutioner(command) - - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: - groupName = 'nobody' - else: - groupName = 'nogroup' - - command = "sudo chown -R root:%s /home/" % (groupName) + self.mainDomain + "/logs" - ProcessUtilities.normalExecutioner(command) - - command = "sudo find %s -type d -exec chmod 0755 {} \;" % ("/home/" + self.mainDomain + "/public_html") - ProcessUtilities.normalExecutioner(command) - - command = "sudo find %s -type f -exec chmod 0644 {} \;" % ("/home/" + self.mainDomain + "/public_html") - ProcessUtilities.normalExecutioner(command) + from filemanager.filemanager import FileManager + fm = FileManager(None, None) + fm.fixPermissions(self.mainDomain) def MainController(self): diff --git a/plogical/cronUtil.py b/plogical/cronUtil.py index a08803833..25f49e12c 100755 --- a/plogical/cronUtil.py +++ b/plogical/cronUtil.py @@ -9,7 +9,7 @@ class CronUtil: def getWebsiteCron(externalApp): try: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: cronPath = "/var/spool/cron/" + externalApp else: cronPath = "/var/spool/cron/crontabs/" + externalApp @@ -29,7 +29,7 @@ class CronUtil: try: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: cronPath = "/var/spool/cron/" + externalApp else: cronPath = "/var/spool/cron/crontabs/" + externalApp @@ -51,7 +51,7 @@ class CronUtil: try: line -= 1 - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: cronPath = "/var/spool/cron/" + externalApp else: cronPath = "/var/spool/cron/crontabs/" + externalApp @@ -81,7 +81,7 @@ class CronUtil: @staticmethod def addNewCron(externalApp, finalCron): try: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: cronPath = "/var/spool/cron/" + externalApp else: cronPath = "/var/spool/cron/crontabs/" + externalApp @@ -100,7 +100,7 @@ class CronUtil: commandT = 'chmod 755 %s' % (cronParent) ProcessUtilities.executioner(commandT, 'root') - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'chmod 755 /var/spool/cron/crontabs' ProcessUtilities.outputExecutioner(command) @@ -109,7 +109,7 @@ class CronUtil: commandT = 'chmod 700 %s' % (cronParent) ProcessUtilities.executioner(commandT, 'root') - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'chmod 1730 /var/spool/cron/crontabs' ProcessUtilities.outputExecutioner(command) diff --git a/plogical/csf.py b/plogical/csf.py index ef1999224..cb4a1d9f7 100755 --- a/plogical/csf.py +++ b/plogical/csf.py @@ -70,10 +70,10 @@ class CSF(multi.Thread): ProcessUtilities.normalExecutioner(command) # install required packages for CSF perl and /usr/bin/host - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'yum install bind-utils net-tools perl-libwww-perl.noarch perl-LWP-Protocol-https.noarch perl-GDGraph ipset -y' ProcessUtilities.normalExecutioner(command) - elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'apt-get install dnsutils libwww-perl liblwp-protocol-https-perl libgd-graph-perl net-tools ipset -y' ProcessUtilities.normalExecutioner(command) command = 'ln -s /bin/systemctl /usr/bin/systemctl' @@ -309,7 +309,7 @@ class CSF(multi.Thread): ## # Some Ubuntu initial configurations - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: data = open('/etc/csf/csf.conf', 'r').readlines() writeToConf = open('/etc/csf/csf.conf', 'w') diff --git a/plogical/dnsUtilities.py b/plogical/dnsUtilities.py index 51fb3f8b2..0ef13bd13 100755 --- a/plogical/dnsUtilities.py +++ b/plogical/dnsUtilities.py @@ -121,7 +121,6 @@ class DNS: subDomain = extractDomain.subdomain if len(subDomain) == 0: - if Domains.objects.filter(name=topLevelDomain).count() == 0: try: pdns = PDNSStatus.objects.get(pk=1) @@ -440,13 +439,67 @@ class DNS: DNS.createDNSRecord(zone, actualSubDomain, "A", ipAddress, 0, 3600) + ## Mail Record + + DNS.createDNSRecord(zone, 'mail.' + actualSubDomain, "A", ipAddress, 0, 3600) + # CNAME Records. cNameValue = "www." + actualSubDomain DNS.createDNSRecord(zone, cNameValue, "CNAME", actualSubDomain, 0, 3600) - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + ## MX Records + + mxValue = "mail." + actualSubDomain + + record = Records(domainOwner=zone, + domain_id=zone.id, + name=actualSubDomain, + type="MX", + content=mxValue, + ttl=3600, + prio="10", + disabled=0, + auth=1) + record.save() + + ## TXT Records + + record = Records(domainOwner=zone, + domain_id=zone.id, + name=actualSubDomain, + type="TXT", + content="v=spf1 a mx ip4:" + ipAddress + " ~all", + ttl=3600, + prio=0, + disabled=0, + auth=1) + record.save() + + record = Records(domainOwner=zone, + domain_id=zone.id, + name="_dmarc." + actualSubDomain, + type="TXT", + content="v=DMARC1; p=none", + ttl=3600, + prio=0, + disabled=0, + auth=1) + record.save() + + record = Records(domainOwner=zone, + domain_id=zone.id, + name="_domainkey." + actualSubDomain, + type="TXT", + content="t=y; o=~;", + ttl=3600, + prio=0, + disabled=0, + auth=1) + record.save() + + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'sudo systemctl restart pdns' ProcessUtilities.executioner(command) @@ -465,6 +518,7 @@ class DNS: extractDomain = tldextract.extract(domain) topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix + subDomain = extractDomain.subdomain zone = Domains.objects.get(name=topLevelDomain) @@ -474,18 +528,33 @@ class DNS: leftIndex = output.index('(') + 2 rightIndex = output.rindex(')') - 1 - record = Records(domainOwner=zone, - domain_id=zone.id, - name="default._domainkey." + topLevelDomain, - type="TXT", - content=output[leftIndex:rightIndex], - ttl=3600, - prio=0, - disabled=0, - auth=1) - record.save() + if Records.objects.filter(domainOwner=zone, name="default._domainkey." + topLevelDomain).count() == 0: - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + record = Records(domainOwner=zone, + domain_id=zone.id, + name="default._domainkey." + topLevelDomain, + type="TXT", + content=output[leftIndex:rightIndex], + ttl=3600, + prio=0, + disabled=0, + auth=1) + record.save() + + if len(subDomain) > 0: + if Records.objects.filter(domainOwner=zone, name="default._domainkey." + domain).count() == 0: + record = Records(domainOwner=zone, + domain_id=zone.id, + name="default._domainkey." + domain, + type="TXT", + content=output[leftIndex:rightIndex], + ttl=3600, + prio=0, + disabled=0, + auth=1) + record.save() + + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = ' systemctl restart pdns' ProcessUtilities.executioner(command) @@ -566,7 +635,7 @@ class DNS: auth=1) record.save() - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'sudo systemctl restart pdns' ProcessUtilities.executioner(command) @@ -585,7 +654,7 @@ class DNS: auth=1) record.save() - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'sudo systemctl restart pdns' ProcessUtilities.executioner(command) return @@ -602,7 +671,7 @@ class DNS: auth=1) record.save() - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'sudo systemctl restart pdns' ProcessUtilities.executioner(command) return @@ -618,7 +687,7 @@ class DNS: disabled=0, auth=1) record.save() - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'sudo systemctl restart pdns' ProcessUtilities.executioner(command) diff --git a/plogical/filemanager.py b/plogical/filemanager.py deleted file mode 100755 index 93ff1f561..000000000 --- a/plogical/filemanager.py +++ /dev/null @@ -1,40 +0,0 @@ -from plogical import CyberCPLogFileWriter as logging -import argparse -from random import randint - -class filemanager: - - @staticmethod - def createTemporaryFile(domainName): - try: - - path = "/home/" + domainName + "/..filemanagerkey" - - fileKey = str(randint(1000, 9999)) - - filemanager = open(path,'w') - filemanager.write(fileKey) - filemanager.close() - - print(fileKey) - - except BaseException as msg: - logging.CyberCPLogFileWriter.writeToFile( - str(msg) + " [createTemporaryFile]") - print("0," + str(msg)) - - -def main(): - - parser = argparse.ArgumentParser(description='CyberPanel Filemanager') - parser.add_argument('function', help='Specific a function to call!') - parser.add_argument('--domainName', help='Domain name!') - - - args = parser.parse_args() - - if args.function == "createTemporaryFile": - filemanager.createTemporaryFile(args.domainName) - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/plogical/firewallUtilities.py b/plogical/firewallUtilities.py index d3f07fb63..db945d2f6 100755 --- a/plogical/firewallUtilities.py +++ b/plogical/firewallUtilities.py @@ -15,9 +15,9 @@ class FirewallUtilities: @staticmethod def resFailed(res): - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu and res != 0: + if (ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20) and res != 0: return True - elif ProcessUtilities.decideDistro() == ProcessUtilities.centos and res == 1: + elif (ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8) and res == 1: return True return False diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 485206df0..e3789c3d3 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -30,6 +30,7 @@ class mailUtilities: installLogPath = "/home/cyberpanel/openDKIMInstallLog" spamassassinInstallLogPath = "/home/cyberpanel/spamassassinInstallLogPath" cyberPanelHome = "/home/cyberpanel" + mailScannerInstallLogPath = "/home/cyberpanel/mailScannerInstallLogPath" @staticmethod def SendEmail(sender, receivers, message): @@ -214,41 +215,39 @@ class mailUtilities: import tldextract - #extractDomain = tldextract.extract(virtualHostName) - #virtualHostName = extractDomain.domain + '.' + extractDomain.suffix + actualDomain = virtualHostName + extractDomain = tldextract.extract(virtualHostName) + virtualHostName = extractDomain.domain + '.' + extractDomain.suffix - if os.path.exists("/etc/opendkim/keys/" + virtualHostName + "/default.txt"): - return 1, "None" + if not os.path.exists("/etc/opendkim/keys/" + virtualHostName + "/default.txt"): + path = '/etc/opendkim/keys/%s' % (virtualHostName) + command = 'mkdir %s' % (path) + ProcessUtilities.normalExecutioner(command) + ## Generate keys - path = '/etc/opendkim/keys/%s' % (virtualHostName) - command = 'mkdir %s' % (path) - ProcessUtilities.normalExecutioner(command) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + command = "/usr/sbin/opendkim-genkey -D /etc/opendkim/keys/%s -d %s -s default" % (virtualHostName, virtualHostName) + else: + command = "opendkim-genkey -D /etc/opendkim/keys/%s -d %s -s default" % ( + virtualHostName, virtualHostName) + ProcessUtilities.normalExecutioner(command) + ## Fix permissions - ## Generate keys + command = "chown -R root:opendkim /etc/opendkim/keys/" + virtualHostName + ProcessUtilities.normalExecutioner(command) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: - command = "/usr/sbin/opendkim-genkey -D /etc/opendkim/keys/%s -d %s -s default" % (virtualHostName, virtualHostName) - else: - command = "opendkim-genkey -D /etc/opendkim/keys/%s -d %s -s default" % ( - virtualHostName, virtualHostName) - ProcessUtilities.normalExecutioner(command) - ## Fix permissions + command = "chmod 640 /etc/opendkim/keys/" + virtualHostName + "/default.private" + ProcessUtilities.normalExecutioner(command) - command = "chown -R root:opendkim /etc/opendkim/keys/" + virtualHostName - ProcessUtilities.normalExecutioner(command) - - command = "chmod 640 /etc/opendkim/keys/" + virtualHostName + "/default.private" - ProcessUtilities.normalExecutioner(command) - - command = "chmod 644 /etc/opendkim/keys/" + virtualHostName + "/default.txt" - ProcessUtilities.normalExecutioner(command) + command = "chmod 644 /etc/opendkim/keys/" + virtualHostName + "/default.txt" + ProcessUtilities.normalExecutioner(command) ## Edit key file keyTable = "/etc/opendkim/KeyTable" - configToWrite = "default._domainkey." + virtualHostName + " " + virtualHostName + ":default:/etc/opendkim/keys/" + virtualHostName + "/default.private\n" + configToWrite = "default._domainkey." + actualDomain + " " + actualDomain + ":default:/etc/opendkim/keys/" + virtualHostName + "/default.private\n" writeToFile = open(keyTable, 'a') writeToFile.write(configToWrite) @@ -257,7 +256,7 @@ class mailUtilities: ## Edit signing table signingTable = "/etc/opendkim/SigningTable" - configToWrite = "*@" + virtualHostName + " default._domainkey." + virtualHostName + "\n" + configToWrite = "*@" + actualDomain + " default._domainkey." + actualDomain + "\n" writeToFile = open(signingTable, 'a') writeToFile.write(configToWrite) @@ -266,7 +265,7 @@ class mailUtilities: ## Trusted hosts trustedHosts = "/etc/opendkim/TrustedHosts" - configToWrite = virtualHostName + "\n" + configToWrite = actualDomain + "\n" writeToFile = open(trustedHosts, 'a') writeToFile.write(configToWrite) @@ -451,7 +450,10 @@ milter_default_action = accept def installSpamAssassin(install, SpamAssassin): try: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if os.path.exists(mailUtilities.spamassassinInstallLogPath): + os.remove(mailUtilities.spamassassinInstallLogPath) + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo yum install spamassassin -y' else: command = 'sudo apt-get install spamassassin spamc -y' @@ -479,6 +481,51 @@ milter_default_action = accept writeToFile.close() logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installSpamAssassin]") + @staticmethod + def installMailScanner(install, SpamAssassin): + try: + + if os.path.exists(mailUtilities.mailScannerInstallLogPath): + os.remove(mailUtilities.mailScannerInstallLogPath) + + if mailUtilities.checkIfSpamAssassinInstalled(): + + command = 'chmod +x /usr/local/CyberCP/CPScripts/mailscannerinstaller.sh' + ProcessUtilities.executioner(command) + + + command = '/usr/local/CyberCP/CPScripts/mailscannerinstaller.sh' + + cmd = shlex.split(command) + + with open(mailUtilities.mailScannerInstallLogPath, 'w') as f: + res = subprocess.call(cmd, stdout=f, shell=True) + + if res == 1: + writeToFile = open(mailUtilities.mailScannerInstallLogPath, 'a') + writeToFile.writelines("Can not be installed.[404]\n") + writeToFile.close() + logging.CyberCPLogFileWriter.writeToFile("[Could not Install MailScanner.]") + return 0 + else: + writeToFile = open(mailUtilities.mailScannerInstallLogPath, 'a') + writeToFile.writelines("MailScanner Installed.[200]\n") + writeToFile.close() + + return 1 + else: + writeToFile = open(mailUtilities.mailScannerInstallLogPath, 'a') + writeToFile.writelines("Please install SpamAssassin from CyberPanel before installing MailScanner.[404]\n") + writeToFile.close() + + + + except BaseException as msg: + writeToFile = open(mailUtilities.mailScannerInstallLogPath, 'a') + writeToFile.writelines("Can not be installed.[404]\n") + writeToFile.close() + logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installSpamAssassin]") + @staticmethod def checkIfSpamAssassinInstalled(): try: @@ -502,7 +549,7 @@ milter_default_action = accept def configureSpamAssassin(): try: - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: confFile = "/etc/mail/spamassassin/local.cf" confData = open(confFile).readlines() @@ -668,6 +715,22 @@ milter_default_action = accept str(msg) + " [savePolicyServerStatus]") print("0," + str(msg)) + @staticmethod + def checkIfMailScannerInstalled(): + try: + + path = "/usr/local/CyberCP/public/mailwatch" + + if os .path.exists(path): + return 1 + else: + return 0 + + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile( + str(msg) + " [checkIfMailScannerInstalled]") + return 0 + def main(): @@ -697,6 +760,8 @@ def main(): mailUtilities.savePolicyServerStatus(args.install) elif args.function == 'installSpamAssassin': mailUtilities.installSpamAssassin("install", "SpamAssassin") + elif args.function == 'installMailScanner': + mailUtilities.installMailScanner("install", "installMailScanner") elif args.function == 'AfterEffects': mailUtilities.AfterEffects(args.domain) diff --git a/plogical/modSec.py b/plogical/modSec.py index 6c4e86c6f..e242d4035 100755 --- a/plogical/modSec.py +++ b/plogical/modSec.py @@ -24,7 +24,7 @@ class modSec: mailUtilities.checkHome() - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo yum install ols-modsecurity -y' else: command = 'sudo DEBIAN_FRONTEND=noninteractive apt-get install ols-modsecurity -y' diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index fa06f8fac..bb17f36e7 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -413,7 +413,7 @@ password=%s def applyMySQLChanges(data): try: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo mv /etc/my.cnf /etc/my.cnf.bak' else: command = 'sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak' @@ -430,7 +430,7 @@ password=%s writeToFile.close() ## - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo mv ' + tempPath + ' /etc/my.cnf' else: command = 'sudo mv ' + tempPath + ' /etc/mysql/my.cnf' @@ -440,7 +440,7 @@ password=%s return 1, None except BaseException as msg: - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo mv /etc/my.cnf.bak /etc/my.cnf' else: command = 'sudo mv /etc/mysql/my.cnf.bak /etc/mysql//my.cnf' diff --git a/plogical/phpUtilities.py b/plogical/phpUtilities.py index e1518a7d9..8e69569ef 100755 --- a/plogical/phpUtilities.py +++ b/plogical/phpUtilities.py @@ -20,7 +20,7 @@ class phpUtilities: mailUtilities.checkHome() - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo yum install ' + extension + ' -y' else: command = 'sudo apt-get install ' + extension + ' -y' @@ -54,7 +54,7 @@ class phpUtilities: mailUtilities.checkHome() - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'sudo rpm --nodeps -e ' + extension + ' -v' else: command = 'sudo apt-get remove -y ' + extension @@ -103,7 +103,7 @@ class phpUtilities: command = 'touch %s' % (serverLevelPHPRestart) ProcessUtilities.executioner(command) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: path = "/usr/local/lsws/ls" + phpVers + "/etc/php.ini" else: initial = phpVers[3] diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 9ff4437e4..fdd5e6990 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -16,6 +16,7 @@ class ProcessUtilities(multi.Thread): centos = 1 cent8 = 2 ubuntu = 0 + ubuntu20 = 3 server_address = '/usr/local/lscpd/admin/comm.sock' token = "unset" @@ -139,6 +140,8 @@ class ProcessUtilities(multi.Thread): distroPath = '/etc/lsb-release' if os.path.exists(distroPath): + if open(distroPath, 'r').read().find('20.04') > -1: + return ProcessUtilities.ubuntu20 return ProcessUtilities.ubuntu else: if open('/etc/redhat-release', 'r').read().find('CentOS Linux release 8') > -1: @@ -190,7 +193,6 @@ class ProcessUtilities(multi.Thread): sock = ret[0] if user == None: - if command.find('export') > -1: pass elif command.find('sudo') == -1: @@ -268,12 +270,17 @@ class ProcessUtilities(multi.Thread): def customPoen(self): try: + + if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == bytes: command = self.extraArgs['command'] else: command = " ".join(self.extraArgs['command']) - ProcessUtilities.sendCommand(command, self.extraArgs['user']) + if getpass.getuser() == 'root': + subprocess.call(command, shell=True) + else: + ProcessUtilities.sendCommand(command, self.extraArgs['user']) return 1 except BaseException as msg: diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 71c0326c1..9434f3303 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -14,11 +14,13 @@ import random import string VERSION = '2.0' -BUILD = 0 +BUILD = 1 class Upgrade: logPath = "/usr/local/lscp/logs/upgradeLog" cdn = 'cdn.cyberpanel.sh' + installedOutput = '' + CentOSPath = '/etc/redhat-release' @staticmethod def stdOut(message, do_exit=0): @@ -123,7 +125,6 @@ class Upgrade: except BaseException as msg: Upgrade.stdOut(str(msg) + " [mountTemp]", 0) - @staticmethod def dockerUsers(): ### Docker User/group @@ -408,25 +409,6 @@ class Upgrade: Upgrade.stdOut(str(msg) + ' [downloadLink]') os._exit(0) - @staticmethod - def fileManager(): - ## Copy File manager files - - command = "rm -rf /usr/local/lsws/Example/html/FileManager" - Upgrade.executioner(command, 'Remove old Filemanager', 0) - - if os.path.exists('/usr/local/lsws/bin/openlitespeed'): - command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws/Example/html" - Upgrade.executioner(command, 'Setup new Filemanager', 0) - else: - command = "mv /usr/local/CyberCP/install/FileManager /usr/local/lsws" - Upgrade.executioner(command, 'Setup new Filemanager', 0) - - ## - - command = "chmod -R 777 /usr/local/lsws/Example/html/FileManager" - Upgrade.executioner(command, 'Filemanager permissions change', 0) - @staticmethod def setupCLI(): try: @@ -597,6 +579,11 @@ class Upgrade: except: pass + try: + cursor.execute("ALTER TABLE websiteFunctions_backups MODIFY fileName varchar(200)") + except: + pass + try: cursor.execute("ALTER TABLE loginSystem_acl ADD COLUMN listUsers INT DEFAULT 0;") @@ -1246,6 +1233,37 @@ class Upgrade: CONSTRAINT `websiteFunctions_git_owner_id_ce74c7de_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_websites` (`id`) )""" + try: + cursor.execute(query) + except: + pass + + query = """CREATE TABLE `websiteFunctions_backupjob` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `logFile` varchar(1000) NOT NULL, + `ipAddress` varchar(50) NOT NULL, + `port` varchar(15) NOT NULL, + `jobFailedSites` int(11) NOT NULL, + `jobSuccessSites` int(11) NOT NULL, + `location` int(11) NOT NULL, + PRIMARY KEY (`id`) +)""" + try: + cursor.execute(query) + except: + pass + + + query = """CREATE TABLE `websiteFunctions_backupjoblogs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `message` longtext NOT NULL, + `owner_id` int(11) NOT NULL, + `status` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `websiteFunctions_bac_owner_id_af3d15f9_fk_websiteFu` (`owner_id`), + CONSTRAINT `websiteFunctions_bac_owner_id_af3d15f9_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_backupjob` (`id`) +)""" + try: cursor.execute(query) except: @@ -1275,232 +1293,122 @@ class Upgrade: except: pass - @staticmethod - def installGit(): - try: - if os.path.exists("/etc/lsb-release"): - command = 'apt -y install git' - Upgrade.executioner(command, 'installGit', 0) - else: - command = 'sudo yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm' - Upgrade.executioner(command, 'installGit', 0) - - command = 'sudo yum install git -y' - Upgrade.executioner(command, 'installGit', 0) - - except BaseException as msg: - pass - @staticmethod def downloadAndUpgrade(versionNumbring, branch): try: ## Download latest version. - Upgrade.installGit() - ## Backup settings file. Upgrade.stdOut("Backing up settings file.") - shutil.copy("/usr/local/CyberCP/CyberCP/settings.py", "/usr/local/settings.py") + ## CyberPanel DB Creds + dbName = settings.DATABASES['default']['NAME'] + dbUser = settings.DATABASES['default']['USER'] + password = settings.DATABASES['default']['PASSWORD'] + + ## Root DB Creds + + rootdbName = settings.DATABASES['rootdb']['NAME'] + rootdbdbUser = settings.DATABASES['rootdb']['USER'] + rootdbpassword = settings.DATABASES['rootdb']['PASSWORD'] + + ## Complete db string + + completDBString = """\nDATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': '%s', + 'USER': '%s', + 'PASSWORD': '%s', + 'HOST': 'localhost', + 'PORT':'' + }, + 'rootdb': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': '%s', + 'USER': '%s', + 'PASSWORD': '%s', + 'HOST': 'localhost', + 'PORT': '', + }, +}\n""" % (dbName, dbUser, password, rootdbName, rootdbdbUser, rootdbpassword) + + settingsFile = '/usr/local/CyberCP/CyberCP/settings.py' Upgrade.stdOut("Settings file backed up.") - ## Extract Latest files + ## Check git branch status - os.chdir('/usr/local') + os.chdir('/usr/local/CyberCP') - if os.path.exists('cyberpanel'): - shutil.rmtree('cyberpanel') + command = 'git config --global user.email "support@cyberpanel.met"' + Upgrade.executioner(command, command, 1) - ### check if imunify exists + command = 'git config --global user.name "CyberPanel"' + Upgrade.executioner(command, command, 1) - imunifyPublic = '/usr/local/CyberCP/public/imunify' - imunifyPublicBackup = '/usr/local' + command = 'git status' + currentBranch = subprocess.check_output(shlex.split(command)).decode() - try: + if currentBranch.find('On branch %s' % (branch)) > -1: - if os.path.exists(imunifyPublic): - shutil.move(imunifyPublic, imunifyPublicBackup) + command = 'git stash' + Upgrade.executioner(command, command, 1) - except: - pass + command = 'git pull' + Upgrade.executioner(command, command, 1) - if os.path.exists('CyberCP'): - shutil.rmtree('CyberCP') + elif currentBranch.find('not a git repository') > -1: - command = 'git clone https://github.com/usmannasir/cyberpanel' - Upgrade.executioner(command, 'Download CyberPanel', 1) + os.chdir('/usr/local') - shutil.move('cyberpanel', 'CyberCP') + command = 'git clone https://github.com/usmannasir/cyberpanel' + Upgrade.executioner(command, 'Download CyberPanel', 1) + + if os.path.exists('CyberCP'): + shutil.rmtree('CyberCP') + + shutil.move('cyberpanel', 'CyberCP') + + else: + + command = 'git fetch' + Upgrade.executioner(command, command, 1) + + command = 'git stash' + Upgrade.executioner(command, command, 1) - if branch != 'stable': - os.chdir('CyberCP') command = 'git checkout %s' % (branch) Upgrade.executioner(command, command, 1) - os.chdir('/usr/local') + + command = 'git pull' + Upgrade.executioner(command, command, 1) + ## Copy settings file - data = open("/usr/local/settings.py", 'r').readlines() + settingsData = open(settingsFile, 'r').readlines() - csrfCheck = 1 - for items in data: - if items.find('CsrfViewMiddleware') > -1: - csrfCheck = 0 + DATABASESCHECK = 0 + writeToFile = open(settingsFile, 'w') - pluginCheck = 1 - for items in data: - if items.find('pluginHolder') > -1: - pluginCheck = 0 + for items in settingsData: + if items.find('DATABASES = {') > -1: + DATABASESCHECK = 1 - emailMarketing = 1 - for items in data: - if items.find('emailMarketing') > -1: - emailMarketing = 0 + if DATABASESCHECK == 0: + writeToFile.write(items) - emailPremium = 1 - for items in data: - if items.find('emailPremium') > -1: - emailPremium = 0 - - s3Backups = 1 - for items in data: - if items.find('s3Backups') > -1: - s3Backups = 0 - - dockerManager = 1 - for items in data: - if items.find('dockerManager') > -1: - dockerManager = 0 - - containerization = 1 - for items in data: - if items.find('containerization') > -1: - containerization = 0 - - manageServices = 1 - for items in data: - if items.find('manageServices') > -1: - manageServices = 0 - - CLManager = 1 - for items in data: - if items.find('CLManager') > -1: - CLManager = 0 - - IncBackups = 1 - for items in data: - if items.find('IncBackups') > -1: - IncBackups = 0 - - WebTerminal = 1 - for items in data: - if items.find('WebTerminal') > -1: - WebTerminal = 0 - - SESSION_COOKIE_SECURE = 0 - - for items in data: - if items.find('SESSION_COOKIE_SECURE') > -1: - SESSION_COOKIE_SECURE = 0 - - DATABASE_ROUTERS = 1 - - for items in data: - if items.find('DATABASE_ROUTERS') > -1: - DATABASE_ROUTERS = 0 - - Upgrade.stdOut('Restoring settings file!') - - writeToFile = open("/usr/local/CyberCP/CyberCP/settings.py", 'w') - - for items in data: - if items.find('csf') > -1 or items.find('SESSION_COOKIE_SECURE') > -1 or items.find('CSRF_COOKIE_SECURE') > -1: - continue - if items.find("CommonMiddleware") > -1: - if csrfCheck == 1: - writeToFile.writelines(" 'django.middleware.csrf.CsrfViewMiddleware',\n") - - if items.find('DATABASE_ROUTERS') > -1: - writeToFile.writelines(items) - if SESSION_COOKIE_SECURE == 1: - con = """SESSION_COOKIE_SECURE = True -CSRF_COOKIE_SECURE = True -""" - writeToFile.writelines(con) - - elif items.find("'filemanager',") > -1: - writeToFile.writelines(items) - if pluginCheck == 1: - writeToFile.writelines(" 'pluginHolder',\n") - if emailMarketing == 1: - writeToFile.writelines(" 'emailMarketing',\n") - if emailPremium == 1: - writeToFile.writelines(" 'emailPremium',\n") - if s3Backups == 1: - writeToFile.writelines(" 's3Backups',\n") - if dockerManager == 1: - writeToFile.writelines(" 'dockerManager',\n") - - if containerization == 1: - writeToFile.writelines(" 'containerization',\n") - - if manageServices == 1: - writeToFile.writelines(" 'manageServices',\n") - - - if CLManager == 1: - writeToFile.writelines(" 'CLManager',\n") - - if IncBackups == 1: - writeToFile.writelines(" 'IncBackups',\n") - - if WebTerminal == 1: - writeToFile.writelines(" 'WebTerminal',\n") - - else: - writeToFile.writelines(items) - - ## - - DATA_UPLOAD_MAX_MEMORY_SIZE = 1 - for items in data: - if items.find('DATA_UPLOAD_MAX_MEMORY_SIZE') > -1: - DATA_UPLOAD_MAX_MEMORY_SIZE = 0 - writeToFile.writelines("\nDATA_UPLOAD_MAX_MEMORY_SIZE = 52428800\n") - - if DATA_UPLOAD_MAX_MEMORY_SIZE == 1: - writeToFile.writelines("\nDATA_UPLOAD_MAX_MEMORY_SIZE = 52428800\n") - - ## - - MEDIA_URL = 1 - for items in data: - if items.find('MEDIA_URL') > -1: - MEDIA_URL = 0 - - if MEDIA_URL == 1: - writeToFile.writelines("MEDIA_URL = '/home/cyberpanel/media/'\n") - writeToFile.writelines('MEDIA_ROOT = MEDIA_URL\n') - - - if items.find('MEDIA_ROOT = MEDIA_URLDATA_UPLOAD_MAX_MEMORY_SIZE') > -1: - writeToFile.writelines('MEDIA_ROOT = MEDIA_URL\n') - - - - ## - - if DATABASE_ROUTERS == 1: - writeToFile.writelines("\nDATABASE_ROUTERS = ['backup.backupRouter.backupRouter']\n") + if items.find('DATABASE_ROUTERS = [') > -1: + DATABASESCHECK = 0 + writeToFile.write(completDBString) + writeToFile.write(items) writeToFile.close() Upgrade.stdOut('Settings file restored!') - ## Move static files - Upgrade.staticContent() except: @@ -1526,13 +1434,13 @@ CSRF_COOKIE_SECURE = True if os.path.exists(lscpdPath): os.remove(lscpdPath) - command = 'cp -f /usr/local/CyberCP/lscpd-0.2.4 /usr/local/lscp/bin/lscpd-0.2.4' + command = 'cp -f /usr/local/CyberCP/lscpd-0.2.5 /usr/local/lscp/bin/lscpd-0.2.5' Upgrade.executioner(command, command, 0) command = 'rm -f /usr/local/lscp/bin/lscpd' Upgrade.executioner(command, command, 0) - command = 'mv /usr/local/lscp/bin/lscpd-0.2.4 /usr/local/lscp/bin/lscpd' + command = 'mv /usr/local/lscp/bin/lscpd-0.2.5 /usr/local/lscp/bin/lscpd' Upgrade.executioner(command, command, 0) command = 'chmod 755 %s' % (lscpdPath) @@ -1724,18 +1632,22 @@ CSRF_COOKIE_SECURE = True @staticmethod def installPHP73(): try: - command = 'yum install -y lsphp73 lsphp73-json lsphp73-xmlrpc lsphp73-xml lsphp73-tidy lsphp73-soap lsphp73-snmp ' \ - 'lsphp73-recode lsphp73-pspell lsphp73-process lsphp73-pgsql lsphp73-pear lsphp73-pdo lsphp73-opcache ' \ - 'lsphp73-odbc lsphp73-mysqlnd lsphp73-mcrypt lsphp73-mbstring lsphp73-ldap lsphp73-intl lsphp73-imap ' \ - 'lsphp73-gmp lsphp73-gd lsphp73-enchant lsphp73-dba lsphp73-common lsphp73-bcmath' - Upgrade.executioner(command, 'Install PHP 73, 0') - command = 'yum install -y lsphp74 lsphp74-json lsphp74-xmlrpc lsphp74-xml lsphp74-tidy lsphp74-soap lsphp74-snmp ' \ - 'lsphp74-recode lsphp74-pspell lsphp74-process lsphp74-pgsql lsphp74-pear lsphp74-pdo lsphp74-opcache ' \ - 'lsphp74-odbc lsphp74-mysqlnd lsphp74-mcrypt lsphp74-mbstring lsphp74-ldap lsphp74-intl lsphp74-imap ' \ - 'lsphp74-gmp lsphp74-gd lsphp74-enchant lsphp74-dba lsphp74-common lsphp74-bcmath' + if Upgrade.installedOutput.find('lsphp73') == -1: + command = 'yum install -y lsphp73 lsphp73-json lsphp73-xmlrpc lsphp73-xml lsphp73-tidy lsphp73-soap lsphp73-snmp ' \ + 'lsphp73-recode lsphp73-pspell lsphp73-process lsphp73-pgsql lsphp73-pear lsphp73-pdo lsphp73-opcache ' \ + 'lsphp73-odbc lsphp73-mysqlnd lsphp73-mcrypt lsphp73-mbstring lsphp73-ldap lsphp73-intl lsphp73-imap ' \ + 'lsphp73-gmp lsphp73-gd lsphp73-enchant lsphp73-dba lsphp73-common lsphp73-bcmath' + Upgrade.executioner(command, 'Install PHP 73, 0') + + if Upgrade.installedOutput.find('lsphp74') == -1: + command = 'yum install -y lsphp74 lsphp74-json lsphp74-xmlrpc lsphp74-xml lsphp74-tidy lsphp74-soap lsphp74-snmp ' \ + 'lsphp74-recode lsphp74-pspell lsphp74-process lsphp74-pgsql lsphp74-pear lsphp74-pdo lsphp74-opcache ' \ + 'lsphp74-odbc lsphp74-mysqlnd lsphp74-mcrypt lsphp74-mbstring lsphp74-ldap lsphp74-intl lsphp74-imap ' \ + 'lsphp74-gmp lsphp74-gd lsphp74-enchant lsphp74-dba lsphp74-common lsphp74-bcmath' + + Upgrade.executioner(command, 'Install PHP 74, 0') - Upgrade.executioner(command, 'Install PHP 74, 0') except: command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \ 'lsphp7? lsphp7?-common lsphp7?-curl lsphp7?-dev lsphp7?-imap lsphp7?-intl lsphp7?-json ' \ @@ -1757,11 +1669,6 @@ CSRF_COOKIE_SECURE = True command = "mkdir -p /usr/local/lscp/cyberpanel/logs" Upgrade.executioner(command, 0) - @staticmethod - def upgradePDNS(): - command = "yum install epel-release && curl -o /etc/yum.repos.d/powerdns-auth-42.repo https://repo.powerdns.com/repo-files/centos-auth-42.repo && yum --enablerepo=epel install pdns" - subprocess.call(command, shell=True) - @staticmethod def upgradeDovecot(): try: @@ -1769,40 +1676,28 @@ CSRF_COOKIE_SECURE = True CentOSPath = '/etc/redhat-release' if os.path.exists(CentOSPath): - path = '/etc/yum.repos.d/dovecot.repo' - content = """[dovecot-2.3-latest] -name=Dovecot 2.3 CentOS $releasever - $basearch -baseurl=http://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch -gpgkey=https://repo.dovecot.org/DOVECOT-REPO-GPG -gpgcheck=1 -enabled=1""" - writeToFile = open(path, 'w') - writeToFile.write(content) - writeToFile.close() - command = "yum makecache -y" - Upgrade.executioner(command, 0) + if Upgrade.installedOutput.find('2:2.3.10-2') == -1: + command = "yum makecache -y" + Upgrade.executioner(command, 0) - command = "yum update -y" - Upgrade.executioner(command, 0) + command = "yum update -y" + Upgrade.executioner(command, 0) - ## Remove Default Password Scheme + ## Remove Default Password Scheme - path = '/etc/dovecot/dovecot-sql.conf.ext' + path = '/etc/dovecot/dovecot-sql.conf.ext' - data = open(path, 'r').readlines() + data = open(path, 'r').readlines() - updatePasswords = 1 + writeToFile = open(path, 'w') + for items in data: + if items.find('default_pass_scheme') > -1: + continue + else: + writeToFile.writelines(items) - writeToFile = open(path, 'w') - for items in data: - if items.find('default_pass_scheme') > -1: - updatePasswords = 0 - continue - else: - writeToFile.writelines(items) - - writeToFile.close() + writeToFile.close() import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") @@ -1821,101 +1716,80 @@ enabled=1""" Upgrade.executioner(command, 0) - ### Postfix Upgrade - try: - shutil.copy('/etc/postfix/master.cf', '/etc/master.cf') - except: - pass + if Upgrade.installedOutput.find('2:3.4.7-1.gf.el7') == -1: + try: + shutil.copy('/etc/postfix/master.cf', '/etc/master.cf') + except: + pass - try: - shutil.copy('/etc/postfix/main.cf', '/etc/main.cf') - except: - pass + try: + shutil.copy('/etc/postfix/main.cf', '/etc/main.cf') + except: + pass - gf = '/etc/yum.repos.d/gf.repo' - gfContent = """[gf] -name=Ghettoforge packages that won't overwrite core distro packages. -mirrorlist=http://mirrorlist.ghettoforge.org/el/7/gf/$basearch/mirrorlist -enabled=1 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 -failovermethod=priority -[gf-plus] -name=Ghettoforge packages that will overwrite core distro packages. -mirrorlist=http://mirrorlist.ghettoforge.org/el/7/plus/$basearch/mirrorlist -# Please read http://ghettoforge.org/index.php/Usage *before* enabling this repository! -enabled=1 -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 -failovermethod=priority -""" - writeToFile = open(gf, 'w') - writeToFile.write(gfContent) - writeToFile.close() + command = 'yum remove postfix -y' + Upgrade.executioner(command, 0) - command = 'yum remove postfix -y' - Upgrade.executioner(command, 0) + command = 'yum clean all' + Upgrade.executioner(command, 0) - command = 'rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm' - Upgrade.executioner(command, 0) + command = 'yum makecache fast' + Upgrade.executioner(command, 0) - command = 'yum clean all' - Upgrade.executioner(command, 0) + command = 'yum install --enablerepo=CyberPanel -y postfix3 postfix3-mysql' + Upgrade.executioner(command, 0) - command = 'yum makecache fast' - Upgrade.executioner(command, 0) + try: + shutil.move('/etc/master.cf', '/etc/postfix/master.cf') + except: + pass + try: + shutil.move('/etc/main.cf', '/etc/postfix/main.cf') + except: + pass - command = 'yum install -y postfix3 postfix3-mysql' - Upgrade.executioner(command, 0) - - try: - shutil.move('/etc/master.cf', '/etc/postfix/master.cf') - except: - pass - try: - shutil.move('/etc/main.cf', '/etc/postfix/main.cf') - except: - pass - - command = 'systemctl restart postfix' - Upgrade.executioner(command, 0) + command = 'systemctl restart postfix' + Upgrade.executioner(command, 0) else: - command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import' - subprocess.call(command, shell=True) - command = 'gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg' - subprocess.call(command, shell=True) + if Upgrade.installedOutput.find('dovecot-mysql/bionic,now 2:2.3.10-2') == -1: - debPath = '/etc/apt/sources.list.d/dovecot.list' - writeToFile = open(debPath, 'w') - writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/bionic bionic main\n') - writeToFile.close() - - try: - command = 'apt update -y' - Upgrade.executioner(command, 0) - except: - pass - - try: - command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y' + command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import' subprocess.call(command, shell=True) - command = 'dpkg --configure -a' - Upgrade.executioner(command, 0) - - command = 'apt --fix-broken install -y' - Upgrade.executioner(command, 0) - - command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y' + command = 'gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg' subprocess.call(command, shell=True) - except: - pass + + debPath = '/etc/apt/sources.list.d/dovecot.list' + writeToFile = open(debPath, 'w') + writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/bionic bionic main\n') + writeToFile.close() + + try: + command = 'apt update -y' + Upgrade.executioner(command, 0) + except: + pass + + try: + command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y' + subprocess.call(command, shell=True) + + command = 'dpkg --configure -a' + Upgrade.executioner(command, 0) + + command = 'apt --fix-broken install -y' + Upgrade.executioner(command, 0) + + command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y' + subprocess.call(command, shell=True) + except: + pass ## Remove Default Password Scheme @@ -1989,18 +1863,17 @@ failovermethod=priority CentOSPath = '/etc/redhat-release' if os.path.exists(CentOSPath): - command = 'yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo' - Upgrade.executioner(command, 'Add restic repo.') - - command = 'yum install restic -y' - Upgrade.executioner(command, 'Install Restic') + if Upgrade.installedOutput.find('restic') == -1: + command = 'yum install restic -y' + Upgrade.executioner(command, 'Install Restic') else: - command = 'apt-get update -y' - Upgrade.executioner(command, 'Install Restic') - command = 'apt-get install restic -y' - Upgrade.executioner(command, 'Install Restic') + if Upgrade.installedOutput.find('restic/bionic,now 0.8') == -1: + command = 'apt-get update -y' + Upgrade.executioner(command, 'Install Restic') + command = 'apt-get install restic -y' + Upgrade.executioner(command, 'Install Restic') @staticmethod def UpdateMaxSSLCons(): @@ -2138,6 +2011,14 @@ vmail # Upgrade.stdOut("Upgrades are currently disabled") # return 0 + if os.path.exists(Upgrade.CentOSPath): + command = 'yum list installed' + Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() + else: + command = 'apt list' + Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() + + command = 'systemctl stop cpssh' Upgrade.executioner(command, 'fix csf if there', 0) @@ -2145,6 +2026,10 @@ vmail ## Add LSPHP7.4 TO LSWS Ent configs if not os.path.exists('/usr/local/lsws/bin/openlitespeed'): + + if os.path.exists('httpd_config.xml'): + os.remove('httpd_config.xml') + command = 'wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/install/litespeed/httpd_config.xml' Upgrade.executioner(command, command, 0) #os.remove('/usr/local/lsws/conf/httpd_config.xml') @@ -2220,18 +2105,9 @@ vmail time.sleep(3) ## Upgrade version + Upgrade.fixPermissions() - ### get back imunify - - imunifyPublicBackup = '/usr/local' - imunifyPublicBackup = '%s/imunify' % (imunifyPublicBackup) - - try: - shutil.move(imunifyPublicBackup, '/usr/local/CyberCP/public') - except: - pass - ## Upgrade.upgradeVersion() @@ -2265,6 +2141,14 @@ vmail Upgrade.installCLScripts() Upgrade.runSomeImportantBash() + ## Move static files + + imunifyPath = '/usr/local/CyberCP/public/imunify' + + if os.path.exists(imunifyPath): + command = "yum reinstall imunify360-firewall-generic -y" + Upgrade.executioner(command, command, 1) + Upgrade.stdOut("Upgrade Completed.") diff --git a/plogical/vhost.py b/plogical/vhost.py index a1d0457b1..6e353096d 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -91,7 +91,7 @@ class vhost: try: os.makedirs(pathHTML) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -112,7 +112,7 @@ class vhost: try: os.makedirs(pathLogs) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -403,7 +403,7 @@ class vhost: ## - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'userdel -r -f %s' % (externalApp) else: command = 'deluser %s' % (externalApp) @@ -468,7 +468,7 @@ class vhost: ## - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: command = 'userdel -r -f %s' % (externalApp) else: command = 'deluser %s' % (externalApp) @@ -848,7 +848,7 @@ class vhost: try: os.makedirs(path) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: groupName = 'nobody' else: groupName = 'nogroup' @@ -857,7 +857,7 @@ class vhost: cmd = shlex.split(command) subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT) - command = "chmod 755 %s" % (path) + command = "chmod 750 %s" % (path) cmd = shlex.split(command) subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT) diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 7bbfcb306..d750f5e3c 100755 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -55,6 +55,65 @@ class virtualHostUtilities: cyberPanel = "/usr/local/CyberCP" redisConf = '/usr/local/lsws/conf/dvhost_redis.conf' + @staticmethod + def setupAutoDiscover(mailDomain, tempStatusPath, virtualHostName, admin): + + if mailDomain: + + logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Creating mail child domain..,80') + childDomain = 'mail.%s' % (virtualHostName) + childPath = '/home/%s/public_html/%s' % (virtualHostName, childDomain) + + virtualHostUtilities.createDomain(virtualHostName, childDomain, 'PHP 7.2', childPath, 1, 0, 0, + admin.userName, 0, "/home/cyberpanel/" + str(randint(1000, 9999))) + + ## update dovecot conf to enable auto-discover + + dovecotPath = '/etc/dovecot/dovecot.conf' + + if os.path.exists(dovecotPath): + dovecotContent = open(dovecotPath, 'r').read() + + if dovecotContent.find(childDomain) == -1: + content = """\nlocal_name %s { + ssl_cert = + + +
    + +
    +

    {% trans "Package Manager" %}

    +

    {% trans "On this page you can manage your system packages. On backend system available package manager is used (apt/yum)." %}

    +
    + +
    +
    +
    +
    + +
    + +
    +
    + Total Upgradeable Packages: {$ totalPackages $} + Fetched Packages: {$ fetchedPackages $} + + Update All + +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    {% trans "Package" %}{% trans "Version" %}{% trans "Upgrade" %}{% trans "Lock" %}{% trans "Actions" %}
    + + + + Details + + Update + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + Total Packages: {$ totalPackages $} + Fetched Packages: {$ fetchedPackages $} +
    + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    {% trans "Package" %}{% trans "Version" %}{% trans "Upgrade" %}{% trans "Lock" %}{% trans "Actions" %}
    + + + + Details + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + Total Packages: {$ totalPackages $} + Fetched Packages: {$ fetchedPackages $} + + + +
    + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + +
    {% trans "Package" %}{% trans "Version" %}{% trans "Lock" %}{% trans "Actions" %}
    + + + + Details + + Update + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + +{% endblock %} diff --git a/serverStatus/urls.py b/serverStatus/urls.py index cdd1224e0..86fd8638d 100755 --- a/serverStatus/urls.py +++ b/serverStatus/urls.py @@ -18,5 +18,10 @@ urlpatterns = [ url(r'^topProcesses$', views.topProcesses, name='topProcesses'), url(r'^topProcessesStatus$', views.topProcessesStatus, name='topProcessesStatus'), url(r'^killProcess$', views.killProcess, name='killProcess'), + url(r'^packageManager$', views.packageManager, name='packageManager'), + url(r'^fetchPackages$', views.fetchPackages, name='fetchPackages'), + url(r'^fetchPackageDetails$', views.fetchPackageDetails, name='fetchPackageDetails'), + url(r'^updatePackage$', views.updatePackage, name='updatePackage'), + url(r'^lockStatus$', views.lockStatus, name='lockStatus'), ] \ No newline at end of file diff --git a/serverStatus/views.py b/serverStatus/views.py index dae87051e..c28cce9b7 100755 --- a/serverStatus/views.py +++ b/serverStatus/views.py @@ -6,7 +6,7 @@ from django.http import HttpResponse import plogical.CyberCPLogFileWriter as logging from loginSystem.views import loadLoginPage import json -import subprocess +import subprocess, shlex import psutil import socket from plogical.acl import ACLManager @@ -93,7 +93,6 @@ def litespeedStatus(request): logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]") return redirect(loadLoginPage) - def stopOrRestartLitespeed(request): try: userID = request.session['userID'] @@ -127,7 +126,6 @@ def stopOrRestartLitespeed(request): logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[stopOrRestartLitespeed]") return HttpResponse("Not Logged in as admin") - def cyberCPMainLogFile(request): try: userID = request.session['userID'] @@ -145,7 +143,6 @@ def cyberCPMainLogFile(request): logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cyberCPMainLogFile]") return redirect(loadLoginPage) - def getFurtherDataFromLogFile(request): try: userID = request.session['userID'] @@ -196,7 +193,6 @@ def services(request): except KeyError: return redirect(loadLoginPage) - def servicesStatus(request): try: userID = request.session['userID'] @@ -291,7 +287,6 @@ def servicesStatus(request): except KeyError: return redirect(loadLoginPage) - def servicesAction(request): try: userID = request.session['userID'] @@ -344,7 +339,6 @@ def servicesAction(request): final_json = json.dumps(final_dic) return HttpResponse(final_json) - def switchTOLSWS(request): try: userID = request.session['userID'] @@ -378,7 +372,6 @@ def switchTOLSWS(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) - def switchTOLSWSStatus(request): try: @@ -505,7 +498,6 @@ def topProcesses(request): logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]") return redirect(loadLoginPage) - def topProcessesStatus(request): try: userID = request.session['userID'] @@ -580,17 +572,57 @@ def topProcessesStatus(request): data['Softirqs'] = loadNow[13] + '%' ## Memory - data['totalMemory'] = str(int(float(memory[3]) / 1024)) + 'MB' - data['freeMemory'] = str(int(float(memory[5]) / 1024)) + 'MB' - data['usedMemory'] = str(int(float(memory[7]) / 1024)) + 'MB' - data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB' + + logging.CyberCPLogFileWriter.writeToFile(str(memory)) + + if memory[3].find('+') > -1: + memoryFinal = memory[3].split('+')[0] + else: + memoryFinal = memory[3] + + data['totalMemory'] = str(int(float(memoryFinal) / 1024)) + 'MB' + + + ## + + if memory[5].find('free') > -1: + data['freeMemory'] = str(int(float(memory[4]) / 1024)) + 'MB' + else: + data['freeMemory'] = str(int(float(memory[5]) / 1024)) + 'MB' + + + ## + + if memory[7].find('used') > -1: + data['usedMemory'] = str(int(float(memory[6]) / 1024)) + 'MB' + else: + data['usedMemory'] = str(int(float(memory[7]) / 1024)) + 'MB' + + + try: + if memory[9].find('buff') > -1: + data['buffCache'] = str(int(float(memory[8]) / 1024)) + 'MB' + else: + data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB' + except: + logging.CyberCPLogFileWriter.writeToFile(memory[8]) + data['buffCache'] = str(int(float(memory[8].split('+')[0]) / 1024)) + 'MB' + ## Swap + logging.CyberCPLogFileWriter.writeToFile(str(swap)) + + data['swapTotalMemory'] = str(int(float(swap[2]) / 1024)) + 'MB' data['swapFreeMemory'] = str(int(float(swap[4]) / 1024)) + 'MB' data['swapUsedMemory'] = str(int(float(swap[6]) / 1024)) + 'MB' - data['swapBuffCache'] = str(int(float(swap[8]) / 1024)) + 'MB' + + if swap[8].find('+') > -1: + finalBuffCache = swap[8].split('+')[0] + data['swapBuffCache'] = str(int(float(finalBuffCache) / 1024)) + 'MB' + else: + data['swapBuffCache'] = str(int(float(swap[8]) / 1024)) + 'MB' ## Processes @@ -628,7 +660,6 @@ def topProcessesStatus(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) - def killProcess(request): try: userID = request.session['userID'] @@ -656,4 +687,420 @@ def killProcess(request): except KeyError as msg: final_dic = {'status': 0, 'erroMessage': str(msg)} final_json = json.dumps(final_dic) - return HttpResponse(final_json) \ No newline at end of file + return HttpResponse(final_json) + +def packageManager(request): + try: + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + templateName = "serverStatus/packageManager.html" + proc = httpProc(request, templateName) + return proc.renderPre() + + except KeyError as msg: + logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[packageManager]") + return redirect(loadLoginPage) + +def fetchPackages(request): + try: + + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + data = json.loads(request.body) + page = int(str(data['page']).rstrip('\n')) + recordsToShow = int(data['recordsToShow']) + type = data['type'] + + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: + + command = 'apt-mark showhold' + locked = ProcessUtilities.outputExecutioner(command).split('\n') + + if type == 'CyberPanel': + + command = 'cat /usr/local/CyberCP/AllCPUbuntu.json' + packages = json.loads(ProcessUtilities.outputExecutioner(command)) + + else: + command = 'apt list --installed' + packages = ProcessUtilities.outputExecutioner(command).split('\n') + packages = packages[4:] + + upgradePackages = [] + + if type == 'upgrade': + for pack in packages: + if pack.find('upgradable') > -1: + upgradePackages.append(pack) + + packages = upgradePackages + + + elif ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + + ### Check Package Lock status + + if os.path.exists('/etc/yum.conf'): + yumConf = '/etc/yum.conf' + elif os.path.exists('/etc/yum/yum.conf'): + yumConf = '/etc/yum/yum.conf' + + yumConfData = open(yumConf, 'r').read() + locked = [] + + if yumConfData.find('exclude') > -1: + + data = open(yumConf, 'r').readlines() + + for items in data: + if items.find('exclude') > -1: + locked = items.split('=')[1].rstrip('\n').split(' ') + break + + if type == 'installed': + + #### Cater for packages that need updates. + + startForUpdate = 1 + + command = 'yum check-update' + updates = ProcessUtilities.outputExecutioner(command).split('\n') + + for items in updates: + if items == '': + updates = updates[startForUpdate:] + break + else: + startForUpdate = startForUpdate + 1 + + ## make list of packages that need update + + updateNeeded = [] + for items in updates: + updateNeeded.append(items.split(' ')[0]) + + ### + + command = 'yum list installed' + packages = ProcessUtilities.outputExecutioner(command).split('\n') + + startFrom = 1 + + for items in packages: + if items.find('Installed Packages') > -1: + packages = packages[startFrom:] + break + else: + startFrom = startFrom + 1 + elif type == 'upgrade': + #### Cater for packages that need updates. + + startForUpdate = 1 + + command = 'yum check-update' + packages = ProcessUtilities.outputExecutioner(command).split('\n') + + for items in packages: + if items == '': + packages = packages[startForUpdate:-1] + break + else: + startForUpdate = startForUpdate + 1 + elif type == 'CyberPanel': + command = 'cat /usr/local/CyberCP/CPCent7repo.json' + packages = json.loads(ProcessUtilities.outputExecutioner(command)) + + ## make list of packages that need update + + + #if os.path.exists(ProcessUtilities.debugPath): + # logging.CyberCPLogFileWriter.writeToFile('All packages: %s' % (str(packages))) + + from s3Backups.s3Backups import S3Backups + + pagination = S3Backups.getPagination(len(packages), recordsToShow) + endPageNumber, finalPageNumber = S3Backups.recordsPointer(page, recordsToShow) + finalPackages = packages[finalPageNumber:endPageNumber] + + json_data = "[" + checker = 0 + counter = 0 + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile('Final packages: %s' % (str(finalPackages))) + + import re + for items in finalPackages: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: + try: + if type == 'CyberPanel': + + packageName = items['Package'].split('/')[0] + + if packageName in locked: + lock = 1 + else: + lock = 0 + + dic = {'package': packageName, + 'version': items['Version'], 'lock': lock} + + counter = counter + 1 + if checker == 0: + json_data = json_data + json.dumps(dic) + checker = 1 + else: + json_data = json_data + ',' + json.dumps(dic) + + else: + nowSplitted = items.split('now') + + upgrade = 'Not Needed' + + if nowSplitted[1].split(' ')[3].find('upgradable') > -1: + current = nowSplitted[1].split(' ') + upgrade = '%s %s %s' % (current[3], current[4], current[5]) + + if nowSplitted[0].split('/')[0] in locked: + lock = 1 + else: + lock = 0 + + dic = {'package': nowSplitted[0].split('/')[0], 'version': '%s %s' % (nowSplitted[1].split(' ')[1], nowSplitted[1].split(' ')[2]), 'upgrade': upgrade, 'lock': lock} + + counter = counter + 1 + if checker == 0: + json_data = json_data + json.dumps(dic) + checker = 1 + else: + json_data = json_data + ',' + json.dumps(dic) + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile('[ERROR] %s. [fetchPackages:773]' % (str(msg))) + elif ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + try: + if type == 'installed' or type == 'upgrade': + + ### + + details = items.split(' ') + details = [a for a in details if a != ''] + + if type == 'installed': + if details[0] in updateNeeded: + upgrade = 'Upgrade available' + else: + upgrade = 'Not needed.' + else: + upgrade = 'Upgrade available' + + + if details[0].split('.')[0] in locked: + lock = 1 + else: + lock = 0 + + dic = {'package': details[0], + 'version': details[1], + 'upgrade': upgrade, 'lock': lock} + + counter = counter + 1 + if checker == 0: + json_data = json_data + json.dumps(dic) + checker = 1 + else: + json_data = json_data + ',' + json.dumps(dic) + elif type == 'CyberPanel': + + packageName = items['Package'] + + if packageName.split('.')[0] in locked: + lock = 1 + else: + lock = 0 + + dic = {'package': packageName, + 'version': items['Version'], 'lock': lock} + + counter = counter + 1 + if checker == 0: + json_data = json_data + json.dumps(dic) + checker = 1 + else: + json_data = json_data + ',' + json.dumps(dic) + + + except BaseException as msg: + print(str(msg)) + logging.CyberCPLogFileWriter.writeToFile('[ERROR] %s. [fetchPackages:839]' % (str(msg))) + + json_data = json_data + ']' + + data_ret = {'status': 1, 'packages': json_data, 'pagination': pagination, 'fetchedPackages': counter, 'totalPackages': len(packages)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + +def fetchPackageDetails(request): + try: + + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + data = json.loads(request.body) + package = data['package'] + + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: + command = 'apt-cache show %s' % (package) + packageDetails = ProcessUtilities.outputExecutioner(command) + elif ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + command = 'yum info %s' % (package) + packageDetails = ProcessUtilities.outputExecutioner(command) + + data_ret = {'status': 1, 'packageDetails': packageDetails} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + +def updatePackage(request): + try: + + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + data = json.loads(request.body) + package = data['package'] + + from serverStatus.serverStatusUtil import ServerStatusUtil + + logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, + 'Starting package(s) upgrade..', + 1) + + extraArgs = {} + extraArgs['package'] = package + + from plogical.applicationInstaller import ApplicationInstaller + + background = ApplicationInstaller('updatePackage', extraArgs) + background.start() + + time.sleep(2) + + data_ret = {'status': 1} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + +def lockStatus(request): + try: + + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + data = json.loads(request.body) + package = data['package'] + type = data['type'] + + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: + + if type == 0: + command = 'apt-mark unhold %s' % (package) + ProcessUtilities.executioner(command) + else: + command = 'apt-mark hold %s' % (package) + ProcessUtilities.executioner(command) + + elif ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + + package = package.split('.')[0] + + if os.path.exists('/etc/yum.conf'): + yumConf = '/etc/yum.conf' + elif os.path.exists('/etc/yum/yum.conf'): + yumConf = '/etc/yum/yum.conf' + + yumConfData = ProcessUtilities.outputExecutioner('cat %s' % (yumConf)) + data = yumConfData.splitlines() + + yumConfTmp = '/home/cyberpanel/yumTemp' + + if type == 0: + writeToFile = open(yumConfTmp, 'w') + + for items in data: + if items.find('exclude') > -1: + writeToFile.writelines(items.replace(package, '')) + else: + writeToFile.writelines(items) + + writeToFile.close() + else: + + if yumConfData.find('exclude') == -1: + + writeToFile = open(yumConfTmp, 'a') + writeToFile.writelines('exclude=%s\n' % (package)) + writeToFile.close() + + else: + writeToFile = open(yumConfTmp, 'w') + + for items in data: + if items.find('exclude') > -1: + excludeLine = items.strip('\n') + writeToFile.writelines('%s %s\n' % (excludeLine, package)) + else: + writeToFile.writelines(items) + + writeToFile.close() + + command = 'mv %s %s' % (yumConfTmp, yumConf) + ProcessUtilities.executioner(command) + + data_ret = {'status': 1} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) \ No newline at end of file diff --git a/static/WebTerminal/main.js b/static/WebTerminal/main.js index f7443fdbe..248737afc 100644 --- a/static/WebTerminal/main.js +++ b/static/WebTerminal/main.js @@ -73,16 +73,6 @@ function connect() { if (remember) { store(options) } - // if (check()) { - // openTerminal(options) - // } else { - // for (var key in validResult) { - // if (!validResult[key]) { - // alert(errorMsg[key]); - // break; - // } - // } - // } openTerminal(options) } diff --git a/static/backup/backup.js b/static/backup/backup.js index 9c158422b..59c654f87 100644 --- a/static/backup/backup.js +++ b/static/backup/backup.js @@ -416,7 +416,7 @@ app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) { }); -//*** Resotre site ends here ***/// +//*** Restore site ends here ***/// ///** Backup Destination ***// @@ -448,6 +448,7 @@ app.controller('backupDestinations', function ($scope, $http, $timeout) { var data = { IPAddress: $scope.IPAddress, password: $scope.password, + user: $scope.user, backupSSHPort: $scope.backupSSHPort, }; @@ -1346,6 +1347,7 @@ app.controller('remoteBackupControl', function ($scope, $http, $timeout) { $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); function ListInitialDatas(response) { + $scope.backupProcessStarted = true; if (response.data.remoteTransferStatus === 1) { @@ -1539,4 +1541,68 @@ app.controller('remoteBackupControl', function ($scope, $http, $timeout) { }); -///** Backup site ends **/// \ No newline at end of file +///** Backup site ends **/// + + +//*** Remote Backup site ****// +app.controller('backupLogsScheduled', function ($scope, $http, $timeout) { + + $scope.cyberpanelLoading = true; + $scope.logDetails = true; + + $scope.currentPage = 1; + $scope.recordsToShow = 10; + + $scope.fetchLogs = function () { + + $scope.cyberpanelLoading = false; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + logFile: $scope.logFile, + recordsToShow: $scope.recordsToShow, + page: $scope.currentPage + }; + + dataurl = "/backup/fetchLogs"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + $scope.logDetails = false; + $scope.logs = JSON.parse(response.data.logs); + $scope.pagination = response.data.pagination; + $scope.jobSuccessSites = response.data.jobSuccessSites; + $scope.jobFailedSites = response.data.jobFailedSites; + $scope.location = response.data.location; + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + } + function cantLoadInitialData(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + + }; + + +}); + +///** Backup site ends **/// diff --git a/static/databases/databases.js b/static/databases/databases.js old mode 100755 new mode 100644 index e13d25977..d1e91175b --- a/static/databases/databases.js +++ b/static/databases/databases.js @@ -106,7 +106,7 @@ app.controller('createDatabase', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.dbPassword = randomPassword(12); + $scope.dbPassword = randomPassword(16); }; $scope.usePassword = function () { @@ -447,7 +447,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.dbPassword = randomPassword(12); + $scope.dbPassword = randomPassword(16); }; $scope.usePassword = function () { @@ -493,4 +493,4 @@ app.controller('phpMyAdmin', function ($scope, $http, $window) { } setupPHPMYAdminSession(); -}); \ No newline at end of file +}); diff --git a/static/emailPremium/emailPremium.js b/static/emailPremium/emailPremium.js index 48f7109fc..eb1ec4b83 100644 --- a/static/emailPremium/emailPremium.js +++ b/static/emailPremium/emailPremium.js @@ -4,7 +4,7 @@ /* Java script code to list accounts */ -app.controller('listDomains', function($scope,$http) { +app.controller('listDomains', function ($scope, $http) { $scope.listFail = true; $scope.emailLimitsLoading = true; @@ -13,7 +13,7 @@ app.controller('listDomains', function($scope,$http) { var globalPageNumber; - $scope.getFurtherWebsitesFromDB = function(pageNumber) { + $scope.getFurtherWebsitesFromDB = function (pageNumber) { globalPageNumber = pageNumber; $scope.emailLimitsLoading = false; @@ -23,37 +23,36 @@ app.controller('listDomains', function($scope,$http) { var data = {page: pageNumber}; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.listWebSiteStatus === 1) { + if (response.data.listWebSiteStatus === 1) { - $scope.WebSitesList = JSON.parse(response.data.data); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.WebSitesList = JSON.parse(response.data.data); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getFurtherWebsitesFromDB(1); $scope.enableDisableEmailLimits = function (operationVal, domainName) { @@ -69,33 +68,32 @@ app.controller('listDomains', function($scope,$http) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.getFurtherWebsitesFromDB(globalPageNumber); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.getFurtherWebsitesFromDB(globalPageNumber); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } } }); @@ -104,7 +102,7 @@ app.controller('listDomains', function($scope,$http) { /* Java script code for email domain page */ -app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { +app.controller('emailDomainPage', function ($scope, $http, $timeout, $window) { $scope.listFail = true; $scope.emailLimitsLoading = true; @@ -115,7 +113,7 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { var globalPageNumber; - $scope.getFurtherEmailsFromDB = function(pageNumber) { + $scope.getFurtherEmailsFromDB = function (pageNumber) { globalPageNumber = pageNumber; $scope.emailLimitsLoading = false; @@ -128,37 +126,36 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.emailList = JSON.parse(response.data.data); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.emailList = JSON.parse(response.data.data); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getFurtherEmailsFromDB(1); $scope.enableDisableEmailLimits = function (operationVal, domainName) { @@ -174,29 +171,34 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $timeout(function() { $window.location.reload(); }, 0); + $timeout(function () { + $window.location.reload(); + }, 0); + } else { + $timeout(function () { + $window.location.reload(); + }, 0); + } } - else - { - $timeout(function() { $window.location.reload(); }, 0); - } - } + function cantLoadInitialData(response) { - $timeout(function() { $window.location.reload(); }, 0); - } + $timeout(function () { + $window.location.reload(); + }, 0); + } }; @@ -219,27 +221,27 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; $scope.changeDomainEmailLimits = function (domainName) { - $scope.emailLimitsLoading = false; + $scope.emailLimitsLoading = false; - url = "/emailPremium/changeDomainLimit"; + url = "/emailPremium/changeDomainLimit"; - var data = { - domainName: domainName, - newLimit: $scope.monthlyLimit - }; + var data = { + domainName: domainName, + newLimit: $scope.monthlyLimit + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); - function ListInitialData(response) { + function ListInitialData(response) { - $scope.emailLimitsLoading = true; + $scope.emailLimitsLoading = true; if (response.data.status === 1) { @@ -248,10 +250,10 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { $scope.changeLimitsFail = true; $scope.changeLimitsSuccess = false; $scope.couldNotConnect = true; - $timeout(function() { $window.location.reload(); }, 3000); - } - else - { + $timeout(function () { + $window.location.reload(); + }, 3000); + } else { $scope.changeLimitsForm = false; $scope.changeLimitsFail = false; $scope.changeLimitsSuccess = true; @@ -260,12 +262,13 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { } } - function cantLoadInitialData(response) { - $scope.emailLimitsLoading = true; - $scope.changeLimitsForm = false; - $scope.changeLimitsFail = true; - $scope.changeLimitsSuccess = true; - $scope.couldNotConnect = false; + + function cantLoadInitialData(response) { + $scope.emailLimitsLoading = true; + $scope.changeLimitsForm = false; + $scope.changeLimitsFail = true; + $scope.changeLimitsSuccess = true; + $scope.couldNotConnect = false; } } @@ -283,28 +286,27 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { - $scope.getFurtherEmailsFromDB(1); + if (response.data.status === 1) { + $scope.getFurtherEmailsFromDB(1); + } else { + $scope.getFurtherEmailsFromDB(1); + } } - else - { - $scope.getFurtherEmailsFromDB(1); - } - } + function cantLoadInitialData(response) { $scope.getFurtherEmailsFromDB(1); - } + } }; }); @@ -313,7 +315,7 @@ app.controller('emailDomainPage', function($scope,$http, $timeout, $window) { /* Java script code for Email Page */ -app.controller('emailPage', function($scope,$http, $timeout, $window) { +app.controller('emailPage', function ($scope, $http, $timeout, $window) { $scope.emailLimitsLoading = true; @@ -322,7 +324,7 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { // Global page number, to be used in later function to refresh the domains var globalPageNumber; - $scope.getEmailStats = function() { + $scope.getEmailStats = function () { $scope.emailLimitsLoading = false; @@ -338,56 +340,55 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.monthlyLimit = response.data.monthlyLimit; - $scope.monthlyUsed = response.data.monthlyUsed; - $scope.hourlyLimit = response.data.hourlyLimit; - $scope.hourlyUsed = response.data.hourlyUsed; + $scope.monthlyLimit = response.data.monthlyLimit; + $scope.monthlyUsed = response.data.monthlyUsed; + $scope.hourlyLimit = response.data.hourlyLimit; + $scope.hourlyUsed = response.data.hourlyUsed; + + if (response.data.limitStatus === 1) { + $scope.limitsOn = false; + $scope.limitsOff = true; + } else { + $scope.limitsOn = true; + $scope.limitsOff = false; + } + + if (response.data.logsStatus === 1) { + $scope.loggingOn = false; + $scope.loggingOff = true; + } else { + $scope.loggingOn = true; + $scope.loggingOff = false; + } + + } else { + + $scope.errorMessage = response.data.error_message; - if(response.data.limitStatus === 1){ - $scope.limitsOn = false; - $scope.limitsOff = true; - }else{ - $scope.limitsOn = true; - $scope.limitsOff = false; } - - if(response.data.logsStatus === 1){ - $scope.loggingOn = false; - $scope.loggingOff = true; - }else{ - $scope.loggingOn = true; - $scope.loggingOff = false; - } - } - else - { - $scope.errorMessage = response.data.error_message; - - } - } function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getEmailStats(); $scope.enableDisableIndividualEmailLimits = function (operationVal, emailAddress) { @@ -403,12 +404,12 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { @@ -416,15 +417,14 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { if (response.data.status === 1) { $scope.getEmailStats(); - } - else - { + } else { $scope.getEmailStats(); } - } + } + function cantLoadInitialData(response) { $scope.getEmailStats(); - } + } }; $scope.enableDisableIndividualEmailLogs = function (operationVal, emailAddress) { @@ -439,12 +439,12 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { @@ -452,15 +452,14 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { if (response.data.status === 1) { $scope.getEmailStats(); - } - else - { + } else { $scope.getEmailStats(); } - } + } + function cantLoadInitialData(response) { $scope.getEmailStats(); - } + } }; @@ -477,29 +476,34 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $timeout(function() { $window.location.reload(); }, 0); + $timeout(function () { + $window.location.reload(); + }, 0); + } else { + $timeout(function () { + $window.location.reload(); + }, 0); + } } - else - { - $timeout(function() { $window.location.reload(); }, 0); - } - } + function cantLoadInitialData(response) { - $timeout(function() { $window.location.reload(); }, 0); - } + $timeout(function () { + $window.location.reload(); + }, 0); + } }; @@ -521,28 +525,28 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; $scope.changeDomainEmailLimitsIndividual = function () { - $scope.emailLimitsLoading = false; + $scope.emailLimitsLoading = false; - url = "/emailPremium/changeDomainEmailLimitsIndividual"; + url = "/emailPremium/changeDomainEmailLimitsIndividual"; - var data = { - emailAddress: globalEamilAddress, - monthlyLimit: $scope.monthlyLimitForm, - hourlyLimit: $scope.hourlyLimitForm - }; + var data = { + emailAddress: globalEamilAddress, + monthlyLimit: $scope.monthlyLimitForm, + hourlyLimit: $scope.hourlyLimitForm + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); - function ListInitialData(response) { + function ListInitialData(response) { - $scope.emailLimitsLoading = true; + $scope.emailLimitsLoading = true; if (response.data.status === 1) { @@ -553,9 +557,7 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { $scope.couldNotConnect = true; $scope.getEmailStats(); - } - else - { + } else { $scope.changeLimitsForm = false; $scope.changeLimitsFail = false; $scope.changeLimitsSuccess = true; @@ -564,18 +566,19 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { } } - function cantLoadInitialData(response) { - $scope.emailLimitsLoading = true; - $scope.changeLimitsForm = false; - $scope.changeLimitsFail = true; - $scope.changeLimitsSuccess = true; - $scope.couldNotConnect = false; + + function cantLoadInitialData(response) { + $scope.emailLimitsLoading = true; + $scope.changeLimitsForm = false; + $scope.changeLimitsFail = true; + $scope.changeLimitsSuccess = true; + $scope.couldNotConnect = false; } }; /// Get email logs - $scope.getLogEntries = function(pageNumber) { + $scope.getLogEntries = function (pageNumber) { globalPageNumber = pageNumber; $scope.emailLimitsLoading = false; @@ -588,41 +591,40 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { + if (response.data.status === 1) { - $scope.logs = JSON.parse(response.data.data); - $scope.listFail = true; - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + $scope.logs = JSON.parse(response.data.data); + $scope.listFail = true; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; + } } - } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; - } + } - }; + }; $scope.getLogEntries(1); - $scope.flushLogs = function(emailAddress) { + $scope.flushLogs = function (emailAddress) { $scope.emailLimitsLoading = false; @@ -633,36 +635,35 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { }; var config = { - headers : { + headers: { 'X-CSRFToken': getCookie('csrftoken') } }; - $http.post(url, data,config).then(ListInitialData, cantLoadInitialData); + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { $scope.emailLimitsLoading = true; - if (response.data.status === 1) { - $scope.getLogEntries(1); + if (response.data.status === 1) { + $scope.getLogEntries(1); - } - else - { - $scope.listFail = false; - $scope.errorMessage = response.data.error_message; + } else { + $scope.listFail = false; + $scope.errorMessage = response.data.error_message; } } + function cantLoadInitialData(response) { $scope.emailLimitsLoading = true; $scope.listFail = false; } - }; + }; }); @@ -670,286 +671,285 @@ app.controller('emailPage', function($scope,$http, $timeout, $window) { /* Java script code for SpamAssassin */ -app.controller('SpamAssassin', function($scope, $http, $timeout, $window) { +app.controller('SpamAssassin', function ($scope, $http, $timeout, $window) { - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = true; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + $scope.installSpamAssassin = function () { - $scope.installSpamAssassin = function(){ + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = true; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; + url = "/emailPremium/installSpamAssassin"; - url = "/emailPremium/installSpamAssassin"; + var data = {}; - var data = {}; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; - getRequestStatus(); + getRequestStatus(); - } - else{ - $scope.errorMessage = response.data.error_message; + } else { + $scope.errorMessage = response.data.error_message; - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = true; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = false; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = false; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + } + + }; + + function getRequestStatus() { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/emailPremium/installStatusSpamAssassin"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.abort === 0) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.requestData = response.data.requestStatus; + $timeout(getRequestStatus, 1000); + } else { + // Notifications + $timeout.cancel(); + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + + $scope.requestData = response.data.requestStatus; + + if (response.data.installed === 0) { + $scope.installationFailed = false; + $scope.errorMessage = response.data.error_message; + } else { + $scope.SpamAssassinSuccessfullyInstalled = false; + $timeout(function () { + $window.location.reload(); + }, 3000); + } + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + + } + + } + + ///// SpamAssassin configs + + var report_safe = false; + + + $('#report_safe').change(function () { + report_safe = $(this).prop('checked'); + }); + + fetchSpamAssassinSettings(); + + function fetchSpamAssassinSettings() { + + $scope.SpamAssassinLoading = false; + + $('#report_safe').bootstrapToggle('off'); + + url = "/emailPremium/fetchSpamAssassinSettings"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + $scope.SpamAssassinLoading = true; + + if (response.data.fetchStatus === 1) { + + if (response.data.installed === 1) { + + if (response.data.report_safe === 1) { + $('#report_safe').bootstrapToggle('on'); } - } - function cantLoadInitialDatas(response) { - - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = false; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - } - - }; - - function getRequestStatus(){ - - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - - url = "/emailPremium/installStatusSpamAssassin"; - - var data = {}; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - - if(response.data.abort === 0){ - - $scope.SpamAssassinNotifyBox = true; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = false; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - - $scope.requestData = response.data.requestStatus; - $timeout(getRequestStatus,1000); - } - else{ - // Notifications - $timeout.cancel(); - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = true; - - $scope.requestData = response.data.requestStatus; - - if(response.data.installed === 0) { - $scope.installationFailed = false; - $scope.errorMessage = response.data.error_message; - }else{ - $scope.SpamAssassinSuccessfullyInstalled = false; - $timeout(function() { $window.location.reload(); }, 3000); - } - - } - - } - function cantLoadInitialDatas(response) { - - $scope.SpamAssassinNotifyBox = false; - $scope.SpamAssassinInstallBox = false; - $scope.SpamAssassinLoading = true; - $scope.failedToStartInallation = true; - $scope.couldNotConnect = false; - $scope.SpamAssassinSuccessfullyInstalled = true; - $scope.installationFailed = true; - + $scope.required_hits = response.data.required_hits; + $scope.rewrite_header = response.data.rewrite_header; + $scope.required_score = response.data.required_score; } - } + } - ///// SpamAssassin configs + } - var report_safe = false; + function cantLoadInitialDatas(response) { + $scope.SpamAssassinLoading = true; + } + + } - $('#report_safe').change(function() { - report_safe = $(this).prop('checked'); - }); + ///// - fetchSpamAssassinSettings(); - function fetchSpamAssassinSettings(){ + /// Save SpamAssassin Changes - $scope.SpamAssassinLoading = false; + $scope.failedToSave = true; + $scope.successfullySaved = true; - $('#report_safe').bootstrapToggle('off'); + $scope.saveSpamAssassinConfigurations = function () { - url = "/emailPremium/fetchSpamAssassinSettings"; - - var data = {}; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $scope.failedToSave = true; + $scope.successfullySaved = true; + $scope.SpamAssassinLoading = false; + $scope.couldNotConnect = true; + url = "/emailPremium/saveSpamAssassinConfigurations"; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + var data = { + report_safe: report_safe, + required_hits: $scope.required_hits, + rewrite_header: $scope.rewrite_header, + required_score: $scope.required_score + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - function ListInitialDatas(response) { - - $scope.SpamAssassinLoading = true; - - if(response.data.fetchStatus === 1){ - - if(response.data.installed === 1) { - - if (response.data.report_safe === 1) { - $('#report_safe').bootstrapToggle('on'); - } - - $scope.required_hits = response.data.required_hits; - $scope.rewrite_header = response.data.rewrite_header; - $scope.required_score = response.data.required_score; - - } - - } - - } - function cantLoadInitialDatas(response) { - $scope.SpamAssassinLoading = true; - } - - } + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - ///// - - /// Save SpamAssassin Changes - - $scope.failedToSave = true; - $scope.successfullySaved = true; - - $scope.saveSpamAssassinConfigurations = function () { - - $scope.failedToSave = true; - $scope.successfullySaved = true; - $scope.SpamAssassinLoading = false; - $scope.couldNotConnect = true; + function ListInitialDatas(response) { - url = "/emailPremium/saveSpamAssassinConfigurations"; + if (response.data.saveStatus === 1) { - var data = { - report_safe:report_safe, - required_hits:$scope.required_hits, - rewrite_header:$scope.rewrite_header, - required_score:$scope.required_score - }; + $scope.failedToSave = true; + $scope.successfullySaved = false; + $scope.SpamAssassinLoading = true; + $scope.couldNotConnect = true; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + } else { + $scope.errorMessage = response.data.error_message; + + $scope.failedToSave = false; + $scope.successfullySaved = true; + $scope.SpamAssassinLoading = true; + $scope.couldNotConnect = true; + } + + } + + function cantLoadInitialDatas(response) { + $scope.failedToSave = true; + $scope.successfullySaved = false; + $scope.SpamAssassinLoading = true; + $scope.couldNotConnect = true; + } - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - - - function ListInitialDatas(response) { - - - if(response.data.saveStatus === 1){ - - $scope.failedToSave = true; - $scope.successfullySaved = false; - $scope.SpamAssassinLoading = true; - $scope.couldNotConnect = true; - - } - else{ - $scope.errorMessage = response.data.error_message; - - $scope.failedToSave = false; - $scope.successfullySaved = true; - $scope.SpamAssassinLoading = true; - $scope.couldNotConnect = true; - } - - } - function cantLoadInitialDatas(response) { - $scope.failedToSave = true; - $scope.successfullySaved = false; - $scope.SpamAssassinLoading = true; - $scope.couldNotConnect = true; - } - - - }; + }; }); @@ -957,129 +957,128 @@ app.controller('SpamAssassin', function($scope, $http, $timeout, $window) { /* Java script code for Email Policy Server */ -app.controller('policyServer', function($scope, $http, $timeout, $window) { +app.controller('policyServer', function ($scope, $http, $timeout, $window) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - ///// SpamAssassin configs + ///// SpamAssassin configs - var report_safe = false; + var report_safe = false; - $('#policServerStatus').change(function() { - policServerStatus = $(this).prop('checked'); - }); + $('#policServerStatus').change(function () { + policServerStatus = $(this).prop('checked'); + }); - fetchPolicServerStatus(); - function fetchPolicServerStatus(){ + fetchPolicServerStatus(); - $scope.policyServerLoading = false; + function fetchPolicServerStatus() { - $('#policServerStatus').bootstrapToggle('off'); + $scope.policyServerLoading = false; - url = "/emailPremium/fetchPolicyServerStatus"; + $('#policServerStatus').bootstrapToggle('off'); - var data = {}; + url = "/emailPremium/fetchPolicyServerStatus"; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.policyServerLoading = true; + $scope.policyServerLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#policServerStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#policServerStatus').bootstrapToggle('on'); } - } + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } - $scope.savePolicServerStatus = function () { + $scope.savePolicServerStatus = function () { - $scope.policyServerLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.policyServerLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + url = "/emailPremium/savePolicyServerStatus"; - url = "/emailPremium/savePolicyServerStatus"; + var data = { + policServerStatus: policServerStatus + }; - var data = { - policServerStatus:policServerStatus - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.policyServerLoading = true; + function ListInitialDatas(response) { + $scope.policyServerLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; - } - else{ - $scope.errorMessage = response.data.error_message; + } else { + $scope.errorMessage = response.data.error_message; - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } - } - function cantLoadInitialDatas(response) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - }; + }; }); @@ -1087,7 +1086,7 @@ app.controller('policyServer', function($scope, $http, $timeout, $window) { /* Java script code to manage mail queue */ -app.controller('mailQueue', function($scope,$http) { +app.controller('mailQueue', function ($scope, $http) { $scope.currentPage = 1; $scope.recordsToShow = 10; @@ -1248,8 +1247,7 @@ app.controller('mailQueue', function($scope,$http) { } }; - var data = { - }; + var data = {}; dataurl = "/emailPremium/flushQueue"; @@ -1287,4 +1285,159 @@ app.controller('mailQueue', function($scope,$http) { }; }); -/* Java script code to manage mail queue ends here */ \ No newline at end of file +/* Java script code to manage mail queue ends here */ + +app.controller('MailScanner', function ($scope, $http, $timeout, $window) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.installSpamAssassin = function () { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/emailPremium/installMailScanner"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.status === 1) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + getRequestStatus(); + + } else { + $scope.errorMessage = response.data.error_message; + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = true; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = false; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + } + + }; + + function getRequestStatus() { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/emailPremium/installStatusMailScanner"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.abort === 0) { + + $scope.SpamAssassinNotifyBox = true; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.requestData = response.data.requestStatus; + $timeout(getRequestStatus, 1000); + } else { + // Notifications + $timeout.cancel(); + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + + $scope.requestData = response.data.requestStatus; + + if (response.data.installed === 0) { + $scope.installationFailed = false; + $scope.errorMessage = response.data.error_message; + } else { + $scope.SpamAssassinSuccessfullyInstalled = false; + $timeout(function () { + $window.location.reload(); + }, 3000); + } + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.SpamAssassinNotifyBox = false; + $scope.SpamAssassinInstallBox = false; + $scope.SpamAssassinLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.SpamAssassinSuccessfullyInstalled = true; + $scope.installationFailed = true; + + + } + + } +}); \ No newline at end of file diff --git a/static/filemanager/js/fileManager.js b/static/filemanager/js/fileManager.js index 725224dbb..19e175118 100644 --- a/static/filemanager/js/fileManager.js +++ b/static/filemanager/js/fileManager.js @@ -1479,7 +1479,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, // Download files $scope.downloadFile = function () { - url = "/filemanager/downloadFile"; var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0]; window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL; diff --git a/static/firewall/firewall.js b/static/firewall/firewall.js index a0acd1f53..eaa372adb 100644 --- a/static/firewall/firewall.js +++ b/static/firewall/firewall.js @@ -2171,8 +2171,6 @@ app.controller('installImunify', function ($scope, $http, $timeout, $window) { text: 'Could not connect to server, please refresh this page', type: 'error' }); - - } } diff --git a/static/ftp/ftp.js b/static/ftp/ftp.js index 679a8b5f7..a80377e6b 100644 --- a/static/ftp/ftp.js +++ b/static/ftp/ftp.js @@ -113,7 +113,7 @@ app.controller('createFTPAccount', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.ftpPassword = randomPassword(12); + $scope.ftpPassword = randomPassword(16); }; $scope.usePassword = function () { @@ -451,11 +451,11 @@ app.controller('listFTPAccounts', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.ftpPassword = randomPassword(12); + $scope.ftpPassword = randomPassword(16); }; $scope.usePassword = function () { $scope.generatedPasswordView = true; }; -}); \ No newline at end of file +}); diff --git a/static/mailServer/mailServer.js b/static/mailServer/mailServer.js index f50b36a45..f46bb4d4a 100644 --- a/static/mailServer/mailServer.js +++ b/static/mailServer/mailServer.js @@ -110,7 +110,7 @@ app.controller('createEmailAccount', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.emailPassword = randomPassword(12); + $scope.emailPassword = randomPassword(16); }; $scope.usePassword = function () { @@ -465,7 +465,7 @@ app.controller('changeEmailPassword', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.emailPassword = randomPassword(12); + $scope.emailPassword = randomPassword(16); }; $scope.usePassword = function () { @@ -1124,6 +1124,7 @@ app.controller('listEmails', function ($scope, $http) { $scope.cyberpanelLoading = true; $scope.emailsAccounts = true; + $scope.mailConfigured = 1; $scope.populateCurrentRecords = function () { $scope.cyberpanelLoading = false; @@ -1151,6 +1152,9 @@ app.controller('listEmails', function ($scope, $http) { if (response.data.status === 1) { $scope.emailsAccounts = false; $scope.records = JSON.parse(response.data.data); + $scope.mailConfigured = response.data.mailConfigured; + $scope.serverHostname = response.data.serverHostname; + new PNotify({ title: 'Success!', text: 'Emails Successfully Fetched.', @@ -1229,6 +1233,55 @@ app.controller('listEmails', function ($scope, $http) { } + }; + + $scope.fixMailSSL = function (email) { + + $scope.cyberpanelLoading = false; + + var url = "/email/fixMailSSL"; + + var data = { + selectedDomain: $scope.selectedDomain, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + function ListInitialDatas(response) { + if (response.data.status === 1) { + $scope.populateCurrentRecords(); + new PNotify({ + title: 'Success!', + text: 'Configurations applied successfully.', + type: 'success' + }); + + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + + } + + } + + function cantLoadInitialDatas(response) { + new PNotify({ + title: 'Error!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + + }; $scope.changePasswordInitial = function (email) { @@ -1291,4 +1344,4 @@ app.controller('listEmails', function ($scope, $http) { }); -/* Java script code for List Emails Ends here */ \ No newline at end of file +/* Java script code for List Emails Ends here */ diff --git a/static/serverStatus/serverStatus.js b/static/serverStatus/serverStatus.js index db70955a0..8a89159d6 100644 --- a/static/serverStatus/serverStatus.js +++ b/static/serverStatus/serverStatus.js @@ -3,7 +3,6 @@ */ - /* Java script code to start/stop litespeed */ app.controller('litespeedStatus', function ($scope, $http) { @@ -49,8 +48,7 @@ app.controller('litespeedStatus', function ($scope, $http) { $scope.actionResultBad = true; $scope.serverStatusCouldNotConnect = true; - } - else { + } else { $scope.restartorStopLoading = true; $scope.actionResult = true; @@ -109,8 +107,7 @@ app.controller('litespeedStatus', function ($scope, $http) { $scope.actionResultBad = true; $scope.serverStatusCouldNotConnect = true; - } - else { + } else { $scope.restartorStopLoading = true; $scope.actionResult = true; @@ -174,8 +171,7 @@ app.controller('litespeedStatus', function ($scope, $http) { }); $scope.lsSerial = response.data.lsSerial; $scope.lsexpiration = response.data.lsexpiration; - } - else { + } else { $scope.cpLoading = true; new PNotify({ title: 'Operation Failed!', @@ -229,8 +225,7 @@ app.controller('litespeedStatus', function ($scope, $http) { text: 'License successfully Updated', type: 'success' }); - } - else { + } else { $scope.cpLoading = true; new PNotify({ title: 'Operation Failed!', @@ -292,8 +287,7 @@ app.controller('readCyberCPLogFile', function ($scope, $http) { $scope.logsData = response.data.logsdata; - } - else { + } else { $scope.logFileLoading = true; $scope.logsFeteched = true; @@ -347,8 +341,7 @@ app.controller('readCyberCPLogFile', function ($scope, $http) { $scope.logsData = response.data.logsdata; - } - else { + } else { $scope.logFileLoading = true; $scope.logsFeteched = true; @@ -409,8 +402,7 @@ app.controller('servicesManager', function ($scope, $http) { $scope.olsStart = false; $scope.olsStop = true; $scope.olsMem = Math.round(parseInt(response.data.memUsage.litespeed) / 1048576) + " MB"; - } - else { + } else { $scope.olsStatus = "Stopped"; $scope.olsStats = false; $scope.olsStart = true; @@ -421,8 +413,7 @@ app.controller('servicesManager', function ($scope, $http) { $scope.dockerStatus = "Running"; $scope.dockerStart = false; $scope.dockerStop = true; - } - else { + } else { $scope.dockerStatus = "Stopped"; $scope.dockerStart = true; $scope.dockerStop = false; @@ -435,8 +426,7 @@ app.controller('servicesManager', function ($scope, $http) { $scope.sqlStart = false; $scope.sqlStop = true; $scope.sqlMem = Math.round(parseInt(response.data.memUsage.mysql) / 1048576) + " MB"; - } - else { + } else { $scope.sqlStatus = "Stopped"; $scope.sqlStats = false; $scope.sqlStart = true; @@ -451,8 +441,7 @@ app.controller('servicesManager', function ($scope, $http) { $scope.dnsStart = false; $scope.dnsStop = true; $scope.dnsMem = Math.round(parseInt(response.data.memUsage.powerdns) / 1048576) + " MB"; - } - else { + } else { $scope.dnsStatus = "Stopped"; $scope.dnsStats = false; $scope.dnsStart = true; @@ -467,8 +456,7 @@ app.controller('servicesManager', function ($scope, $http) { $scope.ftpStart = false; $scope.ftpStop = true; $scope.ftpMem = Math.round(parseInt(response.data.memUsage.pureftp) / 1048576) + " MB"; - } - else { + } else { $scope.ftpStatus = "Stopped"; $scope.ftpStats = false; $scope.ftpStart = true; @@ -487,6 +475,7 @@ app.controller('servicesManager', function ($scope, $http) { } } + getServiceStatus(); $scope.serviceAction = function (serviceName, action) { @@ -524,8 +513,7 @@ app.controller('servicesManager', function ($scope, $http) { $scope.actionLoader = false; $scope.btnDisable = false; }, 3000); - } - else { + } else { setTimeout(function () { getServiceStatus(); $scope.ActionSuccessfull = false; @@ -583,8 +571,7 @@ app.controller('lswsSwitch', function ($scope, $http, $timeout, $window) { if (response.data.status === 1) { $scope.installBoxGen = false; getRequestStatus(); - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -626,8 +613,7 @@ app.controller('lswsSwitch', function ($scope, $http, $timeout, $window) { if (response.data.abort === 0) { $scope.requestData = response.data.requestStatus; $timeout(getRequestStatus, 1000); - } - else { + } else { // Notifications $scope.cyberPanelLoading = true; $timeout.cancel(); @@ -720,8 +706,7 @@ app.controller('topProcesses', function ($scope, $http, $timeout) { $scope.zombieProcesses = response.data.zombieProcesses; $timeout($scope.topProcessesStatus, 3000); - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -771,8 +756,7 @@ app.controller('topProcesses', function ($scope, $http, $timeout) { text: 'Process successfully killed.', type: 'success' }); - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -793,4 +777,236 @@ app.controller('topProcesses', function ($scope, $http, $timeout) { }; +}); + +/// + + +app.controller('listOSPackages', function ($scope, $http, $timeout) { + + $scope.cyberpanelLoading = true; + + $scope.currentPage = 1; + $scope.recordsToShow = 10; + var globalType; + + $scope.fetchPackages = function (type = 'installed') { + $scope.cyberpanelLoading = false; + globalType = type; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + page: $scope.currentPage, + recordsToShow: $scope.recordsToShow, + type: type + }; + + dataurl = "/serverstatus/fetchPackages"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + $scope.allPackages = JSON.parse(response.data.packages); + $scope.pagination = response.data.pagination; + $scope.fetchedPackages = response.data.fetchedPackages; + $scope.totalPackages = response.data.totalPackages; + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + } + function cantLoadInitialData(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + + }; + $scope.fetchPackages('upgrade'); + + $scope.fetchPackageDetails = function (packageFetch) { + $scope.cyberpanelLoading = false; + $scope.package = packageFetch; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + package: packageFetch + }; + + dataurl = "/serverstatus/fetchPackageDetails"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + $scope.packageDetails = response.data.packageDetails; + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + } + function cantLoadInitialData(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + + }; + + $scope.updatePackage = function (packageToUpgrade = 'all') { + $scope.cyberpanelLoading = false; + $scope.package = packageToUpgrade; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + package: packageToUpgrade + }; + + dataurl = "/serverstatus/updatePackage"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + getRequestStatus(); + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + } + function cantLoadInitialData(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + + }; + + function getRequestStatus() { + + $scope.cyberpanelLoading = false; + + url = "/serverstatus/switchTOLSWSStatus"; + + var data = {}; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + if (response.data.abort === 0) { + $scope.requestData = response.data.requestStatus; + $timeout(getRequestStatus, 1000); + } else { + // Notifications + $timeout.cancel(); + $scope.cyberpanelLoading = true; + $scope.requestData = response.data.requestStatus; + } + } + + function cantLoadInitialDatas(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + } + + $scope.lockStatus = function (lockPackage, type) { + $scope.cyberpanelLoading = false; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + var data = { + package: lockPackage, + type: type, + }; + + dataurl = "/serverstatus/lockStatus"; + + $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); + + function ListInitialData(response) { + $scope.cyberpanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success!', + text: 'Status updated.', + type: 'success' + }); + $scope.fetchPackages(globalType); + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + } + function cantLoadInitialData(response) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + + }; + }); \ No newline at end of file diff --git a/static/userManagment/userManagment.js b/static/userManagment/userManagment.js index 39cbf5d6d..73eaed9a5 100644 --- a/static/userManagment/userManagment.js +++ b/static/userManagment/userManagment.js @@ -113,7 +113,7 @@ app.controller('createUserCtr', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.password = randomPassword(12); + $scope.password = randomPassword(16); }; $scope.usePassword = function () { @@ -342,7 +342,7 @@ app.controller('modifyUser', function ($scope, $http) { $scope.generatePassword = function () { $scope.generatedPasswordView = false; - $scope.password = randomPassword(12); + $scope.password = randomPassword(16); }; $scope.usePassword = function () { @@ -1744,4 +1744,4 @@ app.controller('listTableUsers', function ($scope, $http) { }); -/* Java script code to list table users */ \ No newline at end of file +/* Java script code to list table users */ diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js index 58c302260..f39798297 100644 --- a/static/websiteFunctions/websiteFunctions.js +++ b/static/websiteFunctions/websiteFunctions.js @@ -5836,7 +5836,7 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { $scope.autoCommitCurrent = response.data.autoCommitCurrent; $scope.autoPushCurrent = response.data.autoPushCurrent; $scope.emailLogsCurrent = response.data.emailLogsCurrent; - $scope.currentCommands = response.data.commands; + document.getElementById("currentCommands").value = response.data.commands; $scope.webhookCommandCurrent = response.data.webhookCommandCurrent; } else { $scope.gitTracking = false; @@ -6677,17 +6677,40 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { url = "/websites/saveGitConfigurations"; - var data = { domain: $("#domain").text(), folder: $scope.folder, autoCommit: $scope.autoCommit, autoPush: $scope.autoPush, emailLogs: $scope.emailLogs, - commands: $scope.commands, + commands: document.getElementById("currentCommands").value, webhookCommand: $scope.webhookCommand }; + if ($scope.autoCommit === undefined){ + $scope.autoCommitCurrent = 'Never'; + }else{ + $scope.autoCommitCurrent = $scope.autoCommit; + } + + if ($scope.autoPush === undefined){ + $scope.autoPushCurrent = 'Never'; + }else{ + $scope.autoPushCurrent = $scope.autoPush; + } + + if ($scope.emailLogs === undefined){ + $scope.emailLogsCurrent = false; + }else{ + $scope.emailLogsCurrent = $scope.emailLogs; + } + + if ($scope.webhookCommand === undefined){ + $scope.webhookCommandCurrent = false; + }else{ + $scope.webhookCommandCurrent = $scope.webhookCommand; + } + var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -6782,4 +6805,5 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { }; }); + /* Java script code to git tracking ends here */ diff --git a/test.sh b/test.sh old mode 100644 new mode 100755 index d9bdb6f94..e69de29bb --- a/test.sh +++ b/test.sh @@ -1,6 +0,0 @@ -test4 -<<<<<<< HEAD - -======= -test3 ->>>>>>> stable diff --git a/userManagment/views.py b/userManagment/views.py index 803d35e4f..0d7da486f 100755 --- a/userManagment/views.py +++ b/userManagment/views.py @@ -32,7 +32,6 @@ def loadUserHome(request): except KeyError: return redirect(loadLoginPage) - def viewProfile(request): try: userID = request.session['userID'] @@ -52,7 +51,6 @@ def viewProfile(request): except KeyError: return redirect(loadLoginPage) - def createUser(request): try: userID = request.session['userID'] @@ -74,7 +72,6 @@ def createUser(request): logging.CyberCPLogFileWriter.writeToFile(str(msg)) return redirect(loadLoginPage) - def apiAccess(request): try: userID = request.session['userID'] @@ -126,10 +123,16 @@ def submitUserCreation(request): try: try: - userID = request.session['userID'] - currentACL = ACLManager.loadedACL(userID) + try: + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + data = json.loads(request.body) + except: + userID = request['userID'] + data = request + currentACL = ACLManager.loadedACL(userID) + - data = json.loads(request.body) firstName = data['firstName'] lastName = data['lastName'] email = data['email'] @@ -137,6 +140,7 @@ def submitUserCreation(request): password = data['password'] websitesLimit = data['websitesLimit'] selectedACL = data['selectedACL'] + try: securityLevel = data['securityLevel'] except: @@ -248,7 +252,6 @@ def modifyUsers(request): except KeyError: return redirect(loadLoginPage) - def fetchUserDetails(request): try: val = request.session['userID'] @@ -309,66 +312,72 @@ def fetchUserDetails(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) - def saveModifications(request): try: - val = request.session['userID'] try: - if request.method == 'POST': + val = request.session['userID'] + except: + val = request['userID'] + try: + try: data = json.loads(request.body) - accountUsername = data['accountUsername'] - firstName = data['firstName'] - lastName = data['lastName'] - email = data['email'] - try: - securityLevel = data['securityLevel'] - except: - securityLevel = 'HIGH' + except: + data = request - user = Administrator.objects.get(userName=accountUsername) + accountUsername = data['accountUsername'] + firstName = data['firstName'] + lastName = data['lastName'] + email = data['email'] + try: + securityLevel = data['securityLevel'] + except: + securityLevel = 'HIGH' - currentACL = ACLManager.loadedACL(val) - loggedUser = Administrator.objects.get(pk=val) + user = Administrator.objects.get(userName=accountUsername) - if currentACL['admin'] == 1: - pass - elif user.owner == loggedUser.pk: - pass - elif user.pk == loggedUser.pk: - pass - else: - data_ret = {'fetchStatus': 0, 'error_message': 'Un-authorized access.'} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + currentACL = ACLManager.loadedACL(val) + loggedUser = Administrator.objects.get(pk=val) - token = hashPassword.generateToken(accountUsername, data['passwordByPass']) - password = hashPassword.hash_password(data['passwordByPass']) - - user.firstName = firstName - user.lastName = lastName - user.email = email - user.password = password - user.token = token - user.type = 0 - - if securityLevel == 'LOW': - user.securityLevel = secMiddleware.LOW - else: - user.securityLevel = secMiddleware.HIGH - - user.save() - - adminEmailPath = '/home/cyberpanel/adminEmail' - - if accountUsername == 'admin': - writeToFile = open(adminEmailPath, 'w') - writeToFile.write(email) - writeToFile.close() - - data_ret = {'status': 1, 'saveStatus': 1, 'error_message': 'None'} + if currentACL['admin'] == 1: + pass + elif user.owner == loggedUser.pk: + pass + elif user.pk == loggedUser.pk: + pass + else: + data_ret = {'fetchStatus': 0, 'error_message': 'Un-authorized access.'} json_data = json.dumps(data_ret) return HttpResponse(json_data) + token = hashPassword.generateToken(accountUsername, data['passwordByPass']) + password = hashPassword.hash_password(data['passwordByPass']) + + user.firstName = firstName + user.lastName = lastName + user.email = email + user.password = password + user.token = token + user.type = 0 + + if securityLevel == 'LOW': + user.securityLevel = secMiddleware.LOW + else: + user.securityLevel = secMiddleware.HIGH + + user.save() + + adminEmailPath = '/home/cyberpanel/adminEmail' + + if accountUsername == 'admin': + writeToFile = open(adminEmailPath, 'w') + writeToFile.write(email) + writeToFile.close() + + data_ret = {'status': 1, 'saveStatus': 1, 'error_message': 'None'} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)} json_data = json.dumps(data_ret) @@ -379,7 +388,6 @@ def saveModifications(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) - def deleteUser(request): try: userID = request.session['userID'] @@ -398,38 +406,45 @@ def deleteUser(request): except KeyError: return redirect(loadLoginPage) - def submitUserDeletion(request): + try: - userID = request.session['userID'] + try: + userID = request.session['userID'] + except: + userID = request['userID'] try: - if request.method == 'POST': + try: data = json.loads(request.body) - accountUsername = data['accountUsername'] + except: + data = request - currentACL = ACLManager.loadedACL(userID) + accountUsername = data['accountUsername'] - currentUser = Administrator.objects.get(pk=userID) - userInQuestion = Administrator.objects.get(userName=accountUsername) + currentACL = ACLManager.loadedACL(userID) - if ACLManager.checkUserOwnerShip(currentACL, currentUser, userInQuestion): - user = Administrator.objects.get(userName=accountUsername) + currentUser = Administrator.objects.get(pk=userID) + userInQuestion = Administrator.objects.get(userName=accountUsername) - childUsers = Administrator.objects.filter(owner=user.pk) + if ACLManager.checkUserOwnerShip(currentACL, currentUser, userInQuestion): + user = Administrator.objects.get(userName=accountUsername) - for items in childUsers: - items.delete() + childUsers = Administrator.objects.filter(owner=user.pk) - user.delete() + for items in childUsers: + items.delete() + + user.delete() + + data_ret = {'status': 1, 'deleteStatus': 1, 'error_message': 'None'} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + else: + data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': 'Not enough privileges.'} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) - data_ret = {'status': 1, 'deleteStatus': 1, 'error_message': 'None'} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - else: - data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': 'Not enough privileges.'} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) except BaseException as msg: data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)} @@ -441,7 +456,6 @@ def submitUserDeletion(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) - def createNewACL(request): try: userID = request.session['userID'] @@ -454,7 +468,6 @@ def createNewACL(request): except KeyError: return redirect(loadLoginPage) - def createACLFunc(request): try: val = request.session['userID'] @@ -547,7 +560,6 @@ def createACLFunc(request): json_data = json.dumps(finalResponse) return HttpResponse(json_data) - def deleteACL(request): try: userID = request.session['userID'] @@ -561,7 +573,6 @@ def deleteACL(request): except KeyError: return redirect(loadLoginPage) - def deleteACLFunc(request): try: val = request.session['userID'] @@ -588,7 +599,6 @@ def deleteACLFunc(request): json_data = json.dumps(finalResponse) return HttpResponse(json_data) - def modifyACL(request): try: userID = request.session['userID'] @@ -602,7 +612,6 @@ def modifyACL(request): except KeyError: return redirect(loadLoginPage) - def fetchACLDetails(request): try: val = request.session['userID'] @@ -694,7 +703,6 @@ def fetchACLDetails(request): json_data = json.dumps(finalResponse) return HttpResponse(json_data) - def submitACLModifications(request): try: val = request.session['userID'] @@ -800,7 +808,6 @@ def submitACLModifications(request): json_data = json.dumps(finalResponse) return HttpResponse(json_data) - def changeUserACL(request): try: userID = request.session['userID'] @@ -822,7 +829,6 @@ def changeUserACL(request): except KeyError: return redirect(loadLoginPage) - def changeACLFunc(request): try: val = request.session['userID'] @@ -863,7 +869,6 @@ def changeACLFunc(request): json_data = json.dumps(finalResponse) return HttpResponse(json_data) - def resellerCenter(request): try: userID = request.session['userID'] @@ -886,7 +891,6 @@ def resellerCenter(request): except KeyError: return redirect(loadLoginPage) - def saveResellerChanges(request): try: val = request.session['userID'] @@ -943,7 +947,6 @@ def saveResellerChanges(request): json_data = json.dumps(finalResponse) return HttpResponse(json_data) - def listUsers(request): try: userID = request.session['userID'] @@ -976,10 +979,12 @@ def listUsers(request): except KeyError: return redirect(loadLoginPage) - def fetchTableUsers(request): try: - userID = request.session['userID'] + try: + userID = request.session['userID'] + except: + userID = request['userID'] currentACL = ACLManager.loadedACL(userID) @@ -1028,50 +1033,57 @@ def fetchTableUsers(request): def controlUserState(request): try: - val = request.session['userID'] try: - if request.method == 'POST': + val = request.session['userID'] + except: + val = request['userID'] + try: + try: data = json.loads(request.body) - accountUsername = data['accountUsername'] - state = data['state'] + except: + data = request - user = Administrator.objects.get(userName=accountUsername) + accountUsername = data['accountUsername'] + state = data['state'] - currentACL = ACLManager.loadedACL(val) - loggedUser = Administrator.objects.get(pk=val) + user = Administrator.objects.get(userName=accountUsername) - if currentACL['admin'] == 1: - pass - elif user.owner == loggedUser.pk: - pass - elif user.pk == loggedUser.pk: - pass - else: - data_ret = {'fetchStatus': 0, 'error_message': 'Un-authorized access.'} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + currentACL = ACLManager.loadedACL(val) + loggedUser = Administrator.objects.get(pk=val) - if state == 'SUSPEND': - user.state = 'SUSPENDED' - else: - user.state = 'ACTIVE' - - user.save() - - extraArgs = {} - extraArgs['user'] = user - extraArgs['currentACL'] = ACLManager.loadedACL(user.pk) - extraArgs['state'] = state - - from userManagment.userManager import UserManager - - um = UserManager('controlUserState', extraArgs) - um.start() - - data_ret = {'status': 1} + if currentACL['admin'] == 1: + pass + elif user.owner == loggedUser.pk: + pass + elif user.pk == loggedUser.pk: + pass + else: + data_ret = {'fetchStatus': 0, 'error_message': 'Un-authorized access.'} json_data = json.dumps(data_ret) return HttpResponse(json_data) + if state == 'SUSPEND': + user.state = 'SUSPENDED' + else: + user.state = 'ACTIVE' + + user.save() + + extraArgs = {} + extraArgs['user'] = user + extraArgs['currentACL'] = ACLManager.loadedACL(user.pk) + extraArgs['state'] = state + + from userManagment.userManager import UserManager + + um = UserManager('controlUserState', extraArgs) + um.start() + + data_ret = {'status': 1} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)} json_data = json.dumps(data_ret) diff --git a/version.txt b/version.txt index ca1e53142..c085faed0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -{"version":"2.0","build":0} \ No newline at end of file +{"version":"2.0","build":1} \ No newline at end of file diff --git a/websiteFunctions/StagingSetup.py b/websiteFunctions/StagingSetup.py index 2084337e2..df6979ca6 100644 --- a/websiteFunctions/StagingSetup.py +++ b/websiteFunctions/StagingSetup.py @@ -36,12 +36,17 @@ class StagingSetup(multi.Thread): website = Websites.objects.get(domain=masterDomain) + masterPath = '/home/%s/public_html' % (masterDomain) + + command = 'chmod 755 %s' % (masterPath) + ProcessUtilities.executioner(command) + ## Creating Child Domain path = "/home/" + masterDomain + "/public_html/" + domain logging.statusWriter(tempStatusPath, 'Creating domain for staging environment..,5') - phpSelection = 'PHP 7.1' + phpSelection = 'PHP 7.2' execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " createDomain --masterDomain " + masterDomain + " --virtualHostName " + domain + \ @@ -57,18 +62,37 @@ class StagingSetup(multi.Thread): if data.find('[200]') > -1: pass else: - logging.statusWriter(tempStatusPath, 'Failed to create child-domain for staging enviroment. [404]') + logging.statusWriter(tempStatusPath, 'Failed to create child-domain for staging environment. [404]') return 0 logging.statusWriter(tempStatusPath, 'Domain successfully created..,15') ## Copying Data - masterPath = '/home/%s/public_html' % (masterDomain) + ## Fetch child domain path + + childDomainPaths = [] + + for childs in website.childdomains_set.all(): + childDomainPaths.append(childs.path) + + filesAndFolder = os.listdir(masterPath) + + for items in filesAndFolder: + completePath = '%s/%s' % (masterPath, items) + + if completePath in childDomainPaths: + continue + else: + command = 'cp -r %s %s/' % (completePath, path) + ProcessUtilities.executioner(command, website.externalApp) + + foldersToBeRemoved = ['%s/.git' % (path), '%s/wp-content/backups' % (path), '%s/wp-content/updraft' % (path), '%s/wp-content/cache' % (path), '%s/wp-content/plugins/litespeed-cache' % (path)] + + for rmv in foldersToBeRemoved: + command = 'rm -rf %s' % (rmv) + ProcessUtilities.executioner(command, website.externalApp) - command = 'rsync -avzh --exclude "%s" --exclude "wp-content/backups" --exclude "wp-content/updraft" --exclude "wp-content/cache" --exclude "wp-content/plugins/litespeed-cache" %s/ %s' % ( - domain, masterPath, path) - ProcessUtilities.executioner(command, website.externalApp) logging.statusWriter(tempStatusPath, 'Data copied..,50') @@ -82,14 +106,18 @@ class StagingSetup(multi.Thread): configPath = '%s/wp-config.php' % (masterPath) - if not os.path.exists(configPath): + command = 'ls -la %s' % (configPath) + output = ProcessUtilities.outputExecutioner(command) + + if output.find('No such file or') > -1: logging.statusWriter(tempStatusPath, 'WordPress is not detected. [404]') return 0 - data = open(configPath, 'r').readlines() + command = 'cat %s' % (configPath) + data = ProcessUtilities.outputExecutioner(command).split('\n') for items in data: - if items.find('DB_NAME') > -1: + if items.find('DB_NAME') > -1 and items[0] != '/': try: dbName = items.split("'")[3] if mysqlUtilities.createDatabaseBackup(dbName, '/home/cyberpanel'): @@ -105,11 +133,6 @@ class StagingSetup(multi.Thread): databasePath = '%s/%s.sql' % ('/home/cyberpanel', dbName) - command = "sed -i 's/%s/%s/g' %s" % (masterDomain, domain, databasePath) - ProcessUtilities.executioner(command, 'cyberpanel') - command = "sed -i 's/%s/%s/g' %s" % ('https', 'http', databasePath) - ProcessUtilities.executioner(command, 'cyberpanel') - if not mysqlUtilities.restoreDatabaseBackup(dbNameRestore, '/home/cyberpanel', None, 1, dbName): try: os.remove(databasePath) @@ -125,22 +148,31 @@ class StagingSetup(multi.Thread): ## Update final config file pathFinalConfig = '%s/wp-config.php' % (path) - data = open(pathFinalConfig, 'r').readlines() + + command = 'cat %s' % (configPath) + data = ProcessUtilities.outputExecutioner(command).split('\n') tmp = "/tmp/" + str(randint(1000, 9999)) writeToFile = open(tmp, 'w') for items in data: if items.find('DB_NAME') > -1: - writeToFile.write("define( 'DB_NAME', '%s' );\n" % (dbNameRestore)) + writeToFile.write("\ndefine( 'DB_NAME', '%s' );\n" % (dbNameRestore)) elif items.find('DB_USER') > -1: - writeToFile.write("define( 'DB_USER', '%s' );\n" % (dbUser)) + writeToFile.write("\ndefine( 'DB_USER', '%s' );\n" % (dbUser)) elif items.find('DB_PASSWORD') > -1: - writeToFile.write("define( 'DB_PASSWORD', '%s' );\n" % (dbPassword)) + writeToFile.write("\ndefine( 'DB_PASSWORD', '%s' );\n" % (dbPassword)) elif items.find('WP_SITEURL') > -1: continue + elif items.find("table_prefix") > -1: + writeToFile.writelines(items) + content = """ +define('WP_HOME','http://%s'); +define('WP_SITEURL','http://%s'); +""" % (domain, domain) + writeToFile.write(content) else: - writeToFile.write(items) + writeToFile.write(items + '\n') writeToFile.close() @@ -157,6 +189,14 @@ class StagingSetup(multi.Thread): except: pass + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(masterDomain) + + from plogical.installUtilities import installUtilities + installUtilities.reStartLiteSpeed() + logging.statusWriter(tempStatusPath, 'Data copied..,[200]') return 0 @@ -174,7 +214,11 @@ class StagingSetup(multi.Thread): child = ChildDomains.objects.get(domain=childDomain) + command = 'chmod 755 /home/%s/public_html' % (child.master.domain) + ProcessUtilities.executioner(command) + configPath = '%s/wp-config.php' % (child.path) + if not os.path.exists(configPath): logging.statusWriter(tempStatusPath, 'WordPress is not detected. [404]') return 0 @@ -189,7 +233,7 @@ class StagingSetup(multi.Thread): data = open(configPath, 'r').readlines() for items in data: - if items.find('DB_NAME') > -1: + if items.find('DB_NAME') > -1 and items[0] != '/': dbName = items.split("'")[3] if mysqlUtilities.createDatabaseBackup(dbName, '/home/cyberpanel'): break @@ -197,8 +241,6 @@ class StagingSetup(multi.Thread): raise BaseException('Failed to create database backup.') databasePath = '%s/%s.sql' % ('/home/cyberpanel', dbName) - command = "sed -i 's/%s/%s/g' %s" % (child.domain, child.master.domain, databasePath) - ProcessUtilities.executioner(command, 'cyberpanel') ## Restore to master domain @@ -209,7 +251,7 @@ class StagingSetup(multi.Thread): data = open(configPath, 'r').readlines() for items in data: - if items.find('DB_NAME') > -1: + if items.find('DB_NAME') > -1 and items[0] != '/': dbNameRestore = items.split("'")[3] if not mysqlUtilities.restoreDatabaseBackup(dbNameRestore, '/home/cyberpanel', None, 1, dbName): try: @@ -222,7 +264,6 @@ class StagingSetup(multi.Thread): os.remove(databasePath) except: pass - if eraseCheck: sourcePath = child.path destinationPath = '/home/%s/public_html' % (child.master.domain) @@ -236,6 +277,14 @@ class StagingSetup(multi.Thread): command = 'rsync -avzh --exclude "wp-config.php" %s/ %s' % (sourcePath, destinationPath) ProcessUtilities.executioner(command, child.master.externalApp) + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(child.master.domain) + + from plogical.installUtilities import installUtilities + installUtilities.reStartLiteSpeed() + logging.statusWriter(tempStatusPath, 'Data copied..,[200]') return 0 diff --git a/websiteFunctions/models.py b/websiteFunctions/models.py index 9206d125d..ff4a5aea2 100755 --- a/websiteFunctions/models.py +++ b/websiteFunctions/models.py @@ -8,7 +8,6 @@ from datetime import datetime # Create your models here. - class Websites(models.Model): admin = models.ForeignKey(Administrator, on_delete=models.PROTECT) package = models.ForeignKey(Package, on_delete=models.PROTECT) @@ -26,24 +25,20 @@ class ChildDomains(models.Model): ssl = models.IntegerField() phpSelection = models.CharField(max_length=10,default=None) - class Backups(models.Model): website = models.ForeignKey(Websites,on_delete=models.CASCADE) - fileName = models.CharField(max_length=50) + fileName = models.CharField(max_length=200) date = models.CharField(max_length=50) size = models.CharField(max_length=50) status = models.IntegerField(default=0) - class dest(models.Model): destLoc = models.CharField(unique=True,max_length=18) - class backupSchedules(models.Model): dest = models.ForeignKey(dest, on_delete=models.CASCADE) frequency = models.CharField(max_length=15) - class aliasDomains(models.Model): master = models.ForeignKey(Websites, on_delete=models.CASCADE) aliasDomain = models.CharField(max_length=75) @@ -54,4 +49,15 @@ class GitLogs(models.Model): type = models.CharField(max_length=5) message = models.TextField(max_length=65532) +class BackupJob(models.Model): + logFile = models.CharField(max_length=1000) + ipAddress = models.CharField(max_length=50) + port = models.CharField(max_length=15) + jobSuccessSites = models.IntegerField() + jobFailedSites = models.IntegerField() + location = models.IntegerField() +class BackupJobLogs(models.Model): + owner = models.ForeignKey(BackupJob, on_delete=models.CASCADE) + status = models.IntegerField() + message = models.TextField() \ No newline at end of file diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 58c302260..f39798297 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -5836,7 +5836,7 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { $scope.autoCommitCurrent = response.data.autoCommitCurrent; $scope.autoPushCurrent = response.data.autoPushCurrent; $scope.emailLogsCurrent = response.data.emailLogsCurrent; - $scope.currentCommands = response.data.commands; + document.getElementById("currentCommands").value = response.data.commands; $scope.webhookCommandCurrent = response.data.webhookCommandCurrent; } else { $scope.gitTracking = false; @@ -6677,17 +6677,40 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { url = "/websites/saveGitConfigurations"; - var data = { domain: $("#domain").text(), folder: $scope.folder, autoCommit: $scope.autoCommit, autoPush: $scope.autoPush, emailLogs: $scope.emailLogs, - commands: $scope.commands, + commands: document.getElementById("currentCommands").value, webhookCommand: $scope.webhookCommand }; + if ($scope.autoCommit === undefined){ + $scope.autoCommitCurrent = 'Never'; + }else{ + $scope.autoCommitCurrent = $scope.autoCommit; + } + + if ($scope.autoPush === undefined){ + $scope.autoPushCurrent = 'Never'; + }else{ + $scope.autoPushCurrent = $scope.autoPush; + } + + if ($scope.emailLogs === undefined){ + $scope.emailLogsCurrent = false; + }else{ + $scope.emailLogsCurrent = $scope.emailLogs; + } + + if ($scope.webhookCommand === undefined){ + $scope.webhookCommandCurrent = false; + }else{ + $scope.webhookCommandCurrent = $scope.webhookCommand; + } + var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -6782,4 +6805,5 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) { }; }); + /* Java script code to git tracking ends here */ diff --git a/websiteFunctions/templates/websiteFunctions/listChildDomains.html b/websiteFunctions/templates/websiteFunctions/listChildDomains.html index 668a9e0e6..518a976e6 100755 --- a/websiteFunctions/templates/websiteFunctions/listChildDomains.html +++ b/websiteFunctions/templates/websiteFunctions/listChildDomains.html @@ -41,7 +41,7 @@ style="padding: 0px; box-shadow: 0px 0px 1px 0px #888888;">
    -
    -
    + class="col-lg-3 col-md-12">
    diff --git a/websiteFunctions/templates/websiteFunctions/manageGIT.html b/websiteFunctions/templates/websiteFunctions/manageGIT.html index 27ba5e006..d8558cc46 100755 --- a/websiteFunctions/templates/websiteFunctions/manageGIT.html +++ b/websiteFunctions/templates/websiteFunctions/manageGIT.html @@ -189,8 +189,7 @@
    -
    Currently: {$ autoCommitCurrent - $} +
    Currently: {$ autoCommitCurrent $}
    @@ -234,10 +233,9 @@
    - + class="form-control">
    diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html index cf06c807e..8363ce89a 100755 --- a/websiteFunctions/templates/websiteFunctions/website.html +++ b/websiteFunctions/templates/websiteFunctions/website.html @@ -303,7 +303,7 @@
    - +
    diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 0b1f89663..f4ee953e0 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -285,9 +285,9 @@ class WebsiteManager: if len(path) > 0: path = path.lstrip("/") - path = "/home/" + masterDomain + "/public_html/" + path + path = "/home/" + masterDomain + "/" + path else: - path = "/home/" + masterDomain + "/public_html/" + domain + path = "/home/" + masterDomain + "/" + domain try: apacheBackend = str(data['apacheBackend']) @@ -1367,7 +1367,7 @@ class WebsiteManager: CronUtil.CronPrem(0) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: cronPath = "/var/spool/cron/" + website.externalApp else: cronPath = "/var/spool/cron/crontabs/" + website.externalApp @@ -1586,7 +1586,7 @@ class WebsiteManager: website = Websites.objects.get(domain=self.domain) - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: cronPath = "/var/spool/cron/" + website.externalApp else: cronPath = "/var/spool/cron/crontabs/" + website.externalApp @@ -1605,7 +1605,7 @@ class WebsiteManager: output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) - if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20: command = 'chmod 600 %s' % (cronPath) ProcessUtilities.executioner(command) @@ -2760,14 +2760,11 @@ StrictHostKeyChecking no writeToFile.write(message) writeToFile.close() - extraArgs['tempStatusPath'] = tempStatusPath st = StagingSetup('startCloning', extraArgs) st.start() - - data_ret = {'status': 1, 'error_message': 'None', 'tempStatusPath': tempStatusPath} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3181,6 +3178,13 @@ StrictHostKeyChecking no self.folder, self.firstName, self.lastName) ProcessUtilities.executioner(command) + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3218,7 +3222,23 @@ StrictHostKeyChecking no else: return ACLManager.loadErrorJson() - if validators.domain(self.gitHost) and ACLManager.validateInput(self.gitUsername) and ACLManager.validateInput(self.gitReponame): + if self.gitHost.find(':') > -1: + gitHostDomain = self.gitHost.split(':')[0] + gitHostPort = self.gitHost.split(':')[1] + + if not validators.domain(gitHostDomain): + return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') + + try: + gitHostPort = int(gitHostPort) + except: + return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') + + else: + if not validators.domain(self.gitHost): + return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') + + if ACLManager.validateInput(self.gitUsername) and ACLManager.validateInput(self.gitReponame): pass else: return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') @@ -3248,6 +3268,14 @@ StrictHostKeyChecking no remoteResult = ProcessUtilities.outputExecutioner(command) if remoteResult.find(self.gitUsername) > -1: + + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3298,6 +3326,14 @@ StrictHostKeyChecking no commandStatus = ProcessUtilities.outputExecutioner(command) if commandStatus.find('Switched to branch') > -1: + + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1, 'commandStatus': commandStatus + 'Refreshing page in 3 seconds..'} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3344,6 +3380,15 @@ StrictHostKeyChecking no commandStatus = ProcessUtilities.outputExecutioner(command) if commandStatus.find(self.newBranchName) > -1: + + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + + data_ret = {'status': 1, 'commandStatus': commandStatus} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3425,6 +3470,13 @@ StrictHostKeyChecking no except: pass + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1, 'commandStatus': commandStatus} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3471,6 +3523,14 @@ StrictHostKeyChecking no commandStatus = ProcessUtilities.outputExecutioner(command) if commandStatus.find('Already up to date') == -1: + + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1, 'commandStatus': commandStatus} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -3569,11 +3629,25 @@ StrictHostKeyChecking no else: return ACLManager.loadErrorJson() - logging.CyberCPLogFileWriter.writeToFile('hello world 2') + if self.gitHost.find(':') > -1: + gitHostDomain = self.gitHost.split(':')[0] + gitHostPort = self.gitHost.split(':')[1] + + if not validators.domain(gitHostDomain): + return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') + + try: + gitHostPort = int(gitHostPort) + except: + return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') + else: + if not validators.domain(self.gitHost): + return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') + ## Security check - if validators.domain(self.gitHost) and ACLManager.validateInput(self.gitUsername) and ACLManager.validateInput(self.gitReponame): + if ACLManager.validateInput(self.gitUsername) and ACLManager.validateInput(self.gitReponame): pass else: return ACLManager.loadErrorJson('status', 'Invalid characters in your input.') @@ -3658,6 +3732,13 @@ StrictHostKeyChecking no command = 'rm -rf %s' % (finalFile) ProcessUtilities.outputExecutioner(command) + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -4143,6 +4224,13 @@ StrictHostKeyChecking no except: pass + ## Fix permissions + + from filemanager.filemanager import FileManager + + fm = FileManager(None, None) + fm.fixPermissions(self.masterDomain) + data_ret = {'status': 1, 'commandStatus': commandStatus} json_data = json.dumps(data_ret) return HttpResponse(json_data)