From 2969096e7562978f39316e858f976207c067b9be Mon Sep 17 00:00:00 2001 From: Leonid Plyushch Date: Sun, 21 Oct 2018 15:21:06 +0300 Subject: [PATCH] openssh: enable password auth --- packages/openssh/auth2-passwd.c.patch | 21 +++++++++++++++++++++ packages/openssh/build.sh | 6 ++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 packages/openssh/auth2-passwd.c.patch mode change 100755 => 100644 packages/openssh/build.sh diff --git a/packages/openssh/auth2-passwd.c.patch b/packages/openssh/auth2-passwd.c.patch new file mode 100644 index 000000000..dbd5055e8 --- /dev/null +++ b/packages/openssh/auth2-passwd.c.patch @@ -0,0 +1,21 @@ +diff -uNr openssh-7.9p1/auth2-passwd.c openssh-7.9p1.mod/auth2-passwd.c +--- openssh-7.9p1/auth2-passwd.c 2018-10-17 03:01:20.000000000 +0300 ++++ openssh-7.9p1.mod/auth2-passwd.c 2018-10-21 14:30:10.208918070 +0300 +@@ -30,6 +30,8 @@ + #include + #include + ++#include ++ + #include "packet.h" + #include "ssherr.h" + #include "log.h" +@@ -62,7 +64,7 @@ + + if (change) + logit("password change not supported"); +- else if (PRIVSEP(auth_password(ssh, password)) == 1) ++ else if (termux_auth(((Authctxt *)ssh->authctxt)->user, password)) + authenticated = 1; + explicit_bzero(password, len); + free(password); diff --git a/packages/openssh/build.sh b/packages/openssh/build.sh old mode 100755 new mode 100644 index c61b2cc03..8029ea3d8 --- a/packages/openssh/build.sh +++ b/packages/openssh/build.sh @@ -1,9 +1,10 @@ TERMUX_PKG_HOMEPAGE=https://www.openssh.com/ TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine" TERMUX_PKG_VERSION=7.9p1 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad TERMUX_PKG_SRCURL=https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil" +TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil, termux-auth" TERMUX_PKG_CONFLICTS="dropbear" # --disable-strip to prevent host "install" command to use "-s", which won't work for target binaries: TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" @@ -50,6 +51,7 @@ termux_step_pre_configure() { CPPFLAGS+=" -DHAVE_ATTRIBUTE__SENTINEL__=1 -DBROKEN_SETRESGID" LD=$CC # Needed to link the binaries LDFLAGS+=" -llog" # liblog for android logging in syslog hack + LDFLAGS+=" -ltermux-auth" # libtermux-auth for password auth } termux_step_post_configure() { @@ -61,7 +63,7 @@ termux_step_post_configure() { termux_step_post_make_install () { # "PrintMotd no" is due to our login program already showing it. # OpenSSH 7.0 disabled ssh-dss by default, keep it for a while in Termux: - echo -e "PrintMotd no\nPasswordAuthentication no\nPubkeyAcceptedKeyTypes +ssh-dss\nSubsystem sftp $TERMUX_PREFIX/libexec/sftp-server" > $TERMUX_PREFIX/etc/ssh/sshd_config + echo -e "PrintMotd no\nPasswordAuthentication yes\nPubkeyAcceptedKeyTypes +ssh-dss\nSubsystem sftp $TERMUX_PREFIX/libexec/sftp-server" > $TERMUX_PREFIX/etc/ssh/sshd_config printf "PubkeyAcceptedKeyTypes +ssh-dss\nSendEnv LANG\n" > $TERMUX_PREFIX/etc/ssh/ssh_config cp $TERMUX_PKG_BUILDER_DIR/source-ssh-agent.sh $TERMUX_PREFIX/bin/source-ssh-agent cp $TERMUX_PKG_BUILDER_DIR/ssh-with-agent.sh $TERMUX_PREFIX/bin/ssha