armbian: fix root SSH in build and other fixes

This commit is contained in:
nachoparker 2018-04-23 20:09:15 +02:00
parent 83fd26438b
commit 879b8a4ba3
4 changed files with 19 additions and 19 deletions

View File

@ -31,14 +31,12 @@ Main() {
# indicate that this will be an Armbian image build # indicate that this will be an Armbian image build
touch /.ncp-image touch /.ncp-image
export ARMBIANBUILD
# install NCP # install NCP
curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash
# restore postfix package half-configured status # permit root login in SSH
sed -i '/Package: postfix/{n;d}' /var/lib/dpkg/status sed -i 's|^PermitRootLogin .*|PermitRootLogin yes|' /etc/ssh/sshd_config
sed -i '/Package: postfix/a;Status: install ok half-configured|' /var/lib/dpkg/status
# force change root password at first login (again) # force change root password at first login (again)
chage -d 0 root chage -d 0 root
@ -56,6 +54,10 @@ Main() {
cleanup_script $script cleanup_script $script
done 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 # enable randomize passwords
systemctl enable nc-provisioning systemctl enable nc-provisioning

View File

@ -49,14 +49,11 @@ install()
$APTINSTALL php-smbclient $APTINSTALL php-smbclient
# POSTFIX # POSTFIX
[[ "$ARMBIANBUILD" != 1 ]] && { $APTINSTALL postfix || {
$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"
# post installation script fails, so mark as no problem for the rest of the build sed -i '/^Package: postfix$/{n;d}' /var/lib/dpkg/status
echo "[NCP] Please, ignore the following postfix installation errors ..." sed -i '/^Package: postfix$/aStatus: install ok installed' /var/lib/dpkg/status
$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
} }
sed -i 's|^smtpd_banner .*|smtpd_banner = $myhostname ESMTP|' /etc/postfix/main.cf 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 sed -i 's|^disable_vrfy_command .*|disable_vrfy_command = yes|' /etc/postfix/main.cf

View File

@ -9,7 +9,8 @@
# #
# more details at https://ownyourbits.com # more details at https://ownyourbits.com
#DBG=x BRANCH=master
DBG=x
set -e$DBG 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" rm -rf "$TMPDIR" && mkdir "$TMPDIR" && cd "$TMPDIR"
wget -O- --no-check-certificate --content-disposition \ 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 \ | tar -xz \
|| exit 1 || exit 1
cd - && cd "$TMPDIR"/nextcloudpi-master cd - && cd "$TMPDIR"/nextcloudpi-"$BRANCH"
# install NCP # install NCP
echo -e "\nInstalling NextCloudPlus" echo -e "\nInstalling NextCloudPlus"

View File

@ -16,6 +16,7 @@
WEBADMIN=ncp WEBADMIN=ncp
WEBPASSWD=ownyourbits WEBPASSWD=ownyourbits
BRANCH=master
CONFDIR=/usr/local/etc/ncp-config.d/ CONFDIR=/usr/local/etc/ncp-config.d/
UPLOADTMPDIR=/var/www/nextcloud/data/tmp UPLOADTMPDIR=/var/www/nextcloud/data/tmp
@ -186,10 +187,10 @@ EOF
# update to latest version from github as part of the build process # update to latest version from github as part of the build process
$APTINSTALL git $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 chmod a+x /usr/local/bin/ncp-update
/usr/local/bin/ncp-update /usr/local/bin/ncp-update $BRANCH
# ONLY FOR IMAGE BUILDS # ONLY FOR IMAGE BUILDS
if [[ -f /.ncp-image ]]; then if [[ -f /.ncp-image ]]; then
@ -230,8 +231,7 @@ EOF
sed -i 's|^#LogLevel .*|LogLevel VERBOSE|' /etc/ssh/sshd_config sed -i 's|^#LogLevel .*|LogLevel VERBOSE|' /etc/ssh/sshd_config
sed -i 's|^#Compression .*|Compression no|' /etc/ssh/sshd_config sed -i 's|^#Compression .*|Compression no|' /etc/ssh/sshd_config
sed -i 's|^#AllowAgentForwarding .*|AllowAgentForwarding 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 ## kernel hardening