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
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

View File

@ -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

View File

@ -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"

View File

@ -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