mirror of https://github.com/WordOps/WordOps
Merge pull request #174 from WordOps/updating-configuration
Updating configuration
This commit is contained in:
commit
8211a3af49
|
@ -0,0 +1,39 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Documents
|
||||
*.md text
|
||||
*.tex text diff=tex
|
||||
*.adoc text
|
||||
*.textile text
|
||||
*.mustache text
|
||||
*.csv text
|
||||
*.tab text
|
||||
*.tsv text
|
||||
*.txt text
|
||||
*.sql text
|
||||
|
||||
# Scripts
|
||||
*.bash text eol=lf
|
||||
*.fish text eol=lf
|
||||
*.sh text eol=lf
|
||||
|
||||
# Source files
|
||||
# ============
|
||||
*.pxd text diff=python
|
||||
*.py text diff=python
|
||||
*.py3 text diff=python
|
||||
*.pyc text diff=python
|
||||
*.pyd text diff=python
|
||||
*.pyo text diff=python
|
||||
*.pyw text diff=python
|
||||
*.pyx text diff=python
|
||||
*.pyz text diff=python
|
||||
|
||||
|
||||
#
|
||||
# Exclude files from exporting
|
||||
#
|
||||
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
|
@ -1,25 +0,0 @@
|
|||
name: CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Prepare VM
|
||||
run: |
|
||||
unset LANG
|
||||
sudo apt update -qq
|
||||
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y
|
||||
sudo apt-get -qq purge graphviz* redis*
|
||||
sudo apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree
|
||||
sudo apt-get -qq autoremove --purge
|
||||
sudo mkdir -p /etc/mysql/conf.d
|
||||
echo -e '[client]\nuser = root\npassword = root\n' | sudo tee /etc/mysql/conf.d/my.cnf
|
||||
- name: Install WordOps
|
||||
run: sudo timeout 1800 bash install --travis
|
||||
- name: Run tests
|
||||
run: sudo timeout 1800 bash tests/travis.sh --actions
|
|
@ -1,10 +1,9 @@
|
|||
sudo: required
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
|
||||
language: bash
|
||||
|
||||
notifications:
|
||||
slack: wordops:MyZBNbI7JfhbAi3YyFckMdaa
|
||||
webhooks:
|
||||
secure: "JiGtzYplTyFg/L6Rsi7ptEQIV29O5qCWU2Zf5pLITsQrBrQO4cIXXp9G4Z+cenXjfIiqbqIgU0US3zXeIAl4g14xdfzmMYeMMwuKBpI8afMYv8MD6ldoP0MTFHQfROE6OXxKLVUvZn1R0oLLU1fzVSI0qGjNkt20cf/Lrt/reH/zS5hAI92kWI3u2zPu7Zn/g/a8MO/Y3Iv7v1PSQaVkVJVqtOK3U2GJqhIv2G1AVcaPb7Nh/V2zm2dDYBVT0UotBnlBUcUXbEMP77D9pjtWXd1/0rWuJIHixMjwUybpZqY75UMee5INynU6OZRsv029LRHAIMkWhfBkdVN/U5jhQJzui14+vRQrb5nfUMG8Cd8INojDlu6dk/ps2GzTCCXBITeMQKAouUoHD2LEbsNp17xi1K4ZlKb3+0lrOAiS4JYFE6wOo4yMlLTYoquYSqk7AuxuUS8A5OD5MYxhk9uafiTSxKFOo39KYWTSaACsPD8q1swaTSjoYm9skyZvIkIFq5bHBCYEGFe6X/NY9l5tz3hSe+TJOerCHsg+dXVuQl+pIp5nw2as9TH9ox5Vgqc9Zh4GbTDQVvdAmUpmlsZ/SKoOMCkmkB1aRNFq/7RnERIJyAEGJbauHWmjtOM4cCxesl0L0b2Eab89zQpSn7pzE8JTiJgpzCUc22p653PTaqM="
|
||||
|
||||
|
@ -22,15 +21,15 @@ before_script:
|
|||
- sudo rm -rf /etc/mysql
|
||||
- sudo bash -c 'echo example.com > /etc/hostname'
|
||||
- unset LANG
|
||||
- sudo apt-get update --allow-releaseinfo-change -qq
|
||||
- sudo apt-get -qq purge mysql* graphviz* redis*
|
||||
- sudo apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree
|
||||
- sudo apt-get -qq autoremove --purge
|
||||
|
||||
|
||||
after_script:
|
||||
- sudo cat /var/log/wo/test.log | ccze -A -p syslog
|
||||
- sudo cat /var/log/wo/install.log | ccze -A -p syslog
|
||||
- sudo bash install --purge
|
||||
- sudo curl --progress-bar --upload-file /var/log/wo/wordops.log https://transfer.vtbox.net/"$(basename wordops.log)" && echo "" | sudo tee -a $HOME/.transfer.log && echo ""
|
||||
|
||||
|
||||
script:
|
||||
|
|
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -8,6 +8,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
|
||||
### v3.9.x - [Unreleased]
|
||||
|
||||
### v3.9.9.3 - [Unreleased]
|
||||
|
||||
#### Added
|
||||
|
||||
- [STACK] Add Nginx TLS 1.3 0-RTT configuration
|
||||
|
||||
#### Changed
|
||||
|
||||
- [STACK] New Nginx package built with OpenSSL_1.1.1d and the latest ngx_brotli module
|
||||
|
||||
#### Fixed
|
||||
|
||||
- `wo stack upgrade` when using nginx-ee
|
||||
- `wo secure --auth`
|
||||
- `wo secure --sshport` not working with default ssh config
|
||||
- Issues after APT repositories informations changed
|
||||
- `www` was added to WordPress site url with subdomains [Issue #178](https://github.com/WordOps/WordOps/issues/178)
|
||||
- Issuing certificate with acme.sh for sub.sub-domains not working
|
||||
|
||||
### v3.9.9.2 - 2019-10-04
|
||||
|
||||
#### Added
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import configparser
|
||||
import os
|
||||
import re
|
||||
|
|
180
install
180
install
|
@ -9,7 +9,7 @@
|
|||
# -------------------------------------------------------------------------
|
||||
# wget -qO wo wops.cc && sudo bash wo
|
||||
# -------------------------------------------------------------------------
|
||||
# Version 3.9.9.1 - 2019-09-27
|
||||
# Version 3.9.9.3 - 2019-10-14
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# CONTENTS
|
||||
|
@ -62,8 +62,9 @@ while [ "$#" -gt 0 ]; do
|
|||
wo_branch="$2"
|
||||
shift
|
||||
;;
|
||||
-p | --preserve)
|
||||
wo_preserve_config="y"
|
||||
-v | --version)
|
||||
wo_version="$2"
|
||||
shift
|
||||
;;
|
||||
--force)
|
||||
wo_force_install="y"
|
||||
|
@ -78,10 +79,6 @@ while [ "$#" -gt 0 ]; do
|
|||
--purge | --uninstall)
|
||||
wo_purge="y"
|
||||
;;
|
||||
-v | --version)
|
||||
wo_version="$2"
|
||||
shift
|
||||
;;
|
||||
*) # positional args
|
||||
;;
|
||||
esac
|
||||
|
@ -97,14 +94,15 @@ if [[ $EUID -ne 0 ]]; then
|
|||
exit 100
|
||||
fi
|
||||
|
||||
###
|
||||
# 1- Update the apt sewers with fresh info
|
||||
###
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
unset LANG
|
||||
export LANG='en_US.UTF-8'
|
||||
export LC_ALL='C.UTF-8'
|
||||
|
||||
###
|
||||
# 1- Main functions
|
||||
###
|
||||
|
||||
# check if a command exist
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
|
@ -121,19 +119,18 @@ _run() {
|
|||
|
||||
}
|
||||
|
||||
check_path() {
|
||||
if [ -d "$1" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
###
|
||||
# 1- Update the apt sewers with fresh info
|
||||
###
|
||||
|
||||
if [ -z "$wo_travis" ]; then
|
||||
if command_exists curl; then
|
||||
apt-get update -qq
|
||||
else
|
||||
apt-get update -qq && apt-get -y install curl -qq > /dev/null 2>&1
|
||||
if ! {
|
||||
apt-get update --allow-releaseinfo-change -qq > /dev/null 2>&1
|
||||
}; then
|
||||
apt-get update -qq > /dev/null 2>&1
|
||||
fi
|
||||
if ! command_exists curl; then
|
||||
apt-get -y install curl -qq > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -167,7 +164,6 @@ readonly wo_tmp_dir=/var/lib/wo/tmp
|
|||
readonly wo_install_log=/var/log/wo/install.log
|
||||
readonly wo_linux_distro=$(lsb_release -is)
|
||||
readonly wo_distro_version=$(lsb_release -sc)
|
||||
readonly wo_distro_id=$(lsb_release -rs)
|
||||
readonly TIME_FORMAT='%d-%b-%Y-%H%M%S'
|
||||
readonly TIME=$(date +"$TIME_FORMAT")
|
||||
readonly NGINX_BACKUP_FILE="/var/lib/wo-backup/nginx-backup.$TIME.tar.gz"
|
||||
|
@ -179,13 +175,8 @@ WO_ARCH="$(uname -m)"
|
|||
|
||||
if [ -x /usr/local/bin/ee ]; then
|
||||
ee_migration=1
|
||||
ufw="n"
|
||||
elif [ -x /usr/local/bin/wo ]; then
|
||||
wo_upgrade=1
|
||||
ufw="n"
|
||||
fi
|
||||
if [ -z "$ufw" ]; then
|
||||
ufw="y"
|
||||
fi
|
||||
###
|
||||
# 1 - Checking linux distro
|
||||
|
@ -232,13 +223,13 @@ wo_install_dep() {
|
|||
if [ "$wo_linux_distro" == "Ubuntu" ]; then
|
||||
# install dependencies
|
||||
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes 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 unattended-upgrades tzdata ntp > /dev/null 2>&1
|
||||
build-essential curl gzip python3-pip python3-wheel python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz \
|
||||
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1
|
||||
add-apt-repository ppa:wordops/nginx-wo -yn
|
||||
else
|
||||
# install dependencies
|
||||
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
|
||||
build-essential curl gzip dirmngr sudo python3 python3-apt python3-setuptools python3-requests python3-dev ca-certificates sqlite3 git tar \
|
||||
build-essential curl gzip dirmngr sudo python3-pip python3-wheel 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 unattended-upgrades tzdata ntp > /dev/null 2>&1
|
||||
# add php repository gpg key
|
||||
[ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; }
|
||||
|
@ -318,16 +309,6 @@ wo_sync_db() {
|
|||
|
||||
wo_site_current_type=$(grep "common/" "/etc/nginx/sites-available/$site" | awk -F "/" '{print $2}')
|
||||
|
||||
if echo "$wo_site_current_type" | grep -q "php"; then
|
||||
if echo "$wo_site_current_type" | grep -q "php7"; then
|
||||
wo_php_version="7.0"
|
||||
else
|
||||
wo_php_version="5.6"
|
||||
fi
|
||||
else
|
||||
wo_php_version=""
|
||||
fi
|
||||
|
||||
if echo "$wo_site_current_type" | grep -q "redis"; then
|
||||
wo_site_current_cache="wpredis"
|
||||
elif echo "$wo_site_current_type" | grep -q wpsc; then
|
||||
|
@ -458,6 +439,18 @@ wo_install_acme_sh() {
|
|||
fi
|
||||
}
|
||||
|
||||
wo_git_config() {
|
||||
|
||||
if [ "$wo_force_install" = "y" ]; then
|
||||
[ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; }
|
||||
fi
|
||||
|
||||
# .gitconfig inital setup
|
||||
cd /var/lib/wo/tmp/WordOps-install || exit 1
|
||||
python3 gitconfig.py
|
||||
|
||||
}
|
||||
|
||||
# Download WordOps
|
||||
wo_download() {
|
||||
rm -f /etc/bash_completion.d/wo_auto.rc
|
||||
|
@ -471,18 +464,6 @@ wo_download() {
|
|||
fi
|
||||
}
|
||||
|
||||
wo_git_config() {
|
||||
|
||||
if [ "$wo_force_install" = "y" ]; then
|
||||
[ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; }
|
||||
fi
|
||||
|
||||
# .gitconfig inital setup
|
||||
cd /var/lib/wo/tmp/WordOps-install || exit 1
|
||||
python3 gitconfig.py
|
||||
|
||||
}
|
||||
|
||||
# WordOps install
|
||||
wo_install() {
|
||||
|
||||
|
@ -492,7 +473,7 @@ wo_install() {
|
|||
}
|
||||
|
||||
# Clone Github repository if it doesn't exist
|
||||
wo_install_travis() {
|
||||
wo_travis_install() {
|
||||
|
||||
if [ "$wo_force_install" = "y" ]; then
|
||||
[ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; }
|
||||
|
@ -610,32 +591,20 @@ wo_update_latest() {
|
|||
chmod 600 /root/.my.cnf
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fix Redis-server security issue
|
||||
# http://redis.io/topics/security
|
||||
if [ -f /etc/redis/redis.conf ]; then
|
||||
CHECK_REDIS_BIND=$(grep -0 -v "#" /etc/redis/redis.conf | grep 'bind' >> /dev/null 2>&1)
|
||||
|
||||
if [ -z "$CHECK_REDIS_BIND" ]; then
|
||||
echo 'bind 127.0.0.1 ::1' >> /etc/redis/redis.conf
|
||||
|
||||
service redis-server restart
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
wo_backup_ee() {
|
||||
local BACKUP_EE=""
|
||||
[ -d /etc/nginx ] && { BACKUP_EE="$BACKUP_EE /etc/nginx"; }
|
||||
[ -d /etc/letsencrypt ] && { BACKUP_EE="$BACKUP_EE /etc/letsencrypt"; }
|
||||
/bin/tar -I pigz -cf "$EE_BACKUP_FILE" /usr/local/bin/ee /usr/lib/ee/templates /usr/local/lib/python3.*/dist-packages/ee-*.egg /etc/ee /var/lib/ee "$BACKUP_EE"
|
||||
/bin/tar -I pigz -cf "$EE_BACKUP_FILE" /usr/local/bin/ee /usr/lib/ee/templates /etc/ee /var/lib/ee "$BACKUP_EE"
|
||||
return 0
|
||||
}
|
||||
|
||||
wo_backup_wo() {
|
||||
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /etc/wo /var/lib/wo "$WO_LE"
|
||||
if [ -d /etc/nginx ] && [ -d /etc/wo ] && [ -d /var/lib/wo ]; then
|
||||
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /etc/wo /var/lib/wo
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -686,7 +655,7 @@ wo_systemd_tweak() {
|
|||
}
|
||||
|
||||
wo_domain_suffix() {
|
||||
curl -sL https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat | sed '/^\/\//d' | sed '/^$/d' | sed 's/^\s+//g' > /var/lib/wo/public_suffix_list.dat
|
||||
curl -m 10 --retry 3 -sL https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat | sed '/^\/\//d' | sed '/^$/d' | sed 's/^\s+//g' > /var/lib/wo/public_suffix_list.dat
|
||||
}
|
||||
|
||||
wo_mariadb_tweak() {
|
||||
|
@ -715,69 +684,10 @@ wo_clean() {
|
|||
}
|
||||
|
||||
wo_uninstall() {
|
||||
python3 -m pip uninstall wordops -y
|
||||
rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates
|
||||
}
|
||||
|
||||
wo_ufw_setup() {
|
||||
if ! grep -q "ENABLED=yes" /etc/ufw/ufw.conf; then
|
||||
# get custom ssh port
|
||||
if [ -f /etc/ssh/sshd_config ]; then
|
||||
CURRENT_SSH_PORT=$(grep "Port" /etc/ssh/sshd_config | awk -F " " '{print $2}')
|
||||
fi
|
||||
# define firewall rules
|
||||
if ! grep -q "LOGLEVEL=low" /etc/ufw/ufw.conf; then
|
||||
ufw logging low
|
||||
fi
|
||||
if ! grep -q 'DEFAULT_OUTPUT_POLICY="ACCEPT"' /etc/default/ufw; then
|
||||
ufw default allow outgoing
|
||||
fi
|
||||
if ! grep -q 'DEFAULT_INPUT_POLICY="DROP"' /etc/default/ufw; then
|
||||
ufw default deny incoming
|
||||
fi
|
||||
if ! grep -q "\-\-dport 22 -j" /etc/ufw/user.rules; then
|
||||
# default ssh port
|
||||
ufw limit 22
|
||||
fi
|
||||
|
||||
# custom ssh port
|
||||
if [ "$CURRENT_SSH_PORT" != "22" ]; then
|
||||
if ! grep -q "\-\-dport $CURRENT_SSH_PORT -j" /etc/ufw/user.rules; then
|
||||
ufw limit "$CURRENT_SSH_PORT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# nginx
|
||||
if ! grep -q "\-\-dport 80 -j" /etc/ufw/user.rules; then
|
||||
# http
|
||||
ufw allow http
|
||||
fi
|
||||
if ! grep -q "\-\-dport 443 -j" /etc/ufw/user.rules; then
|
||||
# https
|
||||
ufw allow https
|
||||
fi
|
||||
|
||||
# ntp
|
||||
if ! grep -q "\-\-dport 123 -j" /etc/ufw/user.rules; then
|
||||
ufw allow 123
|
||||
fi
|
||||
|
||||
if ! grep -q "\-\-dport 22222 -j" /etc/ufw/user.rules; then
|
||||
# wordops backend
|
||||
ufw limit 22222
|
||||
fi
|
||||
# enable ufw
|
||||
if [ -n "$CURRENT_SSH_PORT" ]; then
|
||||
ufw --force enable
|
||||
fi
|
||||
|
||||
# remove ufw from syslog
|
||||
if [ -f /etc/rsyslog.d/20-ufw.conf ]; then
|
||||
sed -i 's/\#\& stop/\& stop/' /etc/rsyslog.d/20-ufw.conf
|
||||
service rsyslog restart
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
wo_cheat_install() {
|
||||
curl -sL https://cht.sh/:cht.sh > /usr/local/bin/cht.sh
|
||||
chmod +x /usr/local/bin/cht.sh
|
||||
|
@ -822,17 +732,14 @@ else
|
|||
fi
|
||||
_run wo_install_dep "Installing wo dependencies"
|
||||
_run wo_timesync
|
||||
#if [ "$ufw" = "y" ]; then
|
||||
# _run wo_ufw_setup "Configuring UFW"
|
||||
#fi
|
||||
# skip steps if travis
|
||||
if [ -z "$wo_travis" ]; then
|
||||
_run wo_download "Downloading WordOps"
|
||||
_run wo_dist_upgrade
|
||||
_run wo_download "Downloading WordOps"
|
||||
wo_git_config
|
||||
_run wo_install "Installing WordOps"
|
||||
else
|
||||
_run wo_install_travis "Installing WordOps"
|
||||
_run wo_travis_install "Installing WordOps"
|
||||
fi
|
||||
if [ -x /usr/local/bin/ee ]; then
|
||||
_run wo_upgrade_nginx "Upgrading Nginx"
|
||||
|
@ -889,6 +796,3 @@ else
|
|||
wo_lib_echo "Give WordOps a GitHub star : https://github.com/WordOps/WordOps/"
|
||||
echo
|
||||
fi
|
||||
# if [ -z "$wo_travis" ]; then
|
||||
# /bin/bash --init-file "/var/lib/wo/tmp/WordOps-$wo_branch/tests/init-file"
|
||||
# fi
|
||||
|
|
|
@ -6,5 +6,4 @@ psutil>=5.6.3
|
|||
sh>=1.12.14
|
||||
SQLAlchemy>=1.3.8
|
||||
requests>=2.22.0
|
||||
distro>=1.4.0
|
||||
apt-mirror-updater>=6.1
|
||||
distro>=1.4.0
|
|
@ -9,4 +9,7 @@ cover-inclusive=1
|
|||
cover-erase=1
|
||||
cover-html=1
|
||||
cover-html-dir=coverage_report/
|
||||
where=tests/
|
||||
where=tests/
|
||||
|
||||
[metadata]
|
||||
license-file = LICENSE
|
10
setup.py
10
setup.py
|
@ -4,8 +4,8 @@
|
|||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
LONG = fh.read()
|
||||
|
||||
conf = []
|
||||
templates = []
|
||||
|
@ -24,10 +24,9 @@
|
|||
os.makedirs('/var/lib/wo/tmp/')
|
||||
|
||||
setup(name='wordops',
|
||||
version='3.9.9.2',
|
||||
version='3.9.9.3',
|
||||
description='WordPress & server administration toolset',
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/markdown',
|
||||
long_description=LONG,
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
|
@ -61,7 +60,6 @@
|
|||
'SQLAlchemy >= 1.3.8',
|
||||
'requests >= 2.22.0',
|
||||
'distro >= 1.4.0',
|
||||
'apt-mirror-updater >= 6.1',
|
||||
],
|
||||
extras_require={ # Optional
|
||||
'testing': ['nose', 'coverage'],
|
||||
|
|
|
@ -14,13 +14,9 @@
|
|||
|
||||
if [ -f /var/log/wo/wordops.log ]; then
|
||||
cd /var/log/wo/ || exit 1
|
||||
if {
|
||||
tar -I pigz -cf wordops.tar.gz wordops.log
|
||||
}; then
|
||||
wo_link=$(curl -sL --upload-file wordops.tar.gz https://transfer.sh/wordops.tar.gz)
|
||||
echo
|
||||
echo "Here the link to provide in your github issue : $wo_link"
|
||||
echo
|
||||
fi
|
||||
wo_link=$(curl -sL --upload-file wordops.log https://transfer.vtbox.net/wordops.txt)
|
||||
echo
|
||||
echo "Here the link to provide in your github issue : $wo_link"
|
||||
echo
|
||||
cd || exit 1
|
||||
fi
|
||||
|
|
|
@ -21,7 +21,7 @@ if [ -z "$1" ]; then
|
|||
fi
|
||||
|
||||
exit_script() {
|
||||
curl --progress-bar --upload-file /var/log/wo/wordops.log https://transfer.vtbox.net/"$(basename wordops.log)" && echo ""
|
||||
curl --progress-bar --upload-file /var/log/wo/wordops.log https://transfer.vtbox.net/"$(basename wordops.txt)" && echo ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ done
|
|||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' Simple site create '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
site_types='html php php73 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir'
|
||||
site_types='html php php73 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
|
||||
for site in $site_types; do
|
||||
echo -ne " Creating $site [..]\r"
|
||||
if {
|
||||
|
@ -65,7 +65,7 @@ done
|
|||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' wo site update --php73 '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
other_site_types='html mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir'
|
||||
other_site_types='html mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
|
||||
for site in $other_site_types; do
|
||||
echo -ne " Updating site to $site php73 [..]\r"
|
||||
if {
|
||||
|
@ -180,6 +180,46 @@ for stack in $stack_clean; do
|
|||
fi
|
||||
done
|
||||
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' wo secure '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -ne " wo secure --auth [..]\r"
|
||||
if {
|
||||
wo secure --auth wordops mypassword
|
||||
} >> /var/log/wo/test.log; then
|
||||
echo -ne " wo secure --auth [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
echo -e " wo secure --auth [${CRED}FAIL${CEND}]"
|
||||
echo -ne '\n'
|
||||
exit_script
|
||||
|
||||
fi
|
||||
echo -ne " wo secure --sshport [..]\r"
|
||||
if {
|
||||
wo secure --sshport 2022
|
||||
} >> /var/log/wo/test.log; then
|
||||
echo -ne " wo secure --sshport [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
echo -e " wo secure --sshport [${CRED}FAIL${CEND}]"
|
||||
echo -ne '\n'
|
||||
exit_script
|
||||
|
||||
fi
|
||||
echo -ne " wo secure --ssh [..]\r"
|
||||
if {
|
||||
wo secure --ssh --force
|
||||
} >> /var/log/wo/test.log; then
|
||||
echo -ne " wo secure --ssh [${CGREEN}OK${CEND}]\\r"
|
||||
echo -ne '\n'
|
||||
else
|
||||
echo -e " wo secure --ssh [${CRED}FAIL${CEND}]"
|
||||
echo -ne '\n'
|
||||
exit_script
|
||||
|
||||
fi
|
||||
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
echo -e ' various informations '
|
||||
echo -e "${CGREEN}#############################################${CEND}"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
from cement.core import handler, hook
|
||||
from cement.core.controller import CementBaseController, expose
|
||||
|
||||
from wo.core.fileutils import WOFileUtils
|
||||
from wo.core.git import WOGit
|
||||
from wo.core.logging import Log
|
||||
|
@ -70,7 +69,7 @@ def secure_auth(self):
|
|||
WOGit.add(self, ["/etc/nginx"],
|
||||
msg="Add Nginx to into Git")
|
||||
pargs = self.app.pargs
|
||||
passwd = RANDOM.gen(self, length='24')
|
||||
passwd = RANDOM.long(self)
|
||||
if not pargs.user_input:
|
||||
username = input("Provide HTTP authentication user "
|
||||
"name [{0}] :".format(WOVar.wo_user))
|
||||
|
@ -109,11 +108,12 @@ def secure_port(self):
|
|||
Log.info(self, "Please enter a valid port number ")
|
||||
pargs.user_input = input("WordOps "
|
||||
"admin port [22222]:")
|
||||
if not pargs.user_input:
|
||||
else:
|
||||
port = input("WordOps admin port [22222]:")
|
||||
if port == "":
|
||||
port = 22222
|
||||
while (not port.isdigit()) and (port != "") and (not port < 65536):
|
||||
while ((not port.isdigit()) and (not port != "") and
|
||||
(not port < 65536)):
|
||||
Log.info(self, "Please Enter valid port number :")
|
||||
port = input("WordOps admin port [22222]:")
|
||||
pargs.user_input = port
|
||||
|
@ -220,9 +220,14 @@ def secure_ssh_port(self):
|
|||
Log.info(self, "Please Enter valid port number :")
|
||||
port = input("Server SSH port [22]:")
|
||||
pargs.user_input = port
|
||||
WOShellExec.cmd_exec(self, "sed -i \"s/Port.*/Port "
|
||||
"{port}/\" /etc/ssh/sshd_config"
|
||||
.format(port=pargs.user_input))
|
||||
if WOFileUtils.grepcheck(self, '/etc/ssh/sshd_config', '#Port'):
|
||||
WOShellExec.cmd_exec(self, "sed -i \"s/#Port.*/Port "
|
||||
"{port}/\" /etc/ssh/sshd_config"
|
||||
.format(port=pargs.user_input))
|
||||
else:
|
||||
WOShellExec.cmd_exec(self, "sed -i \"s/Port.*/Port "
|
||||
"{port}/\" /etc/ssh/sshd_config"
|
||||
.format(port=pargs.user_input))
|
||||
# allow new ssh port if ufw is enabled
|
||||
if os.path.isfile('/etc/ufw/ufw.conf'):
|
||||
# add rule for proftpd with UFW
|
||||
|
|
|
@ -301,10 +301,9 @@ def setupwordpress(self, data, vhostonly=False):
|
|||
"--dbhost=\'{3}\' "
|
||||
.format(data['wo_db_name'], wo_wp_prefix,
|
||||
data['wo_db_user'], data['wo_db_host']) +
|
||||
"--dbpass=\'{0}\' "
|
||||
"--extra-php<<PHP \n {1}\nPHP\""
|
||||
.format(data['wo_db_pass'],
|
||||
"\n\ndefine(\'WP_DEBUG\', false);"))
|
||||
"--dbpass= "
|
||||
"--extra-php<<PHP \n {0}\nPHP\""
|
||||
.format("\n\ndefine(\'WP_DEBUG\', false);"))
|
||||
try:
|
||||
if WOShellExec.cmd_exec(self, "/bin/bash -c \"{0} --allow-root"
|
||||
.format(WOVar.wo_wpcli_path) +
|
||||
|
@ -335,9 +334,9 @@ def setupwordpress(self, data, vhostonly=False):
|
|||
"--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
|
||||
.format(data['wo_db_name'],
|
||||
wo_wp_prefix, data['wo_db_host']) +
|
||||
"--dbuser=\'{0}\' --dbpass=\'{1}\' "
|
||||
"--extra-php<<PHP \n {2} {3} {4} \nPHP\""
|
||||
.format(data['wo_db_user'], data['wo_db_pass'],
|
||||
"--dbuser=\'{0}\' --dbpass= "
|
||||
"--extra-php<<PHP \n {1} {2} {3} \nPHP\""
|
||||
.format(data['wo_db_user'],
|
||||
"\ndefine(\'WPMU_ACCEL_REDIRECT\',"
|
||||
" true);",
|
||||
"\ndefine(\'CONCATENATE_SCRIPTS\',"
|
||||
|
@ -462,19 +461,20 @@ def setupwordpress(self, data, vhostonly=False):
|
|||
Log.debug(self, "{0} --allow-root core install "
|
||||
.format(WOVar.wo_wpcli_path) +
|
||||
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
|
||||
.format(data['www_domain'], wo_wp_user) +
|
||||
"--admin_password= --admin_email=\'{1}\'"
|
||||
.format(wo_wp_pass, wo_wp_email))
|
||||
.format(data['site_name'], wo_wp_user) +
|
||||
"--admin_password= --admin_email=\'{0}\'"
|
||||
.format(wo_wp_email))
|
||||
try:
|
||||
if WOShellExec.cmd_exec(self, "{0} --allow-root core "
|
||||
.format(WOVar.wo_wpcli_path) +
|
||||
"install --url=\'{0}\' --title=\'{0}\' "
|
||||
"--admin_name=\'{1}\' "
|
||||
.format(data['www_domain'], wo_wp_user) +
|
||||
"--admin_password=\'{0}\' "
|
||||
"--admin_email=\'{1}\'"
|
||||
.format(wo_wp_pass, wo_wp_email),
|
||||
log=False):
|
||||
if WOShellExec.cmd_exec(
|
||||
self, "{0} --allow-root core "
|
||||
.format(WOVar.wo_wpcli_path) +
|
||||
"install --url=\'{0}\' --title=\'{0}\' "
|
||||
"--admin_name=\'{1}\' "
|
||||
.format(data['site_name'], wo_wp_user) +
|
||||
"--admin_password=\'{0}\' "
|
||||
"--admin_email=\'{1}\'"
|
||||
.format(wo_wp_pass, wo_wp_email),
|
||||
log=False):
|
||||
pass
|
||||
else:
|
||||
raise SiteError(
|
||||
|
@ -487,26 +487,27 @@ def setupwordpress(self, data, vhostonly=False):
|
|||
.format(WOVar.wo_wpcli_path) +
|
||||
"core multisite-install "
|
||||
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
|
||||
.format(data['www_domain'], wo_wp_user) +
|
||||
"--admin_password= --admin_email=\'{1}\' "
|
||||
.format(data['site_name'], wo_wp_user) +
|
||||
"--admin_password= --admin_email=\'{0}\' "
|
||||
"{subdomains}"
|
||||
.format(wo_wp_pass, wo_wp_email,
|
||||
.format(wo_wp_email,
|
||||
subdomains='--subdomains'
|
||||
if not data['wpsubdir'] else ''))
|
||||
try:
|
||||
if WOShellExec.cmd_exec(self, "{0} --allow-root "
|
||||
.format(WOVar.wo_wpcli_path) +
|
||||
"core multisite-install "
|
||||
"--url=\'{0}\' --title=\'{0}\' "
|
||||
"--admin_name=\'{1}\' "
|
||||
.format(data['www_domain'], wo_wp_user) +
|
||||
"--admin_password=\'{0}\' "
|
||||
"--admin_email=\'{1}\' "
|
||||
"{subdomains}"
|
||||
.format(wo_wp_pass, wo_wp_email,
|
||||
subdomains='--subdomains'
|
||||
if not data['wpsubdir'] else ''),
|
||||
log=False):
|
||||
if WOShellExec.cmd_exec(
|
||||
self, "{0} --allow-root "
|
||||
.format(WOVar.wo_wpcli_path) +
|
||||
"core multisite-install "
|
||||
"--url=\'{0}\' --title=\'{0}\' "
|
||||
"--admin_name=\'{1}\' "
|
||||
.format(data['site_name'], wo_wp_user) +
|
||||
"--admin_password=\'{0}\' "
|
||||
"--admin_email=\'{1}\' "
|
||||
"{subdomains}"
|
||||
.format(wo_wp_pass, wo_wp_email,
|
||||
subdomains='--subdomains'
|
||||
if not data['wpsubdir'] else ''),
|
||||
log=False):
|
||||
pass
|
||||
else:
|
||||
raise SiteError(
|
||||
|
@ -1053,7 +1054,7 @@ def logwatch(self, logfiles):
|
|||
import zlib
|
||||
import base64
|
||||
import time
|
||||
from wo.core import logwatch
|
||||
from wo.core.logwatch import LogWatcher
|
||||
|
||||
def callback(filename, lines):
|
||||
for line in lines:
|
||||
|
@ -1070,7 +1071,7 @@ def callback(filename, lines):
|
|||
'caught exception rendering a new log line in %s'
|
||||
% filename)
|
||||
|
||||
logl = logwatch.LogWatcher(logfiles, callback)
|
||||
logl = LogWatcher(logfiles, callback)
|
||||
logl.loop()
|
||||
|
||||
|
||||
|
|
|
@ -168,14 +168,14 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
|
|||
if WOAptGet.is_installed(self, 'nginx-plus'):
|
||||
Log.info(self, "NGINX PLUS Detected ...")
|
||||
apt = ["nginx-plus"] + WOVar.wo_nginx
|
||||
self.post_pref(apt, empty_packages)
|
||||
post_pref(self, apt, empty_packages)
|
||||
elif WOAptGet.is_installed(self, 'nginx'):
|
||||
Log.info(self, "WordOps detected an already "
|
||||
"installed nginx package."
|
||||
"It may or may not have "
|
||||
"required modules.\n")
|
||||
apt = ["nginx"] + WOVar.wo_nginx
|
||||
self.post_pref(apt, empty_packages)
|
||||
post_pref(self, apt, empty_packages)
|
||||
else:
|
||||
Log.debug(self, "Nginx already installed")
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ def pre_pref(self, apt_packages):
|
|||
mysql_pref_file.write(mysql_pref)
|
||||
WORepo.add(self, repo_url=WOVar.wo_mysql_repo)
|
||||
WORepo.add_key(self, '0xcbcb082a1bb943db',
|
||||
keyserver='keys.gnupg.net')
|
||||
keyserver='keyserver.ubuntu.com')
|
||||
WORepo.add_key(self, '0xF1656F24C74CD1D8',
|
||||
keyserver='keys.gnupg.net')
|
||||
keyserver='keyserver.ubuntu.com')
|
||||
if "mariadb-server" in apt_packages:
|
||||
# generate random 24 characters root password
|
||||
chars = ''.join(random.sample(string.ascii_letters, 24))
|
||||
|
|
|
@ -94,7 +94,7 @@ def default(self, disp_msg=False):
|
|||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||
apt_packages = apt_packages + WOVar.wo_nginx
|
||||
else:
|
||||
if os.path.isfile(self, '/usr/sbin/nginx'):
|
||||
if os.path.isfile('/usr/sbin/nginx'):
|
||||
Log.info(self, "Updating Nginx templates")
|
||||
post_pref(self, WOVar.wo_nginx, [])
|
||||
else:
|
||||
|
@ -186,15 +186,14 @@ def default(self, disp_msg=False):
|
|||
self.app.args.print_help()
|
||||
else:
|
||||
if (apt_packages):
|
||||
if not (set(["php7.2-fpm"]).issubset(set(apt_packages)) and
|
||||
set(["php7.3-fpm"]).issubset(set(apt_packages)) and
|
||||
set(["nginx-custom",
|
||||
"nginx-wo"]).issubset(set(apt_packages)) and
|
||||
set(['mariadb-server']).issubset(set(apt_packages))):
|
||||
if (("php7.2-fpm" not in apt_packages) and
|
||||
("php7.3-fpm" not in apt_packages) and
|
||||
("nginx-custom" not in apt_packages) and
|
||||
("mariadb-server" not in apt_packages)):
|
||||
pass
|
||||
else:
|
||||
Log.info(
|
||||
self, "Your site may be down for few seconds if "
|
||||
self, "Your sites may be down for few seconds if "
|
||||
"you are upgrading Nginx, PHP-FPM, MariaDB or Redis")
|
||||
# Check prompt
|
||||
if ((not pargs.no_prompt) and (not pargs.force)):
|
||||
|
@ -219,7 +218,6 @@ def default(self, disp_msg=False):
|
|||
# check if nginx upgrade is blocked
|
||||
if os.path.isfile(
|
||||
'/etc/apt/preferences.d/nginx-block'):
|
||||
apt_packages.remove(WOVar.wo_nginx)
|
||||
post_pref(self, WOVar.wo_nginx, [], True)
|
||||
# upgrade packages
|
||||
WOAptGet.install(self, apt_packages)
|
||||
|
|
|
@ -55,6 +55,7 @@ http {
|
|||
ssl_session_cache shared:SSL:50m;
|
||||
ssl_session_tickets off;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_early_data on;
|
||||
{{#tls13}}ssl_ciphers 'TLS13+AESGCM+AES256:TLS13+AESGCM+AES128:TLS13+CHACHA20:EECDH+AESGCM:EECDH+CHACHA20';
|
||||
ssl_protocols TLSv1.2 TLSv1.3;{{/tls13}}
|
||||
ssl_ecdh_curve X25519:P-521:P-384:P-256;
|
||||
|
|
|
@ -27,3 +27,8 @@
|
|||
open_file_cache_min_uses 2;
|
||||
open_file_cache_valid 120s;
|
||||
open_log_file_cache max=10000 inactive=30s min_uses=2;
|
||||
|
||||
ssl_dyn_rec_size_hi 4229;
|
||||
ssl_dyn_rec_size_lo 1369;
|
||||
ssl_dyn_rec_threshold 40;
|
||||
ssl_dyn_rec_timeout 1000;
|
||||
|
|
|
@ -48,9 +48,11 @@ def add(self, repo_url=None, ppa=None):
|
|||
Log.debug(self, "{0}".format(e))
|
||||
Log.error(self, "Unable to add repo")
|
||||
if ppa is not None:
|
||||
WOShellExec.cmd_exec(
|
||||
self, "LC_ALL=C.UTF-8 add-apt-repository -yu '{ppa_name}'"
|
||||
.format(ppa_name=ppa))
|
||||
if WOShellExec.cmd_exec(
|
||||
self, "LC_ALL=C.UTF-8 add-apt-repository -yu '{ppa_name}'"
|
||||
.format(ppa_name=ppa)):
|
||||
return True
|
||||
return False
|
||||
|
||||
def remove(self, ppa=None, repo_url=None):
|
||||
"""
|
||||
|
|
|
@ -18,14 +18,22 @@ def update(self):
|
|||
"""
|
||||
try:
|
||||
with open('/var/log/wo/wordops.log', 'a') as f:
|
||||
proc = subprocess.Popen('apt-mirror-updater -u',
|
||||
shell=True,
|
||||
stdin=None, stdout=f,
|
||||
stderr=subprocess.PIPE,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
'DEBIAN_FRONTEND=noninteractive apt-get update -qq '
|
||||
'--allow-releaseinfo-change',
|
||||
shell=True, stdin=None, stdout=f,
|
||||
stderr=subprocess.PIPE, executable="/bin/bash")
|
||||
proc.wait()
|
||||
output, error_output = proc.communicate()
|
||||
|
||||
if "--allow-releaseinfo-change" in str(error_output):
|
||||
proc = subprocess.Popen(
|
||||
'DEBIAN_FRONTEND=noninteractive apt-get update -qq',
|
||||
shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc.wait()
|
||||
output, error_output = proc.communicate()
|
||||
# Check what is error in error_output
|
||||
if "NO_PUBKEY" in str(error_output):
|
||||
# Split the output
|
||||
|
@ -39,10 +47,11 @@ def update(self):
|
|||
WORepo.add_key(
|
||||
self, key, keyserver="hkp://pgp.mit.edu")
|
||||
|
||||
proc = subprocess.Popen('apt-get update',
|
||||
shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
'DEBIAN_FRONTEND=noninteractive apt-get update -qq',
|
||||
shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc.wait()
|
||||
|
||||
if proc.returncode == 0:
|
||||
|
@ -83,18 +92,16 @@ def dist_upgrade(self):
|
|||
"""
|
||||
try:
|
||||
with open('/var/log/wo/wordops.log', 'a') as f:
|
||||
proc = subprocess.Popen("DEBIAN_FRONTEND=noninteractive "
|
||||
"apt-get dist-upgrade "
|
||||
"--option=Dpkg::options::="
|
||||
"--force-confdef "
|
||||
"--option=Dpkg::options::="
|
||||
"--force-unsafe-io "
|
||||
"--option=Dpkg::options::="
|
||||
"--force-confold "
|
||||
"--assume-yes --quiet ",
|
||||
shell=True, stdin=None,
|
||||
stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
"DEBIAN_FRONTEND=noninteractive "
|
||||
"apt-get "
|
||||
"--option=Dpkg::options::=--force-confdef "
|
||||
"--option=Dpkg::options::=--force-unsafe-io "
|
||||
"--option=Dpkg::options::=--force-confold "
|
||||
"--assume-yes --quiet dist-upgrade",
|
||||
shell=True, stdin=None,
|
||||
stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc.wait()
|
||||
|
||||
if proc.returncode == 0:
|
||||
|
@ -114,17 +121,15 @@ def install(self, packages):
|
|||
all_packages = ' '.join(packages)
|
||||
try:
|
||||
with open('/var/log/wo/wordops.log', 'a') as f:
|
||||
proc = subprocess.Popen("DEBIAN_FRONTEND=noninteractive "
|
||||
"apt-get install "
|
||||
"--option=Dpkg::options::="
|
||||
"--force-confdef "
|
||||
"--option=Dpkg::options::="
|
||||
"--force-confold "
|
||||
"--assume-yes "
|
||||
"--allow-unauthenticated {0}"
|
||||
.format(all_packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
"DEBIAN_FRONTEND=noninteractive "
|
||||
"apt-get install "
|
||||
"--option=Dpkg::options::=--force-confdef "
|
||||
"--option=Dpkg::options::=--force-confold "
|
||||
"--assume-yes --allow-unauthenticated {0}"
|
||||
.format(all_packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc.wait()
|
||||
|
||||
if proc.returncode == 0:
|
||||
|
@ -149,19 +154,19 @@ def remove(self, packages, auto=False, purge=False):
|
|||
try:
|
||||
with open('/var/log/wo/wordops.log', 'a') as f:
|
||||
if purge:
|
||||
proc = subprocess.Popen('DEBIAN_FRONTEND=noninteractive '
|
||||
'apt-get autoremove --purge '
|
||||
'-qq {0}'
|
||||
.format(all_packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
'DEBIAN_FRONTEND=noninteractive '
|
||||
'apt-get autoremove --purge -qq {0}'
|
||||
.format(all_packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
else:
|
||||
proc = subprocess.Popen('DEBIAN_FRONTEND=noninteractive '
|
||||
'apt-get autoremove '
|
||||
'-qq {0}'
|
||||
.format(all_packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
'DEBIAN_FRONTEND=noninteractive '
|
||||
'apt-get autoremove -qq {0}'
|
||||
.format(all_packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc.wait()
|
||||
if proc.returncode == 0:
|
||||
return True
|
||||
|
@ -228,16 +233,18 @@ def download_only(self, package_name, repo_url=None, repo_key=None):
|
|||
WORepo.add(self, repo_url=repo_url)
|
||||
if repo_key is not None:
|
||||
WORepo.add_key(self, repo_key)
|
||||
proc = subprocess.Popen("apt-get update && "
|
||||
"DEBIAN_FRONTEND=noninteractive "
|
||||
"apt-get install -o "
|
||||
"Dpkg::Options::=\"--force-confdef\""
|
||||
" -o "
|
||||
"Dpkg::Options::=\"--force-confold\""
|
||||
" -y --download-only {0}"
|
||||
.format(packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc = subprocess.Popen(
|
||||
"DEBIAN_FRONTEND=noninteractive apt-get update "
|
||||
"-qq && "
|
||||
"DEBIAN_FRONTEND=noninteractive "
|
||||
"apt-get install -o "
|
||||
"Dpkg::Options::=\"--force-confdef\""
|
||||
" -o "
|
||||
"Dpkg::Options::=\"--force-confold\""
|
||||
" -y --download-only {0}"
|
||||
.format(packages), shell=True,
|
||||
stdin=None, stdout=f, stderr=f,
|
||||
executable="/bin/bash")
|
||||
proc.wait()
|
||||
|
||||
if proc.returncode == 0:
|
||||
|
|
|
@ -21,10 +21,10 @@ def validate(self, url):
|
|||
final_domain = ''
|
||||
if www_domain_name[0] == 'www':
|
||||
final_domain = '.'.join(www_domain_name[1:])
|
||||
else:
|
||||
final_domain = domain_name
|
||||
return final_domain
|
||||
return domain_name
|
||||
|
||||
|
||||
return final_domain
|
||||
|
||||
def getlevel(self, domain):
|
||||
"""
|
||||
|
@ -37,16 +37,17 @@ def getlevel(self, domain):
|
|||
if os.path.isfile("/var/lib/wo/public_suffix_list.dat"):
|
||||
# Read mode opens a file for reading only.
|
||||
suffix_file = open(
|
||||
"/var/lib/wo/public_suffix_list.dat", encoding='utf-8', )
|
||||
"/var/lib/wo/public_suffix_list.dat", encoding='utf-8')
|
||||
# Read all the lines into a list.
|
||||
for domain_suffix in suffix_file:
|
||||
if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])):
|
||||
domain_type = 'domain'
|
||||
root_domain = ('.'.join(domain_name[0:]))
|
||||
break
|
||||
else:
|
||||
domain_type = 'subdomain'
|
||||
root_domain = ('.'.join(domain_name[1:]))
|
||||
suffix_file.close()
|
||||
return (domain_type, root_domain)
|
||||
return ('other', domain)
|
||||
if domain_type == 'domain':
|
||||
root_domain = ('.'.join(domain_name[0:]))
|
||||
else:
|
||||
root_domain = ('.'.join(domain_name[1:]))
|
||||
return (domain_type, root_domain)
|
||||
|
|
|
@ -5,8 +5,14 @@
|
|||
class RANDOM:
|
||||
"""Random strings generator"""
|
||||
|
||||
def gen(self, length='24'):
|
||||
def long(self):
|
||||
long_random = ''.join([random.choice
|
||||
(string.ascii_letters + string.digits)
|
||||
for n in range(24)])
|
||||
return long_random
|
||||
|
||||
def short(self):
|
||||
short_random = ''.join([random.choice
|
||||
(string.ascii_letters + string.digits)
|
||||
for n in range(length)])
|
||||
for n in range(24)])
|
||||
return short_random
|
||||
|
|
|
@ -23,9 +23,9 @@ def cmd_exec(self, command, errormsg='', log=True):
|
|||
stderr=subprocess.PIPE, shell=True) as proc:
|
||||
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate()
|
||||
(cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8',
|
||||
"replace"),
|
||||
"replace"),
|
||||
cmd_stderr_bytes.decode('utf-8',
|
||||
"replace"))
|
||||
"replace"))
|
||||
|
||||
if proc.returncode == 0:
|
||||
Log.debug(self, "Command Output: {0}, \nCommand Error: {1}"
|
||||
|
@ -60,9 +60,9 @@ def cmd_exec_stdout(self, command, errormsg='', log=True):
|
|||
stderr=subprocess.PIPE, shell=True) as proc:
|
||||
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate()
|
||||
(cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8',
|
||||
"replace"),
|
||||
"replace"),
|
||||
cmd_stderr_bytes.decode('utf-8',
|
||||
"replace"))
|
||||
"replace"))
|
||||
|
||||
if proc.returncode == 0:
|
||||
Log.debug(self, "Command Output: {0}, \nCommand Error: {1}"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"""
|
||||
|
||||
|
||||
class WOTemplate():
|
||||
class WOTemplate:
|
||||
"""WordOps template utilities"""
|
||||
|
||||
def deploy(self, fileconf, template, data, overwrite=True):
|
||||
|
|
|
@ -13,7 +13,7 @@ class WOVar():
|
|||
"""Intialization of core variables"""
|
||||
|
||||
# WordOps version
|
||||
wo_version = "3.9.9.2"
|
||||
wo_version = "3.9.9.3"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.3.0"
|
||||
wo_adminer = "4.7.3"
|
||||
|
@ -140,21 +140,20 @@ class WOVar():
|
|||
wo_php_extra = ["php-memcached", "php-imagick",
|
||||
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
||||
|
||||
if not wo_distro == 'raspbian':
|
||||
if (not wo_platform_codename == 'jessie'):
|
||||
wo_mysql = ["mariadb-server", "percona-toolkit",
|
||||
"python3-mysqldb", "mariadb-backup"]
|
||||
wo_mysql = ["mariadb-server", "percona-toolkit"]
|
||||
if wo_distro == 'raspbian':
|
||||
wo_mysql = wo_mysql + ["python3-mysqldb"]
|
||||
else:
|
||||
if wo_platform_codename == 'jessie':
|
||||
wo_mysql = wo_mysql + ["python3-mysql.connector"]
|
||||
else:
|
||||
wo_mysql = ["mariadb-server", "percona-toolkit",
|
||||
"python3-mysql.connector"]
|
||||
else:
|
||||
wo_mysql = ["mariadb-server", "percona-toolkit",
|
||||
"python3-mysqldb"]
|
||||
wo_mysql = wo_mysql + ["python3-mysqldb", "mariadb-backup"]
|
||||
|
||||
wo_mysql_client = ["mariadb-client"]
|
||||
if wo_platform_codename == 'jessie':
|
||||
wo_mysql_client = ["mariadb-client", "python3-mysqldb"]
|
||||
wo_mysql_client = wo_mysql_client + ["python3-mysqldb"]
|
||||
else:
|
||||
wo_mysql_client = ["mariadb-client", "python3-mysql.connector"]
|
||||
wo_mysql_client = wo_mysql_client + ["python3-mysql.connector"]
|
||||
|
||||
wo_fail2ban = ["fail2ban"]
|
||||
wo_clamav = ["clamav", "clamav-freshclam"]
|
||||
|
@ -165,7 +164,7 @@ class WOVar():
|
|||
wo_redis_repo = ("ppa:chris-lea/redis-server")
|
||||
wo_goaccess_repo = ("ppa:alex-p/goaccess")
|
||||
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
||||
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
||||
"http://mariadb.mirrors.ovh.net/MariaDB/repo/"
|
||||
"10.3/ubuntu {codename} main"
|
||||
.format(codename=wo_platform_codename))
|
||||
|
||||
|
@ -177,7 +176,7 @@ class WOVar():
|
|||
wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all"
|
||||
.format(codename=wo_platform_codename))
|
||||
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
||||
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
||||
"http://mariadb.mirrors.ovh.net/MariaDB/repo/"
|
||||
"10.3/debian {codename} main"
|
||||
.format(codename=wo_platform_codename))
|
||||
|
||||
|
|
Loading…
Reference in New Issue