Skip to content

Commit

Permalink
Merge pull request #137 from joglomedia/2.x.x
Browse files Browse the repository at this point in the history
### Bug fixes
- Error when Installing phpMemcachedAdmin panel #136

### New Features
- Added Pure-FTPD as an alternative FTP server
- cURL'd installation wrapper
  - Installation from cURL as below:
    - Development: `curl -sSL https://get.lemper.cloud | sudo bash -s -- install --development`
    - Production: `curl -sSL https://get.lemper.cloud | sudo bash -s -- install --production`
  - Available parameters:
    - `--with-nginx=<version>`, available version: stable, latest | mainline, version-number (e.g. 1.20)
    - `--with-nginx-installer=<installer>`, available installer: source | repo
    - `--with-nginx-custom-ssl=<custom_ssl-version>`, example: openssl-1.1.1l | boringssl-master | libressl-3.0.0
    - `--with-nginx-lua`, compile Nginx with Lua module
    - `--with-nginx-pagespeed`, compile Nginx with PageSpeed module
    - `--with-nginx-passenger`, compile Nginx with Passenger module (Passenger installation required)
    - `--with-nginx-pcre=<version>`, example: 8.45
    - `--with-nginx-rtmp`, compile Nginx with RTMP module
    - `--with-php=<version>`, available version: 5.6, 7.0 - 7.4, 8.0, 8.1
    - `--with-php-extensions=<ext-name-1 ext-name-2 ext-name-x>`, example: imagick igbinary json
    - `--with-php-loader=<loader_name>`, available loader: ioncube | sourceguardian | all
    - `--with-mysql-server=mysql_server-version>`, example: mariadb-10.6 | mysql-5.7
    - `--with-memcached=<version>`, available version: latest | stable | version-number (e.g. 1.6.10)
    - `--with-memcached-installer=<installer>`, available installer: source | repo
    - `--with-mongodb=<version>`, example: 4.2, 4.3, 4.4, or 5.0
    - `--with-mongodb-admin=<username:password>`, username: admin username, password: admin password
    - `--with-redis=<version>`, available version: latest | stable | version-number (e.g. 6.2.5)
    - `--with-redis-installer=<installer>`, available installer: source | repo
    - `--with-redis-requirepass=<password>`, Redis password
    - `--with-ftp-server=<ftp_server-version>`,  example: vsftpd-3.0.5 | pureftpd-1.0.50
    - `--with-mailer`, install Postfix (Mail Transfer Agent) & Dovecot (IMAP-POP3 server)
    - `--with-mail-sender-domain=<domain>`, default mail sender domain (FQDN format)
    - `--with-ssh-port=<port_number>`, example: 22, 2269
    - `--with-ssh-passwordless`, enable SSH password-less login (requires SSH public key set up)
    - `--with-ssh-pub-key=<public_key_string>`, public key string
    - `--hostname=<host_name>`, server hostname in fully qualified domain name format (e.g host.lemper.test)
    - `--ipv4=<ipv4_address>`, server static / public IPv4 address
    - `--admin-email=<email_address>`, your stack administrator email (for notification, default Let's Encrypt account, and Mail sender)
    - `--fix-broken-install`, fix broken installation (broken apt installation)
    - `--dry-run`, run installer in dry run mode (testing)
    - `--debug`, run installer in debug mode (more verbose output)
    - `--force`, force installation and removal of existing installed software package
    - `--guided`, enter guided installation mode
    - `--development`, install LEMPer Stack on development or local environment
    - `--production`, install LEMPer Stack on production environment
  • Loading branch information
joglomedia committed May 4, 2022
2 parents d5cd2dc + a6c46bf commit 9cc3e04
Show file tree
Hide file tree
Showing 15 changed files with 656 additions and 69 deletions.
17 changes: 10 additions & 7 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,24 @@ REDIS_VERSION="stable"
REDIS_REQUIRE_PASSWORD=false
REDIS_PASSWORD=""

[vsftpd]
INSTALL_VSFTPD=true
[ftpd]
INSTALL_FTP_SERVER=true

# Available installer: repo | source.
VSFTPD_INSTALLER="source"
FTP_SERVER_INSTALLER="source"

# Available version: 3.0.5 or latest.
VSFTPD_VERSION="3.0.5"
# Supported FTP server: vsftpd | pureftpd.
FTP_SERVER_NAME="vsftpd"

# Available version: 3.0.5 (vsftpd), 1.0.50 (pure-ftpd), or latest.
FTP_SERVER_VERSION="latest"

# Enable FTP over TLS.
VSFTPD_SSL_ENABLE=true
FTP_SSL_ENABLE=true

# Range of passv ports.
FTP_MIN_PORT=45000
FTP_MAX_PORT=45099
FTP_MAX_PORT=45999

[dns]
# TODO: Install DNS server.
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ on:
push:
branches:
- '2.x.x'
- '3.x.x'
- 'master'
pull_request:
branches:
- '2.x.x'
- '3.x.x'
- 'master'
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -48,9 +46,9 @@ jobs:
sudo apt-get install -q -y bash curl
sudo curl -sSL -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2
sudo chmod +x /usr/local/bin/shunit2
sudo curl -sSLO https://github.com/koalaman/shellcheck/releases/download/v0.7.2/shellcheck-v0.7.2.linux.x86_64.tar.xz
sudo tar -xf shellcheck-v0.7.2.linux.x86_64.tar.xz
sudo mv shellcheck-v0.7.2/shellcheck /usr/local/bin/
sudo curl -sSLO https://github.com/koalaman/shellcheck/releases/download/v0.8.0/shellcheck-v0.8.0.linux.x86_64.tar.xz
sudo tar -xf shellcheck-v0.8.0.linux.x86_64.tar.xz
sudo mv shellcheck-v0.8.0/shellcheck /usr/local/bin/
sudo chmod +x /usr/local/bin/shellcheck
# Shellcheck Tests
- name: Run shellcheck testing
Expand Down
117 changes: 117 additions & 0 deletions etc/init.d/pure-ftpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: pure-ftpd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: slapd mysql postgresql-8.3 postgresql-8.4
# Should-Stop: slapd mysql postgresql-8.3 postgresql-8.4
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#
# pure-ftpd starts and stops the pure-ftpd ftp daemon
#
# Copyright 2002-2011 by Stefan Hornburg (Racke) <racke@linuxia.de>

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=pure-ftpd
DESC="ftp server"
: ${SSDAEMONLOGOPTS:="--quiet"}
UPLOADDAEMON=/usr/sbin/pure-uploadscript
UDNAME=pure-uploadscript
UDDESC="ftp upload handler"
WRAPPER=/usr/sbin/pure-ftpd-wrapper

# load LSB init-functions to get status_of_proc helper
. /lib/lsb/init-functions

PIDFILE=/var/run/pure-ftpd/pure-ftpd.pid

# try to figure with suffix this script is called,
# $0 might be a symlink pointing to this script
if [ -h $0 ]; then
ME=`/bin/readlink $0`
else
ME=$0
fi

SUFFIX=`basename $ME | sed -ne 's/^pure-ftpd-\(.*\)/\1/p'`
if [ "$SUFFIX" ] ; then
DAEMON=/usr/sbin/pure-ftpd-$SUFFIX
else
DAEMON=/usr/sbin/pure-ftpd
fi

export STANDALONE_OR_INETD=inetd
export VIRTUALCHROOT=
test -r /etc/default/pure-ftpd-common && . /etc/default/pure-ftpd-common

if [ "$VIRTUALCHROOT" = "true" ]; then
if [ "$SUFFIX" ]; then
SUFFIX="$SUFFIX-virtualchroot"
else
SUFFIX="virtualchroot"
fi
fi

test -x $DAEMON || exit 0
test -x $WRAPPER || exit 0

set -e

if [ ! -e `dirname $PIDFILE` ];then
mkdir `dirname $PIDFILE`
fi

start_uploadscript() {
if [ "$UPLOADSCRIPT" -a "$STANDALONE_OR_INETD" != inetd ] && \
egrep -i '^[ ]*(yes|1|on)[ ]*' /etc/pure-ftpd/conf/CallUploadScript > /dev/null 2>&1
then
UOPTS=""
test "$UPLOADUID" && UOPTS="$UOPTS -u $UPLOADUID"
test "$UPLOADGID" && UOPTS="$UOPTS -g $UPLOADGID"
echo -n "$1 $UDDESC: "
start-stop-daemon --start $SSDAEMONLOGOPTS --oknodo \
--exec $UPLOADDAEMON -- -r "$UPLOADSCRIPT" -B $UOPTS
echo "$UDNAME."

fi
}

case "$1" in
start)
test "$STANDALONE_OR_INETD" = standalone || exit 0
echo -n "Starting $DESC: "
--start $SSDAEMONLOGOPTS --pidfile "$PIDFILE" \
--exec $WRAPPER -- $SUFFIX
start_uploadscript Starting
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
--pidfile "$PIDFILE"
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
echo "$NAME."
;;
restart|force-reload)
test "$STANDALONE_OR_INETD" = standalone || exit 0
echo -n "Restarting $DESC: "
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
--pidfile "$PIDFILE"
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
sleep 1
start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile "$PIDFILE" \
--exec $WRAPPER -- $SUFFIX
start_uploadscript Restarting
;;
status)
status_of_proc -p /var/run/pure-ftpd/pure-ftpd.pid $DAEMON $NAME && exit 0 || exit $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac

exit 0
27 changes: 27 additions & 0 deletions etc/systemd/pure-ftpd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Automatically generated by systemd-sysv-generator

[Unit]
Description=Free FTP Server with a strong focus on software security installed using LEMPer Stack
Documentation=https://www.pureftpd.org/project/pure-ftpd/, man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/pure-ftpd
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=remote-fs.target
After=slapd.service
After=mysql.service
After=postgresql-8.3.service
After=postgresql-8.4.service

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/etc/init.d/pure-ftpd start
ExecStop=/etc/init.d/pure-ftpd stop
15 changes: 11 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,17 @@ if [ -f ./scripts/install_mailer.sh ]; then
. ./scripts/install_mailer.sh
fi

### VSFTPD installation ###
if [ -f ./scripts/install_vsftpd.sh ]; then
echo ""
. ./scripts/install_vsftpd.sh
### FTP installation ###
if [[ "${FTP_SERVER_NAME}" == "pureftpd" || "${FTP_SERVER_NAME}" == "pure-ftpd" ]]; then
if [ -f ./scripts/install_pureftpd.sh ]; then
echo ""
. ./scripts/install_pureftpd.sh
fi
else
if [ -f ./scripts/install_vsftpd.sh ]; then
echo ""
. ./scripts/install_vsftpd.sh
fi
fi

### Fail2ban, intrusion prevention software framework. ###
Expand Down

0 comments on commit 9cc3e04

Please sign in to comment.