reformat code

*  add security stack for futur usage
* fix pep8 formatting issues
This commit is contained in:
VirtuBox
2019-04-29 00:45:02 +02:00
parent 8a29383ea8
commit 264d014c5d
7 changed files with 15 additions and 10 deletions

View File

@@ -35,6 +35,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- MySQL monitoring with Netdata
- WordOps-dashboard on 22222
- Extplorer filemanager
- Enable OSCP Stapling with Let's Encrypt
- Compress database backup with pigz before updating sites
#### Changed

View File

@@ -14,7 +14,8 @@
<a href="https://travis-ci.org/WordOps/WordOps"><img src="https://travis-ci.org/WordOps/WordOps.svg?branch=master" alt="build"></a>
<img src="https://img.shields.io/github/license/wordops/wordops.svg" alt="MIT">
<img src="https://img.shields.io/github/last-commit/wordops/wordops.svg" alt="Commits">
<img alt="GitHub release" src="https://img.shields.io/github/release-pre/wordops/wordops.svg">
<img alt="GitHub release" src="https://img.shields.io/github/release/WordOps/WordOps.svg">
<a href="https://www.codacy.com/app/VirtuBox/WordOps?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=WordOps/WordOps&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/fe9100fd2c634de7882ecec17f00a11a"/></a>
</p>
<p align="center">

View File

@@ -178,7 +178,7 @@ wo_install_dep() {
if [ "$wo_linux_distro" == "Ubuntu" ]; then
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 cron ccze rsync tree haveged ufw > /dev/null 2>&1
else
wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
[ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; }
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install build-essential curl gzip dirmngr sudo python3 python3-apt python3-setuptools python3-dev ca-certificates sqlite3 git tar software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw > /dev/null 2>&1
fi

View File

@@ -38,7 +38,7 @@ except Exception as e:
print("Your informations will ONLY be stored locally")
wo_user = input("Enter your name: ")
while wo_user is "":
while wo_user == "":
print("Unfortunately, this can't be left blank")
wo_user = input("Enter your name: ")

View File

@@ -697,7 +697,9 @@ def sitebackup(self, data):
if data['wo_db_name']:
Log.info(self, 'Backing up database \t\t', end='')
try:
if not WOShellExec.cmd_exec(self, "mysqldump --single-transaction {0} | pigz -9 -p\"$(nproc)\" > {1}/{0}.gz"
if not WOShellExec.cmd_exec(self, "mysqldump --single-transaction "
"{0} | pigz -9 -p\"$(nproc)\" "
"> {1}/{0}.gz"
.format(data['wo_db_name'],
backup_path)):
Log.info(self,

View File

@@ -1159,7 +1159,7 @@ class WOStackController(CementBaseController):
WOFileUtils.searchreplace(self, "{0}22222/htdocs/index.php"
.format(WOVariables.wo_webroot),
"eth0",
"{0}".format(WOVariables.wo_wan_interface))
"{0}".format(WOVariables.wo_wan))
Log.debug(self, "Setting Privileges to "
"{0}22222/htdocs"

View File

@@ -22,11 +22,11 @@ class WOVariables():
wo_wpcli_path = '/usr/local/bin/wp '
# get wan network interface name
wo_wan_interface = os.popen("ip -4 route get 8.8.8.8 | "
"grep -oP \"dev [^[:space:]]+ \" "
"| cut -d ' ' -f 2").read()
if wo_wan_interface == '':
wo_wan_interface = 'eth0'
wo_wan = os.popen("/sbin/ip -4 route get 8.8.8.8 | "
"grep -oP \"dev [^[:space:]]+ \" "
"| cut -d ' ' -f 2").read()
if wo_wan == '':
wo_wan = 'eth0'
# Current date and time of System
wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')