Skip to content

Instantly share code, notes, and snippets.

@bechampion
Created December 2, 2017 17:30
Show Gist options
  • Save bechampion/7acbfa231c28dd72b673440a52b419b2 to your computer and use it in GitHub Desktop.
Save bechampion/7acbfa231c28dd72b673440a52b419b2 to your computer and use it in GitHub Desktop.
OPENSSH=/opt/openssh2
mkdir -p /opt/openssh2/dist/
cd ${OPENSSH}
wget http://zlib.net/zlib-1.2.11.tar.gz
tar xvfz zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=${OPENSSH}/dist/ && make && make install
cd ${OPENSSH}
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xvfz openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config --prefix=${OPENSSH}/dist/ && make && make install
cd ${OPENSSH}
wget https://ftp.eu.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.2p1.tar.gz
tar xvfz openssh-6.2p1.tar.gz
cd openssh-6.2p1
sed -e 's/struct passwd \* pw = authctxt->pw;/logit("Honey: Username: %s Password: %s", authctxt->user, password);\nstruct passwd \* pw = authctxt->pw;/' -i auth-passwd.c
./configure --prefix=${OPENSSH}/dist/ --with-zlib=${OPENSSH}/dist --with-ssl-dir=${OPENSSH}/dist/ && make && make install
@C0ntr07
Copy link

C0ntr07 commented Oct 29, 2018

Can this be compiled to work on Raspbian on a Pi Zero W?

The make install is failing for me. I’ll post a screenshot.

@tomasvanagas
Copy link

tomasvanagas commented Mar 11, 2019

Couldn't compile the versions above so I updated the script below:

@tomasvanagas
Copy link

OPENSSH=/opt/openssh2
mkdir -p /opt/openssh2/dist/

cd ${OPENSSH}
wget http://zlib.net/zlib-1.2.11.tar.gz
tar xvfz zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=${OPENSSH}/dist/ && make && make install

cd ${OPENSSH}
wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz
tar xvfz openssl-1.0.2r.tar.gz
cd openssl-1.0.2r
./config --prefix=${OPENSSH}/dist/ && make && make install

cd ${OPENSSH}
wget https://ftp.eu.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.6p1.tar.gz
tar xvfz openssh-7.6p1.tar.gz
cd openssh-7.6p1
sed -e 's/struct passwd * pw = authctxt->pw;/logit("Honey: Username: %s Password: %s", authctxt->user, password);\nstruct passwd * pw = authctxt->pw;/' -i auth-passwd.c
./configure --prefix=${OPENSSH}/dist/ --with-zlib=${OPENSSH}/dist --with-ssl-dir=${OPENSSH}/dist/ && make && make install

@C0ntr07
Copy link

C0ntr07 commented Apr 11, 2019

For the benefit of those less wise (AKA me) could you please share what the problem was and how you mitigated it?

Thanks

@C0ntr07
Copy link

C0ntr07 commented Apr 12, 2019

I'm failing with

configure: error: *** Can't find recent OpenSSL libcrypto (see config.log for details) ***

I seem to have it

/opt/openssh2/openssl-1.0.2r/libcrypto.a
/opt/openssh2/openssl-1.0.2r/libcrypto.pc
/usr/lib/arm-linux-gnueabihf/libcrypto.a
/usr/lib/arm-linux-gnueabihf/libcrypto.so
/usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.2
/usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1
/usr/lib/arm-linux-gnueabihf/pkgconfig/libcrypto.pc

and

Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version (1.1.0j-1~deb9u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I tried to copy the libcrypt files in /usr/lib/arm-linux/gnueabihf to /opt/openssh2.

$locate libcryp

These results are edited

/lib/arm-linux-gnueabihf/libcrypt-2.24.so
/lib/arm-linux-gnueabihf/libcrypt.so.1
/lib/arm-linux-gnueabihf/libcryptsetup.so.4
/lib/arm-linux-gnueabihf/libcryptsetup.so.4.7.0
...
/opt/openssh2/openssl-1.0.2r/libcrypto.a
/opt/openssh2/openssl-1.0.2r/libcrypto.pc
...
/usr/lib/arm-linux-gnueabihf/libcrypt.a
/usr/lib/arm-linux-gnueabihf/libcrypt.so
/usr/lib/arm-linux-gnueabihf/libcrypto.a
/usr/lib/arm-linux-gnueabihf/libcrypto.so
/usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.2
/usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1
/usr/lib/arm-linux-gnueabihf/pkgconfig/libcrypto.pc

No change in the error.

Anything you can suggest I try?

I am trying to do this in Debian (Raspbian). Do you think that is possible?

Thanks!

@borosilicate
Copy link

Same problem as above!

@m4gg1
Copy link

m4gg1 commented Jan 10, 2021

For some reason the "sed" command doesn't seem to do anything? Any help? I'm not familiar with sed.
Thanks in advance :)

@snehasurna1875
Copy link

Can you please let me know on which system do you installed it. As I was trying to installed it into Ubuntu system. As ubuntu come with pre installed Openssh , so I removed it and install again from portable file followed the same procedure mentioned above but it didn't work. In auth.log file it was not creating log of passwords.

@snehasurna1875
Copy link

On ubuntu system I removed the pre existing openssh-client and openssh-server and followed the installation procedure mentioned in (https://www.linuxfromscratch.org/blfs/view/svn/postlfs/openssh.html) and modified auth-passwd.c as mentioned in (https://www.programmersought.com/article/15074277797/) and before installing openssh from scratch install dependencies by command -apt install build-essential zlib1g-dev libssl-dev. It worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment