Skip to content

Commit

Permalink
remove built-in support for md5crypt()
Browse files Browse the repository at this point in the history
Users of MD5-hashed password should arrange for ./configure to link
against libxcrypt or similar. Though it would be better to avoid use
of MD5 password hashing entirely, it's arguably worse than DEScrypt.

feedback and ok dtucker@
  • Loading branch information
djmdjm committed Oct 28, 2021
1 parent c5de1ff commit a5ab488
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 232 deletions.
5 changes: 0 additions & 5 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ it if lastlog is installed in a different place.
--with-osfsia, --without-osfsia will enable or disable OSF1's Security
Integration Architecture. The default for OSF1 machines is enable.

--with-md5-passwords will enable the use of MD5 passwords. Enable this
if your operating system uses MD5 passwords and the system crypt() does
not support them directly (see the crypt(3/3c) man page). If enabled, the
resulting binary will support both MD5 and traditional crypt passwords.

--with-utmpx enables utmpx support. utmpx support is automatic for
some platforms.

Expand Down
12 changes: 2 additions & 10 deletions LICENCE
Original file line number Diff line number Diff line change
Expand Up @@ -210,22 +210,14 @@ OpenSSH contains no GPL code.

8) Portable OpenSSH contains the following additional licenses:

a) md5crypt.c, md5crypt.h

* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain this
* notice you can do whatever you want with this stuff. If we meet
* some day, and you think this stuff is worth it, you can buy me a
* beer in return. Poul-Henning Kamp

b) snprintf replacement
a) snprintf replacement

* Copyright Patrick Powell 1995
* This code is based on code written by Patrick Powell
* ([email protected]) It may be used for any purpose as long as this
* notice remains intact on all source code distributions

c) Compatibility code (openbsd-compat)
b) Compatibility code (openbsd-compat)

Apart from the previously mentioned licenses, various pieces of code
in the openbsd-compat/ subdirectory are licensed as follows:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \
auth2-none.o auth2-passwd.o auth2-pubkey.o \
monitor.o monitor_wrap.o auth-krb5.o \
auth2-gss.o gss-serv.o gss-serv-krb5.o \
loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
loginrec.o auth-pam.o auth-shadow.o auth-sia.o \
srclimit.o sftp-server.o sftp-common.o \
sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \
sandbox-seccomp-filter.o sandbox-capsicum.o sandbox-pledge.o \
Expand Down
15 changes: 0 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,6 @@ AC_CHECK_FUNCS([ \
localtime_r \
login_getcapbool \
login_getpwclass \
md5_crypt \
memmem \
memmove \
memset_s \
Expand Down Expand Up @@ -4943,19 +4942,6 @@ else
fi
AC_SUBST([mansubdir])

# Check whether to enable MD5 passwords
MD5_MSG="no"
AC_ARG_WITH([md5-passwords],
[ --with-md5-passwords Enable use of MD5 passwords],
[
if test "x$withval" != "xno" ; then
AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
[Define if you want to allow MD5 passwords])
MD5_MSG="yes"
fi
]
)

# Whether to disable shadow password support
AC_ARG_WITH([shadow],
[ --without-shadow Disable shadow password support],
Expand Down Expand Up @@ -5550,7 +5536,6 @@ echo " PAM support: $PAM_MSG"
echo " OSF SIA support: $SIA_MSG"
echo " KerberosV support: $KRB5_MSG"
echo " SELinux support: $SELINUX_MSG"
echo " MD5 password support: $MD5_MSG"
echo " libedit support: $LIBEDIT_MSG"
echo " libldns support: $LDNS_MSG"
echo " Solaris process contract support: $SPC_MSG"
Expand Down
8 changes: 5 additions & 3 deletions contrib/redhat/openssh.spec
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
# rpm -ba|--rebuild --define "smartcard 1"
%{?smartcard:%global scard 1}

# Is this a build for the rescue CD (without PAM, with MD5)? (1=yes 0=no)
# Is this a build for the rescue CD (without PAM)? (1=yes 0=no)
%global rescue 0
%{?build_rescue:%global rescue 1}

Expand Down Expand Up @@ -211,7 +211,6 @@ CFLAGS="$RPM_OPT_FLAGS -Os"; export CFLAGS
--with-default-path=/usr/local/bin:/bin:/usr/bin \
--with-superuser-path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin \
--with-privsep-path=%{_var}/empty/sshd \
--with-md5-passwords \
--mandir=%{_mandir} \
--with-mantype=man \
--disable-strip \
Expand Down Expand Up @@ -424,7 +423,10 @@ fi
%endif

%changelog
* Mon Jul 20 2020 Damien Miller <[email protected]>
* Thu Oct 28 2021 Damien Miller <[email protected]>
- Remove remaining traces of --with-md5-passwords

* Mon Jul 20 2020 Damien Miller <[email protected]>
- Add ssh-sk-helper and corresponding manual page.

* Sat Feb 10 2018 Darren Tucker <[email protected]>
Expand Down
165 changes: 0 additions & 165 deletions md5crypt.c

This file was deleted.

22 changes: 0 additions & 22 deletions md5crypt.h

This file was deleted.

13 changes: 2 additions & 11 deletions openbsd-compat/xcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@
# include <pwdadj.h>
# endif

# if defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT)
# include "md5crypt.h"
# endif

# if defined(WITH_OPENSSL) && !defined(HAVE_CRYPT) && defined(HAVE_DES_CRYPT)
# include <openssl/des.h>
# define crypt DES_crypt
Expand Down Expand Up @@ -108,12 +104,7 @@ xcrypt(const char *password, const char *salt)
if (salt == NULL)
salt = pick_salt();

# ifdef HAVE_MD5_PASSWORDS
if (is_md5_salt(salt))
crypted = md5_crypt(password, salt);
else
crypted = crypt(password, salt);
# elif defined(__hpux) && !defined(HAVE_SECUREWARE)
#if defined(__hpux) && !defined(HAVE_SECUREWARE)
if (iscomsec())
crypted = bigcrypt(password, salt);
else
Expand All @@ -122,7 +113,7 @@ xcrypt(const char *password, const char *salt)
crypted = bigcrypt(password, salt);
# else
crypted = crypt(password, salt);
# endif
#endif

return crypted;
}
Expand Down

0 comments on commit a5ab488

Please sign in to comment.