Skip to contentSkip to conversation

cracklib: New package

PATCH New Stefan Sørensen 2 participants 4 messages May 5, 2017 – May 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 cracklib: New package

---

Changes since v3:
* Remove changelog and add SoB to upstream patches
* Add zlib and python dependency handling
* Handle linux-pam reverse dependency

Changes since v2:
* Add two upstream bugfixes
* Add patch to force grep to treat the words file as text
* Add $(HOST_MAKE_ENV) when build the dict

Changes since v1:
* Update DEVELOPERS file
* Use SPDX license codes
* Use the tools from host-cracklib for generating dictionary files

 DEVELOPERS                                         |   1 +
 package/Config.in                                  |   1 +
 .../0001-Apply-patch-to-fix-CVE-2016-6318.patch    | 106 +++++++++++++++++++++
 ...x-a-buffer-overflow-processing-long-words.patch |  40 ++++++++
 ...to-treat-the-input-as-text-when-formattin.patch |  30 ++++++
 package/cracklib/Config.in                         |  28 ++++++
 package/cracklib/cracklib.hash                     |   3 +
 package/cracklib/cracklib.mk                       |  52 ++++++++++
 package/linux-pam/linux-pam.mk                     |   7 ++
 9 files changed, 268 insertions(+)
 create mode 100644 package/cracklib/0001-Apply-patch-to-fix-CVE-2016-6318.patch
 create mode 100644 package/cracklib/0002-Fix-a-buffer-overflow-processing-long-words.patch
 create mode 100644 package/cracklib/0003-Force-grep-to-treat-the-input-as-text-when-formattin.patch
 create mode 100644 package/cracklib/Config.in
 create mode 100644 package/cracklib/cracklib.hash
 create mode 100644 package/cracklib/cracklib.mk
DEVELOPERS +1 -0
index 8fbb69a..813706c 100644
@@ -1495,6 +1495,7 @@ F:	package/proxychains-ng/
 F:	package/yasm/
 
 N:	Stefan S?rensen <[email protected]>
+F:	package/cracklib/
 F:	package/libscrypt/
 
 N:	Stephan Hoffmann <[email protected]>
package/Config.in +1 -0
index 1af8150..62d5110 100644
@@ -1348,6 +1348,7 @@ menu "Other"
 	source "package/clapack/Config.in"
 	source "package/classpath/Config.in"
 	source "package/cppcms/Config.in"
+	source "package/cracklib/Config.in"
 	source "package/dawgdic/Config.in"
 	source "package/ding-libs/Config.in"
 	source "package/eigen/Config.in"
package/cracklib/0001-Apply-patch-to-fix-CVE-2016-6318.patch new file +106 -0

106 lines not on this page · raw message

package/cracklib/0002-Fix-a-buffer-overflow-processing-long-words.patch new file +40 -0
new file mode 100644
index 0000000..63525cc
@@ -0,0 +1,40 @@
+From 33d7fa4585247cd2247a1ffa032ad245836c6edb Mon Sep 17 00:00:00 2001
+From: Jan Dittberner <[email protected]>
+Date: Thu, 25 Aug 2016 17:17:53 +0200
+Subject: [PATCH] Fix a buffer overflow processing long words
+
+A buffer overflow processing long words has been discovered. This commit
+applies the patch from
+https://build.opensuse.org/package/view_file/Base:System/cracklib/0004-overflow-processing-long-words.patch
+by Howard Guo.
+
+See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835386 and
+http://www.openwall.com/lists/oss-security/2016/08/23/8
+
+Signed-off-by: Stefan S?rensen <[email protected]>
+---
+
+Status: upstream, not yet released.
+
+ lib/rules.c | 5 ++---
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/rules.c b/lib/rules.c
+index d193cc0..3a2aa46 100644
+--- a/lib/rules.c
++++ b/lib/rules.c
+@@ -434,9 +434,8 @@ Mangle(input, control)		/* returns a pointer to a controlled Mangle */
+ {
+     int limit;
+     register char *ptr;
+-    static char area[STRINGSIZE];
+-    char area2[STRINGSIZE];
+-    area[0] = '\0';
++    static char area[STRINGSIZE * 2] = {0};
++    char area2[STRINGSIZE * 2] = {0};
+     strcpy(area, input);
+ 
+     for (ptr = control; *ptr; ptr++)
+-- 
+2.9.3
+
package/cracklib/0003-Force-grep-to-treat-the-input-as-text-when-formattin.patch new file +30 -0
new file mode 100644
index 0000000..b05a69c
@@ -0,0 +1,30 @@
+From d27062fe7a520d5791f7a56d175a5cb6a39bae61 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20S=C3=B8rensen?= <[email protected]>
+Date: Tue, 18 Apr 2017 12:00:39 +0200
+Subject: [PATCH] Force grep to treat the input as text when formatting word
+ files.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Stefan S?rensen <[email protected]>
+---
+ util/cracklib-format | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util/cracklib-format b/util/cracklib-format
+index 1d7be5b..b1de8e8 100644
+--- a/util/cracklib-format
++++ b/util/cracklib-format
+@@ -4,7 +4,7 @@
+ # into cracklib-packer
+ #
+ gzip -cdf "$@" |
+-    grep -v '^\(#\|$\)' |
++    grep -a -v '^\(#\|$\)' |
+     tr '[A-Z]' '[a-z]' |
+     tr -cd '\012[a-z][0-9]' |
+     env LC_ALL=C sort -u
+-- 
+2.9.3
+
package/cracklib/Config.in new file +28 -0
new file mode 100644
index 0000000..4a0f43f
@@ -0,0 +1,28 @@
+config BR2_PACKAGE_CRACKLIB
+	bool "cracklib"
+	help
+	  CrackLib tests passwords to determine whether they match
+	  certain security-oriented characteristics, with the purpose
+	  of stopping users from choosing passwords that are easy to
+	  guess. CrackLib performs several tests on passwords: it
+	  tries to generate words from a username and gecos entry and
+	  checks those words against the password; it checks for
+	  simplistic patterns in passwords; and it checks for the
+	  password in a dictionary.
+
+	  https://github.com/cracklib/cracklib
+
+if BR2_PACKAGE_CRACKLIB
+
+config BR2_PACKAGE_CRACKLIB_TOOLS
+	bool "install tools"
+	help
+	  Install cracklib command line tools for creating dicts.
+
+config BR2_PACKAGE_CRACKLIB_FULL_DICT
+	bool "full dict"
+	help
+	  Install the full cracklib dict (requires about 8Mb extra
+	  target space).
+
+endif
package/cracklib/cracklib.hash new file +3 -0
new file mode 100644
index 0000000..3038a47
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256	17cf76943de272fd579ed831a1fd85339b393f8d00bf9e0d17c91e972f583343	cracklib-2.9.6.tar.gz
+sha256	27973245225eeb9d0090e97f3dea4197dec99b64d9d3a791a60298f3b021824c	cracklib-words-2.9.6.gz
package/cracklib/cracklib.mk new file +52 -0

52 lines not on this page · raw message

package/linux-pam/linux-pam.mk +7 -0
index 3522415..fb2f99c 100644
@@ -44,6 +44,13 @@ else
 LINUX_PAM_CONF_OPTS += --disable-audit
 endif
 
+ifeq ($(BR2_PACKAGE_CRACKLIB),y)
+LINUX_PAM_CONF_OPTS += --enable-cracklib
+LINUX_PAM_DEPENDENCIES += cracklib
+else
+LINUX_PAM_CONF_OPTS += --disable-cracklib
+endif
+
 # Install default pam config (deny everything except login)
 define LINUX_PAM_INSTALL_CONFIG
 	$(INSTALL) -m 0644 -D package/linux-pam/login.pam \
Signature · 1 line
2.9.3
#1 lore raw

PATCH v4 2/2 libpwquality: New package

---

Changes since v3:
* Drop usage of github helper
* Handle linux-pam dependency

No Changes in v2.

Changes since v1:
* Update DEVELOPERS file
* Use SPDX license codes
* Use new github site
* Remove unneeded autoreconf
* Fix building when python is enabled

 DEVELOPERS                                         |  1 +
 package/Config.in                                  |  1 +
 ...ith-disable-nls-on-platforms-without-libi.patch | 47 ++++++++++++++++++++++
 ...leak-in-settings-when-using-bad-word-list.patch | 26 ++++++++++++
 package/libpwquality/Config.in                     | 19 +++++++++
 package/libpwquality/libpwquality.hash             |  2 +
 package/libpwquality/libpwquality.mk               | 39 ++++++++++++++++++
 7 files changed, 135 insertions(+)
 create mode 100644 package/libpwquality/0001-Fix-build-with-disable-nls-on-platforms-without-libi.patch
 create mode 100644 package/libpwquality/0002-Fix-memory-leak-in-settings-when-using-bad-word-list.patch
 create mode 100644 package/libpwquality/Config.in
 create mode 100644 package/libpwquality/libpwquality.hash
 create mode 100644 package/libpwquality/libpwquality.mk
DEVELOPERS +1 -0
index 813706c..eb76ce6 100644
@@ -1496,6 +1496,7 @@ F:	package/yasm/
 
 N:	Stefan S?rensen <[email protected]>
 F:	package/cracklib/
+F:	package/libpwquality/
 F:	package/libscrypt/
 
 N:	Stephan Hoffmann <[email protected]>
package/Config.in +1 -0
index 62d5110..9b20e38 100644
@@ -1392,6 +1392,7 @@ menu "Other"
 	source "package/libplist/Config.in"
 	source "package/libpthread-stubs/Config.in"
 	source "package/libpthsem/Config.in"
+	source "package/libpwquality/Config.in"
 	source "package/libseccomp/Config.in"
 	source "package/libsigc/Config.in"
 	source "package/libsigsegv/Config.in"
package/libpwquality/0001-Fix-build-with-disable-nls-on-platforms-without-libi.patch new file +47 -0

47 lines not on this page · raw message

package/libpwquality/0002-Fix-memory-leak-in-settings-when-using-bad-word-list.patch new file +26 -0
new file mode 100644
index 0000000..1b4f242
@@ -0,0 +1,26 @@
+From b1f2f1f71894fa0af92041fb4d5b6146101d63e5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20S=C3=B8rensen?= <[email protected]>
+Date: Thu, 2 Feb 2017 11:17:26 +0100
+Subject: [PATCH] Fix memory leak in settings when using bad word list.
+
+Signed-off-by: Stefan S?rensen <[email protected]>
+
+---
+
+Status: accepted upstream, not yet released.
+
+diff --git a/src/settings.c b/src/settings.c
+index 5c38b30..4b026b1 100644
+--- a/src/settings.c
++++ b/src/settings.c
+@@ -46,6 +46,7 @@ pwquality_free_settings(pwquality_settings_t *pwq)
+ {
+         if (pwq) {
+                 free(pwq->dict_path);
++                free(pwq->bad_words);
+                 free(pwq);
+         }
+ }
+-- 
+2.9.3
+
package/libpwquality/Config.in new file +19 -0
new file mode 100644
index 0000000..4e85525
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_LIBPWQUALITY
+	bool "libpwquality"
+	help
+	  This is a library for password quality checks and generation
+	  of random passwords that pass the checks.  This library uses
+	  the cracklib and cracklib dictionaries to perform some of
+	  the checks.
+
+	  https://github.com/libpwquality/libpwquality
+
+if BR2_PACKAGE_LIBPWQUALITY
+
+config BR2_PACKAGE_LIBPWQUALITY_TOOLS
+	bool "install tools"
+	help
+	  Install libpwquality command line tools generating/checking
+	  passwords.
+
+endif
package/libpwquality/libpwquality.hash new file +2 -0
new file mode 100644
index 0000000..0e3f9e3
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256	74d2ea90e103323c1f2d6a6cc9617cdae6877573eddb31aaf31a40f354cc2d2a	libpwquality-1.3.0.tar.bz2
package/libpwquality/libpwquality.mk new file +39 -0
new file mode 100644
index 0000000..66b15d8
@@ -0,0 +1,39 @@
+################################################################################
+#
+# libpwquality
+#
+################################################################################
+
+LIBPWQUALITY_VERSION = 1.3.0
+LIBPWQUALITY_SOURCE = libpwquality-$(LIBPWQUALITY_VERSION).tar.bz2
+LIBPWQUALITY_SITE = https://github.com/libpwquality/libpwquality/releases/download/libpwquality-$(LIBPWQUALITY_VERSION)
+LIBPWQUALITY_LICENSE = BSD-3-Clause or GPL-2.0+
+LIBPWQUALITY_INSTALL_STAGING = YES
+LIBPWQUALITY_DEPENDENCIES = cracklib
+LIBPWQUALITY_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+LIBPWQUALITY_CONF_OPTS += --enable-python-bindings
+LIBPWQUALITY_DEPENDENCIES += python
+LIBPWQUALITY_MAKE_ENV += $(PKG_PYTHON_DISTUTILS_ENV)
+else
+LIBPWQUALITY_CONF_OPTS += --disable-python-bindings
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+LIBPWQUALITY_CONF_OPTS += --enable-pam
+LIBPWQUALITY_DEPENDENCIES += linux-pam
+else
+LIBPWQUALITY_CONF_OPTS += --disable-pam
+endif
+
+ifeq ($(BR2_PACKAGE_LIBPWQUALITY_TOOLS),)
+define LIBPWQUALITY_REMOVE_TOOLS
+	rm -f $(TARGET_DIR)/usr/bin/pwmake
+	rm -f $(TARGET_DIR)/usr/bin/pwscore
+endef
+
+LIBPWQUALITY_POST_INSTALL_TARGET_HOOKS += LIBPWQUALITY_REMOVE_TOOLS
+endif
+
+$(eval $(autotools-package))
Signature · 1 line
2.9.3
#2 lore raw

PATCH v4 2/2 libpwquality: New package

Hello,

Quoted 2 lines · Stefan S?rensen

---

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v4 1/2 cracklib: New package

In reply to Stefan Sørensen

Hello,

package/linux-pam/linux-pam.mk else · line 52

Quoted 6 lines · Stefan S?rensen
package/linux-pam/linux-pam.mk +6 -0
+ifeq ($(BR2_PACKAGE_CRACKLIB),y)
+LINUX_PAM_CONF_OPTS += --enable-cracklib
+LINUX_PAM_DEPENDENCIES += cracklib
+else
+LINUX_PAM_CONF_OPTS += --disable-cracklib
+endif

This should have been in a separate patch, so I've split that into a separate commit.

Other than that: applied to the next branch, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com