Browse Source

openssh: enable password auth

android-5
Leonid Plyushch 6 years ago
committed by Fredrik Fornwall
parent
commit
2969096e75
  1. 21
      packages/openssh/auth2-passwd.c.patch
  2. 6
      packages/openssh/build.sh

21
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 <string.h>
#include <stdarg.h>
+#include <termux-auth.h>
+
#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);

6
packages/openssh/build.sh

@ -1,9 +1,10 @@
TERMUX_PKG_HOMEPAGE=https://www.openssh.com/ TERMUX_PKG_HOMEPAGE=https://www.openssh.com/
TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine" TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
TERMUX_PKG_VERSION=7.9p1 TERMUX_PKG_VERSION=7.9p1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad TERMUX_PKG_SHA256=6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad
TERMUX_PKG_SRCURL=https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz 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" TERMUX_PKG_CONFLICTS="dropbear"
# --disable-strip to prevent host "install" command to use "-s", which won't work for target binaries: # --disable-strip to prevent host "install" command to use "-s", which won't work for target binaries:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
@ -50,6 +51,7 @@ termux_step_pre_configure() {
CPPFLAGS+=" -DHAVE_ATTRIBUTE__SENTINEL__=1 -DBROKEN_SETRESGID" CPPFLAGS+=" -DHAVE_ATTRIBUTE__SENTINEL__=1 -DBROKEN_SETRESGID"
LD=$CC # Needed to link the binaries LD=$CC # Needed to link the binaries
LDFLAGS+=" -llog" # liblog for android logging in syslog hack LDFLAGS+=" -llog" # liblog for android logging in syslog hack
LDFLAGS+=" -ltermux-auth" # libtermux-auth for password auth
} }
termux_step_post_configure() { termux_step_post_configure() {
@ -61,7 +63,7 @@ termux_step_post_configure() {
termux_step_post_make_install () { termux_step_post_make_install () {
# "PrintMotd no" is due to our login program already showing it. # "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: # 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 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/source-ssh-agent.sh $TERMUX_PREFIX/bin/source-ssh-agent
cp $TERMUX_PKG_BUILDER_DIR/ssh-with-agent.sh $TERMUX_PREFIX/bin/ssha cp $TERMUX_PKG_BUILDER_DIR/ssh-with-agent.sh $TERMUX_PREFIX/bin/ssha

Loading…
Cancel
Save