From c48e01bd9b676fe4ea70bf7ccfd333641f555cbc Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Wed, 4 May 2022 09:32:40 +0700 Subject: [PATCH] Enable vsftpd system daemon --- scripts/install_vsftpd.sh | 29 ++++++++++++++--------------- scripts/remove_vsftpd.sh | 1 + 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/install_vsftpd.sh b/scripts/install_vsftpd.sh index 6d31734..e1e4935 100755 --- a/scripts/install_vsftpd.sh +++ b/scripts/install_vsftpd.sh @@ -26,19 +26,19 @@ function init_vsftpd_install() { local SELECTED_INSTALLER="" if [[ "${AUTO_INSTALL}" == true ]]; then - if [[ "${INSTALL_VSFTPD}" == true ]]; then - DO_INSTALL_VSFTPD="y" - SELECTED_INSTALLER=${VSFTPD_INSTALLER:-"repo"} + if [[ "${INSTALL_FTP_SERVER}" == true ]]; then + DO_INSTALL_FTP_SERVER="y" + SELECTED_INSTALLER=${FTP_SERVER_INSTALLER:-"repo"} else - DO_INSTALL_VSFTPD="n" + DO_INSTALL_FTP_SERVER="n" fi else - while [[ "${DO_INSTALL_VSFTPD}" != "y" && "${DO_INSTALL_VSFTPD}" != "n" ]]; do - read -rp "Do you want to install FTP server (VSFTPD)? [y/n]: " -i y -e DO_INSTALL_VSFTPD + while [[ "${DO_INSTALL_FTP_SERVER}" != "y" && "${DO_INSTALL_FTP_SERVER}" != "n" ]]; do + read -rp "Do you want to install FTP server (VSFTPD)? [y/n]: " -i y -e DO_INSTALL_FTP_SERVER done fi - if [[ ${DO_INSTALL_VSFTPD} == y* || ${DO_INSTALL_VSFTPD} == Y* ]]; then + if [[ ${DO_INSTALL_FTP_SERVER} == y* || ${DO_INSTALL_FTP_SERVER} == Y* ]]; then echo "Available VSFTPD installation method:" echo " 1). Install from Repository (repo)" echo " 2). Compile from Source (source)" @@ -53,9 +53,6 @@ function init_vsftpd_install() { 1 | "repo") echo "Installing FTP server (VSFTPD) from repository..." run apt-get install -qq -y vsftpd - - # Backup original config. - run cp /etc/vsftpd.conf /etc/vsftpd.conf.backup ;; 2 | "source") echo "Installing FTP server (VSFTPD) from source..." @@ -121,21 +118,21 @@ function init_vsftpd_install() { local CURRENT_DIR && \ CURRENT_DIR=$(pwd) - if [[ "${VSFTPD_VERSION}" == "latest" ]]; then + if [[ "${FTP_SERVER_VERSION}" == "latest" || "${FTP_SERVER_VERSION}" == "stable" ]]; then VSFTPD_FILENAME="vsftpd-3.0.5.tar.gz" VSFTPD_ZIP_URL="https://security.appspot.com/downloads/${VSFTPD_FILENAME}" else - VSFTPD_FILENAME="vsftpd-${VSFTPD_VERSION}.tar.gz" + VSFTPD_FILENAME="vsftpd-${FTP_SERVER_VERSION}.tar.gz" VSFTPD_ZIP_URL="https://security.appspot.com/downloads/${VSFTPD_FILENAME}" fi run cd "${BUILD_DIR}" && \ run wget -q "${VSFTPD_ZIP_URL}" && \ run tar -zxf "${VSFTPD_FILENAME}" && \ - run cd vsftpd-*/ || return 1 + run cd "${VSFTPD_FILENAME%.*.*}" / || return 1 # If SSL Enabled, modify the builddefs.h file. - if [[ "${VSFTPD_SSL_ENABLE}" == true ]]; then + if [[ "${FTP_SSL_ENABLE}" == true ]]; then run sed -i 's/\#undef\ VSF_BUILD_SSL/\#define\ VSF_BUILD_SSL/g' ./builddefs.h fi @@ -207,7 +204,7 @@ EOL # Enable SSL. # TODO: Change the self-signed certificate with a valid Let's Encrypt certificate. - if [[ "${VSFTPD_SSL_ENABLE}" == true ]]; then + if [[ "${FTP_SSL_ENABLE}" == true ]]; then cat >> /etc/vsftpd.conf <