From 879b8a4ba3c5ebb42e4693285ea5b047cbbdefd2 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Mon, 23 Apr 2018 20:09:15 +0200 Subject: [PATCH] armbian: fix root SSH in build and other fixes --- armbian.sh | 10 ++++++---- etc/ncp-config.d/nc-nextcloud.sh | 13 +++++-------- install.sh | 7 ++++--- nextcloudplus.sh | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/armbian.sh b/armbian.sh index 186b1b89..5d1559ae 100644 --- a/armbian.sh +++ b/armbian.sh @@ -31,14 +31,12 @@ Main() { # indicate that this will be an Armbian image build touch /.ncp-image - export ARMBIANBUILD # install NCP curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash - # restore postfix package half-configured status - sed -i '/Package: postfix/{n;d}' /var/lib/dpkg/status - sed -i '/Package: postfix/a;Status: install ok half-configured|' /var/lib/dpkg/status + # permit root login in SSH + sed -i 's|^PermitRootLogin .*|PermitRootLogin yes|' /etc/ssh/sshd_config # force change root password at first login (again) chage -d 0 root @@ -56,6 +54,10 @@ Main() { cleanup_script $script done + # restore postfix package half-configured status + sed -i '/^Package: postfix$/{n;d}' /var/lib/dpkg/status + sed -i '/^Package: postfix$/aStatus: install ok half-configured' /var/lib/dpkg/status + # enable randomize passwords systemctl enable nc-provisioning diff --git a/etc/ncp-config.d/nc-nextcloud.sh b/etc/ncp-config.d/nc-nextcloud.sh index 856a3799..d29654c7 100644 --- a/etc/ncp-config.d/nc-nextcloud.sh +++ b/etc/ncp-config.d/nc-nextcloud.sh @@ -49,14 +49,11 @@ install() $APTINSTALL php-smbclient # POSTFIX - [[ "$ARMBIANBUILD" != 1 ]] && { - $APTINSTALL postfix - } || { - # post installation script fails, so mark as no problem for the rest of the build - echo "[NCP] Please, ignore the following postfix installation errors ..." - $APTINSTALL postfix || true - sed -i '/Package: postfix/{n;d}' /var/lib/dpkg/status - sed -i '/Package: postfix/a;Status: install ok installed|' /var/lib/dpkg/status + $APTINSTALL postfix || { + # post installation script fails in Armbian build, so mark as no problem for the rest of the build + echo "[NCP] Please, ignore the previous postfix installation error" + sed -i '/^Package: postfix$/{n;d}' /var/lib/dpkg/status + sed -i '/^Package: postfix$/aStatus: install ok installed' /var/lib/dpkg/status } sed -i 's|^smtpd_banner .*|smtpd_banner = $myhostname ESMTP|' /etc/postfix/main.cf sed -i 's|^disable_vrfy_command .*|disable_vrfy_command = yes|' /etc/postfix/main.cf diff --git a/install.sh b/install.sh index d265e1c0..a8b96960 100644 --- a/install.sh +++ b/install.sh @@ -9,7 +9,8 @@ # # more details at https://ownyourbits.com -#DBG=x +BRANCH=master +DBG=x set -e$DBG @@ -37,10 +38,10 @@ apt-get install --no-install-recommends -y wget ca-certificates sudo rm -rf "$TMPDIR" && mkdir "$TMPDIR" && cd "$TMPDIR" wget -O- --no-check-certificate --content-disposition \ - https://github.com/nextcloud/nextcloudpi/archive/master/latest.tar.gz \ + https://github.com/nextcloud/nextcloudpi/archive/"$BRANCH"/latest.tar.gz \ | tar -xz \ || exit 1 -cd - && cd "$TMPDIR"/nextcloudpi-master +cd - && cd "$TMPDIR"/nextcloudpi-"$BRANCH" # install NCP echo -e "\nInstalling NextCloudPlus" diff --git a/nextcloudplus.sh b/nextcloudplus.sh index cc469ad8..16775cf6 100644 --- a/nextcloudplus.sh +++ b/nextcloudplus.sh @@ -16,6 +16,7 @@ WEBADMIN=ncp WEBPASSWD=ownyourbits +BRANCH=master CONFDIR=/usr/local/etc/ncp-config.d/ UPLOADTMPDIR=/var/www/nextcloud/data/tmp @@ -186,10 +187,10 @@ EOF # update to latest version from github as part of the build process $APTINSTALL git - wget https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/bin/ncp-update -O /usr/local/bin/ncp-update + wget https://raw.githubusercontent.com/nextcloud/nextcloudpi/$BRANCH/bin/ncp-update -O /usr/local/bin/ncp-update chmod a+x /usr/local/bin/ncp-update - /usr/local/bin/ncp-update + /usr/local/bin/ncp-update $BRANCH # ONLY FOR IMAGE BUILDS if [[ -f /.ncp-image ]]; then @@ -230,8 +231,7 @@ EOF sed -i 's|^#LogLevel .*|LogLevel VERBOSE|' /etc/ssh/sshd_config sed -i 's|^#Compression .*|Compression no|' /etc/ssh/sshd_config sed -i 's|^#AllowAgentForwarding .*|AllowAgentForwarding no|' /etc/ssh/sshd_config - [[ "$ARMBIANBUILD" != "1" ]] && \ - sed -i 's|^#PermitRootLogin .*|PermitRootLogin no|' /etc/ssh/sshd_config + sed -i 's|^#PermitRootLogin .*|PermitRootLogin no|' /etc/ssh/sshd_config } ## kernel hardening