Skip to content

Commit 6d1dcb0

Browse files
authored
Merge pull request #179 from joglomedia/2.x.x
2.8.x [Alpha]
2 parents 8c74e82 + 5e5b410 commit 6d1dcb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4117
-1392
lines changed

.env.dist

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ NGINX_VERSION="stable"
9090
# Build with custom OpenSSL.
9191
NGINX_WITH_CUSTOMSSL=false
9292

93-
# Available custom SSL version: e.g. openssl-1.1.1g, libressl-3.0.0
93+
# Available custom SSL version: e.g. openssl-3.1.5, openssl-3.1.5-quic1, libressl-3.9.2
9494
# leave empty to use stack default OpenSSL.
95-
NGINX_CUSTOMSSL_VERSION="openssl-1.1.1l"
95+
NGINX_CUSTOMSSL_VERSION="openssl-3.1.5-quic1"
9696

9797
# Build with PCRE JIT.
9898
NGINX_WITH_PCRE=false
@@ -152,9 +152,9 @@ NGX_MAIL=true
152152
NGX_NCHAN=false
153153

154154
# Note: Be aware that PAGESPEED is no longer being developed.
155-
NGX_PAGESPEED=false
155+
#NGX_PAGESPEED=false
156156
# For Nginx latest v1.23 or greater, try using NPS v1.14.33.1-RC1 or latest-stable
157-
NGX_PAGESPEED_VERSION="latest-stable"
157+
#NGX_PAGESPEED_VERSION="latest-stable"
158158

159159
NGX_RTMP=false
160160
NGX_STREAM=true
@@ -173,7 +173,7 @@ PHP_VERSIONS="8.1 8.2 8.3"
173173
# Additional PHP modules (extensions) to install.
174174
# Installing multiple extension is supported, separate version by space.
175175
# Type only the extension name (without php*-).
176-
PHP_EXTENSIONS="geoip gnupg imagick igbinary json mcrypt memcache memcached msgpack sodium"
176+
PHP_EXTENSIONS="geoip gnupg imagick igbinary json mcrypt memcache memcached msgpack sodium xdebug"
177177

178178
# DO NOT CHANGE
179179
DEFAULT_PHP_VERSION="8.2"
@@ -246,6 +246,7 @@ INSTALL_POSTGRES=false
246246
# Postgres version (only type the major version number).
247247
POSTGRES_VERSION="15"
248248

249+
POSTGRES_PORT=5432
249250
POSTGRES_PGDATA="/var/lib/postgresql/data"
250251

251252
# Default Postgres user.

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
sudo apt-get install -q -y bash curl
4949
sudo curl -sSL -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
5050
sudo chmod +x /usr/local/bin/shunit2
51-
sudo curl -sSLO https://github.com/koalaman/shellcheck/releases/download/v0.8.0/shellcheck-v0.8.0.linux.x86_64.tar.xz
52-
sudo tar -xf shellcheck-v0.8.0.linux.x86_64.tar.xz
53-
sudo mv shellcheck-v0.8.0/shellcheck /usr/local/bin/
51+
sudo curl -sSLO https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz
52+
sudo tar -xf shellcheck-v0.10.0.linux.x86_64.tar.xz
53+
sudo mv shellcheck-v0.10.0/shellcheck /usr/local/bin/
5454
sudo chmod +x /usr/local/bin/shellcheck
5555
# Shellcheck Tests
5656
- name: Run shellcheck testing
@@ -114,9 +114,9 @@ jobs:
114114
sudo apt-get install -q -y bash curl
115115
sudo curl -sSL -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
116116
sudo chmod +x /usr/local/bin/shunit2
117-
sudo curl -sSLO https://github.com/koalaman/shellcheck/releases/download/v0.8.0/shellcheck-v0.8.0.linux.x86_64.tar.xz
118-
sudo tar -xf shellcheck-v0.8.0.linux.x86_64.tar.xz
119-
sudo mv shellcheck-v0.8.0/shellcheck /usr/local/bin/
117+
sudo curl -sSLO https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz
118+
sudo tar -xf shellcheck-v0.10.0.linux.x86_64.tar.xz
119+
sudo mv shellcheck-v0.10.0/shellcheck /usr/local/bin/
120120
sudo chmod +x /usr/local/bin/shellcheck
121121
# Shellcheck Tests
122122
- name: Run shellcheck testing

.travis.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in
2020
## Features
2121

2222
* Nginx - A high performance web server and a reverse proxy server.
23-
* Community package from [Ondrej repo](https://launchpad.net/~ondrej/+archive/ubuntu/nginx) or @eilandert's [MyGuard repo](https://deb.myguard.nl/nginx-modules/) with built-in PageSpeed module.
23+
* Community package from [Ondrej repo](https://launchpad.net/~ondrej/+archive/ubuntu/nginx) or @eilandert's [MyGuard repo](https://deb.myguard.nl/nginx-modules/) with built-in modules.
2424
* Custom build from [source](https://github.com/nginx/nginx) featured with :
2525
* [Brotli module](https://github.com/google/ngx_brotli.git) an alternative compression to Gzip
2626
* [Lua Nginx module](https://github.com/openresty/lua-nginx-module) with LuaJIT 2 library
27-
* [PageSpeed module](https://github.com/apache/incubator-pagespeed-ngx) an automatic PageSpeed optimization
2827
* FastCGI [cache purge module](https://github.com/nginx-modules/ngx_cache_purge.git) for atomic cache purging
2928
* Customizable SSL library: OpenSSL (default), LibreSSL, and BoringSSL
3029
* and much more useful 3rd-party modules.
@@ -35,13 +34,14 @@ LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in
3534
* Get an A+ grade on several SSL Security Test ([Qualys SSL Labs](https://www.ssllabs.com/ssltest/analyze.html?d=masedi.net), [ImmuniWeb](https://www.immuniweb.com/ssl/?id=bVrykFnK), and Wormly).
3635
* PHP - Most used language that [powers 78.9% of all websites](https://w3techs.com/technologies/details/pl-php) around the universe.
3736
* Community package from [Ondrej's PHP repository](https://launchpad.net/~ondrej/+archive/ubuntu/php).
38-
* Multiple PHP versions ~7.1 [EOL]~, ~7.2 [EOL]~, ~7.3 [EOL]~, ~7.4 [EOL]~, ~8.0 [EOL]~, 8.1 [SFO], 8.2 [Stable], 8.3 [Latest].
37+
* Multiple PHP versions ~7.1 [EOL]~, ~7.2 [EOL]~, ~7.3 [EOL]~, ~7.4 [EOL]~, ~8.0 [EOL]~, 8.1 [SFO], 8.2 [SFO], 8.3 [Stable], 8.4 [Latest].
3938
* Run PHP as user who own the file (Multi-user isolation via FPM pool).
4039
* Feel the faster Nginx with secure multi-user environment like a top-notch shared hosting.
4140
* Supported PHP Framework and CMS:
4241
* Vanilla PHP: default,
4342
* Framework: codeigniter, laravel, lumen, phalcon, symfony,
44-
* CMS: drupal, mautic, roundcube, sendy, wordpress, wordpress-ms (multi-site), and
43+
* Content Management: drupal, wordpress, wordpress-ms (multi-site),
44+
* Web Application: mautic, owncloud, roundcube, sendy, and
4545
* more coming soon.
4646
* PHP Zend OPcache.
4747
* PHP Loader, ionCube & SourceGuardian.
@@ -115,19 +115,19 @@ lemper-cli site add --help
115115
Example, enable SSL
116116

117117
```bash
118-
sudo lemper-cli manage --enable-ssl example.test
118+
sudo lemper-cli site mod --enable-ssl example.test
119119
```
120120

121121
Example, enable FastCGI cache
122122

123123
```bash
124-
sudo lemper-cli manage --enable-fastcgi-cache example.test
124+
sudo lemper-cli site mod --enable-fastcgi-cache example.test
125125
```
126126

127127
For more info
128128

129129
```bash
130-
sudo lemper-cli manage --help
130+
sudo lemper-cli site mod --help
131131
```
132132

133133
##### for more help
@@ -136,7 +136,7 @@ sudo lemper-cli manage --help
136136
sudo lemper-cli help
137137
```
138138

139-
Note: LEMPer CLI automagically add a new PHP-FPM user's pool configuration if it doesn't exists. You must add the user account first.
139+
Note: LEMPer CLI automagically create new PHP-FPM user's pool configuration if it doesn't exists. You must add the user account first.
140140

141141
### Web-based Administration
142142

bin/lemper-cli.sh

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,57 @@
2020
set -e -o pipefail
2121

2222
# Version control.
23-
PROG_NAME=$(basename "$0")
24-
PROG_VER="2.x.x"
23+
export PROG_NAME && PROG_NAME=$(basename "$0")
24+
export PROG_VERSION && PROG_VERSION="2.x.x"
2525

2626
# Test mode.
2727
DRYRUN=false
2828

29+
# Make sure only root can run this script.
30+
function requires_root() {
31+
if [[ "$(id -u)" -ne 0 ]]; then
32+
if ! hash sudo 2>/dev/null; then
33+
echo "${PROG_NAME} command must be run as 'root' or with sudo."
34+
exit 1
35+
else
36+
#echo "Switching to root user to run this script."
37+
sudo -E "$0" "$@"
38+
exit 0
39+
fi
40+
fi
41+
}
42+
43+
requires_root "$@"
44+
45+
# Export LEMPer Stack configuration.
46+
if [[ -f "/etc/lemper/lemper.conf" ]]; then
47+
# Clean environemnt first.
48+
# shellcheck source=/etc/lemper/lemper.conf
49+
# shellcheck disable=SC2046
50+
unset $(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's/(.*)=.*/\1/' | xargs)
51+
52+
# shellcheck source=/etc/lemper/lemper.conf
53+
# shellcheck disable=SC1094
54+
# shellcheck disable=SC1091
55+
source <(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g')
56+
else
57+
echo "LEMPer Stack configuration required, but the file doesn't exist."
58+
echo "It should be created during installation process and placed under '/etc/lemper/lemper.conf'."
59+
exit 1
60+
fi
61+
62+
# Set default variables.
63+
LEMPER_USERNAME=${LEMPER_USERNAME:-"lemper"}
64+
LEMPER_PASSWORD=${LEMPER_PASSWORD:-""}
65+
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-""}
66+
67+
# Set CLI plugins directory.
68+
CLI_PLUGINS_DIR="/etc/lemper/cli-plugins"
69+
2970
# Color decorator.
30-
RED=91
31-
GREEN=92
32-
YELLOW=93
71+
RED=31
72+
GREEN=32
73+
YELLOW=33
3374

3475
##
3576
# Helper Functions.
@@ -108,54 +149,13 @@ function run() {
108149
fi
109150
}
110151

111-
# Make sure only root can run this script.
112-
function requires_root() {
113-
if [[ "$(id -u)" -ne 0 ]]; then
114-
if ! hash sudo 2>/dev/null; then
115-
echo "${PROG_NAME} command must be run as 'root' or with sudo."
116-
exit 1
117-
else
118-
#echo "Switching to root user to run this script."
119-
sudo -E "$0" "$@"
120-
exit 0
121-
fi
122-
fi
123-
}
124-
125-
requires_root "$@"
126-
127-
# Export LEMPer Stack configuration.
128-
if [[ -f "/etc/lemper/lemper.conf" ]]; then
129-
# Clean environemnt first.
130-
# shellcheck source=/etc/lemper/lemper.conf
131-
# shellcheck disable=SC2046
132-
unset $(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's/(.*)=.*/\1/' | xargs)
133-
134-
# shellcheck source=/etc/lemper/lemper.conf
135-
# shellcheck disable=SC1094
136-
# shellcheck disable=SC1091
137-
source <(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g')
138-
else
139-
echo "LEMPer Stack configuration required, but the file doesn't exist."
140-
echo "It should be created during installation process and placed under '/etc/lemper/lemper.conf'."
141-
exit 1
142-
fi
143-
144-
# Set default variables.
145-
LEMPER_USERNAME=${LEMPER_USERNAME:-"lemper"}
146-
LEMPER_PASSWORD=${LEMPER_PASSWORD:-""}
147-
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-""}
148-
149-
# Set CLI plugins directory.
150-
CLI_PLUGINS_DIR="/etc/lemper/cli-plugins"
151-
152152
##
153153
# Show usage
154154
# output to STDERR.
155155
##
156156
function cmd_help() {
157157
cat <<- EOL
158-
${PROG_NAME} ${PROG_VER}
158+
${PROG_NAME} ${PROG_VERSION}
159159
Command line management tool for LEMPer Stack.
160160
161161
Usage: ${PROG_NAME} [--version] [--help]
@@ -172,13 +172,16 @@ These are common ${PROG_NAME} commands used in various situations:
172172
For help with each command run:
173173
${PROG_NAME} <command> -h | --help
174174
EOL
175+
176+
exit 0
175177
}
176178

177179
##
178180
# Show version.
179181
##
180182
function cmd_version() {
181-
echo "${PROG_NAME} version ${PROG_VER}"
183+
echo "${PROG_NAME} version ${PROG_VERSION}"
184+
exit 0
182185
}
183186

184187
##
@@ -193,21 +196,18 @@ function init_lemper_cli() {
193196
case "${CMD}" in
194197
help | -h | --help)
195198
cmd_help
196-
exit 0
197199
;;
198200
version | -v | --version)
199201
cmd_version
200-
exit 0
201202
;;
202203
*)
203204
if [[ -x "${CLI_PLUGINS_DIR}/lemper-${CMD}" ]]; then
204205
# Source the plugin executable file.
205206
# shellcheck disable=SC1090
206207
. "${CLI_PLUGINS_DIR}/lemper-${CMD}" "$@"
207-
exit 0
208208
else
209-
echo "${PROG_NAME}: '${CMD}' is not ${PROG_NAME} command"
210-
echo "See '${PROG_NAME} --help' for more information"
209+
echo "${PROG_NAME}: '${CMD}' is not valid command."
210+
echo "See '${PROG_NAME} --help' for more information."
211211
exit 1
212212
fi
213213
;;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[Definition]
22

3-
failregex = ^<HOST> .* "POST .*wp-login.php
4-
^<HOST> .* "POST .*xmlrpc.php
3+
failregex = ^<HOST>.* "POST .*(wp-login.php|xmlrpc.php)([/\?#\\].*)? HTTP/.*" 200|401
54
^<HOST> .* "GET .*" 404 .*
65

76
ignoreregex =

etc/logrotate.d/nginx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/var/log/nginx/*.log /home/*/logs/nginx/*_log {
22
daily
3-
rotate 3
3+
rotate 14
44
compress
55
delaycompress
66
missingok

etc/nginx/includes/naxsi.rules

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Sample rules file for default vhost.
2+
3+
#LearningMode;
4+
SecRulesEnabled;
5+
#SecRulesDisabled;
6+
LibInjectionSql;
7+
LibInjectionXss;
8+
9+
DeniedUrl "/RequestDenied";
10+
11+
## Check rules
12+
CheckRule "$SQL >= 8" BLOCK; # SQL injection action (unrelated to libinjection)
13+
CheckRule "$XSS >= 8" BLOCK; # XSS action (unrelated to libinjection)
14+
CheckRule "$RFI >= 8" BLOCK; # Remote File Inclusion action
15+
CheckRule "$UWA >= 8" BLOCK; # Unwanted Access action
16+
CheckRule "$EVADE >= 8" BLOCK; # Evade action (some tools may try to avoid detection).
17+
CheckRule "$UPLOAD >= 5" BLOCK; # Malicious upload action
18+
CheckRule "$TRAVERSAL >= 5" BLOCK; # Traversal access action
19+
CheckRule "$LIBINJECTION_XSS >= 8" BLOCK; # libinjection XSS action
20+
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK; # libinjection SQLi action

0 commit comments

Comments
 (0)