From 9189e6f6841fc00336e91d4842232db7f336d247 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Mon, 24 Jul 2006 18:14:09 +0000 Subject: [PATCH] port openssh to buildroot-ng SVN-Revision: 4264 --- net/openssh/Makefile | 178 +++++++++++++++++++ net/openssh/files/S50sshd | 15 ++ net/openssh/patches/100-openssl-cipher.patch | 11 ++ net/openssh/patches/cross-compile.patch | 103 +++++++++++ 4 files changed, 307 insertions(+) create mode 100644 net/openssh/Makefile create mode 100755 net/openssh/files/S50sshd create mode 100644 net/openssh/patches/100-openssl-cipher.patch create mode 100644 net/openssh/patches/cross-compile.patch diff --git a/net/openssh/Makefile b/net/openssh/Makefile new file mode 100644 index 000000000..4e1933425 --- /dev/null +++ b/net/openssh/Makefile @@ -0,0 +1,178 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=openssh +PKG_VERSION:=4.2p1 +PKG_RELEASE:=2 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \ + ftp://openbsd.wiretapped.net/pub/OpenBSD/OpenSSH/portable/ \ + ftp://ftp.belnet.be/packages/openbsd/OpenSSH/portable/ \ + ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/ +PKG_MD5SUM:=df899194a340c933944b193477c628fa +PKG_CAT:=zcat + +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install +PKG_BUILDDEP:=openssl + +include $(INCLUDE_DIR)/package.mk + +define Package/openssh-client + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +zlib + TITLE:=OpenSSH client + DESCRIPTION:=OpenSSH client. + URL:=http://www.openssh.com/ +endef + +define Package/openssh-client/conffiles +/etc/ssh/ssh_config +endef + +define Package/openssh-client-utils + SECTION:=net + CATEGORY:=Network + DEPENDS:=openssh-client + TITLE:=OpenSSH client utilities + DESCRIPTION:=OpenSSH client utilities. + URL:=http://www.openssh.com/ +endef + +define Package/openssh-server + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +zlib + TITLE:=OpenSSH server + DESCRIPTION:=OpenSSH server. + URL:=http://www.openssh.com/ +endef + +define Package/openssh-server/conffiles +/etc/ssh/sshd_config +endef + +define Package/openssh-sftp-client + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +zlib + TITLE:=OpenSSH SFTP client + DESCRIPTION:=OpenSSH SFTP client. + URL:=http://www.openssh.com/ +endef + +define Package/openssh-sftp-server + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +zlib + TITLE:=OpenSSH SFTP server + DESCRIPTION:=OpenSSH SFTP server. + URL:=http://www.openssh.com/ +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ + LD="$(TARGET_CC)" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc/ssh \ + $(DISABLE_LARGEFILE) \ + $(DISABLE_NLS) \ + --enable-shared \ + --disable-static \ + --disable-debug \ + --disable-strip \ + --disable-etc-default-login \ + --disable-lastlog \ + --disable-utmp \ + --disable-utmpx \ + --disable-wtmp \ + --disable-wtmpx \ + --without-bsd-auth \ + --without-kerberos5 \ + --without-pam \ + --without-x \ + ); +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/openssh-client/install + install -m0755 -d $(1)/etc/ssh + chmod 0700 $(1)/etc/ssh + $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/ + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/ +endef + +define Package/openssh-client-utils/install + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-add $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-agent $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-keyscan $(1)/usr/bin/ +endef + +define Package/openssh-server/install + install -m0755 -d $(1)/etc/ssh + chmod 0700 $(1)/etc/ssh + $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/ + install -m0755 -d $(1)/etc/init.d + install -m0755 ./files/S50sshd $(1)/etc/init.d/ + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/ + install -m0755 -d $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/ +endef + +define Package/openssh-sftp-client/install + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/ +endef + +define Package/openssh-sftp-server/install + install -m0755 -d $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/ + install -m0755 -d $(1)/usr/libexec + ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server +endef + +$(eval $(call BuildPackage,openssh-client)) +$(eval $(call BuildPackage,openssh-client-utils)) +$(eval $(call BuildPackage,openssh-server)) +$(eval $(call BuildPackage,openssh-sftp-client)) +$(eval $(call BuildPackage,openssh-sftp-server)) diff --git a/net/openssh/files/S50sshd b/net/openssh/files/S50sshd new file mode 100755 index 000000000..2ea168394 --- /dev/null +++ b/net/openssh/files/S50sshd @@ -0,0 +1,15 @@ +#!/bin/sh + +for type in rsa dsa; do { + # check for keys + key=/etc/ssh/ssh_host_${type}_key + [ ! -f $key ] && { + # generate missing keys + [ -x /usr/bin/ssh-keygen ] && { + /usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- && exec $0 $* + } & + exit 0 + } +}; done +mkdir -p /var/empty +/usr/sbin/sshd diff --git a/net/openssh/patches/100-openssl-cipher.patch b/net/openssh/patches/100-openssl-cipher.patch new file mode 100644 index 000000000..f8eb177c2 --- /dev/null +++ b/net/openssh/patches/100-openssl-cipher.patch @@ -0,0 +1,11 @@ +diff -Nur openssh-4.2p1/cipher.c openssh-4.2p1.patched/cipher.c +--- openssh-4.2p1/cipher.c 2005-07-17 09:02:10.000000000 +0200 ++++ openssh-4.2p1.patched/cipher.c 2006-03-26 12:43:41.000000000 +0200 +@@ -67,7 +67,6 @@ + + { "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, EVP_des_ede3_cbc }, + { "blowfish-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_bf_cbc }, +- { "cast128-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_cast5_cbc }, + { "arcfour", SSH_CIPHER_SSH2, 8, 16, 0, EVP_rc4 }, + { "arcfour128", SSH_CIPHER_SSH2, 8, 16, 1536, EVP_rc4 }, + { "arcfour256", SSH_CIPHER_SSH2, 8, 32, 1536, EVP_rc4 }, diff --git a/net/openssh/patches/cross-compile.patch b/net/openssh/patches/cross-compile.patch new file mode 100644 index 000000000..7178e32ac --- /dev/null +++ b/net/openssh/patches/cross-compile.patch @@ -0,0 +1,103 @@ +diff -Nur openssh-4.0p1/configure openssh-4.0p1.patched/configure +--- openssh-4.0p1/configure 2005-03-09 05:54:16.000000000 +0100 ++++ openssh-4.0p1.patched/configure 2005-06-02 13:35:06.000000000 +0200 +@@ -5524,7 +5524,7 @@ + *-*-linux*) + no_dev_ptmx=1 + check_for_libcrypt_later=1 +- check_for_openpty_ctty_bug=1 ++ check_for_openpty_ctty_bug=0 + cat >>confdefs.h <<\_ACEOF + #define DONT_TRY_OTHER_AF 1 + _ACEOF +@@ -12810,90 +12810,6 @@ + fi + fi + +-if test ! -z "$check_for_openpty_ctty_bug"; then +- echo "$as_me:$LINENO: checking if openpty correctly handles controlling tty" >&5 +-echo $ECHO_N "checking if openpty correctly handles controlling tty... $ECHO_C" >&6 +- if test "$cross_compiling" = yes; then +- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&5 +-echo "$as_me: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&2;} +- { (exit 1); exit 1; }; } +-else +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +- +-#include +-#include +-#include +-#include +- +-int +-main() +-{ +- pid_t pid; +- int fd, ptyfd, ttyfd, status; +- +- pid = fork(); +- if (pid < 0) { /* failed */ +- exit(1); +- } else if (pid > 0) { /* parent */ +- waitpid(pid, &status, 0); +- if (WIFEXITED(status)) +- exit(WEXITSTATUS(status)); +- else +- exit(2); +- } else { /* child */ +- close(0); close(1); close(2); +- setsid(); +- openpty(&ptyfd, &ttyfd, NULL, NULL, NULL); +- fd = open("/dev/tty", O_RDWR | O_NOCTTY); +- if (fd >= 0) +- exit(3); /* Acquired ctty: broken */ +- else +- exit(0); /* Did not acquire ctty: OK */ +- } +-} +- +-_ACEOF +-rm -f conftest$ac_exeext +-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 +- ac_status=$? +- echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' +- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 +- (eval $ac_try) 2>&5 +- ac_status=$? +- echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then +- +- echo "$as_me:$LINENO: result: yes" >&5 +-echo "${ECHO_T}yes" >&6 +- +-else +- echo "$as_me: program exited with status $ac_status" >&5 +-echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-( exit $ac_status ) +- +- echo "$as_me:$LINENO: result: no" >&5 +-echo "${ECHO_T}no" >&6 +- cat >>confdefs.h <<\_ACEOF +-#define SSHD_ACQUIRES_CTTY 1 +-_ACEOF +- +- +- +-fi +-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +-fi +-fi + + if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then + echo "$as_me:$LINENO: checking if getaddrinfo seems to work" >&5 -- 2.30.2