diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index 14472d88af..6f8fdd4c94 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -55,6 +55,7 @@ source "package/nocatsplash/Config.in" source "package/ntpclient/Config.in" source "package/olsrd/Config.in" source "package/openntpd/Config.in" +source "package/openssh/Config.in" source "package/openswan/Config.in" source "package/openvpn/Config.in" source "package/pmacct/Config.in" diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 8d7dd75793..40f45327e1 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -65,6 +65,7 @@ package-$(BR2_PACKAGE_NTPCLIENT) += ntpclient package-$(BR2_PACKAGE_OLSRD) += olsrd package-$(BR2_PACKAGE_OPENLDAP) += openldap package-$(BR2_PACKAGE_OPENNTPD) += openntpd +package-$(BR2_PACKAGE_OPENSSH) += openssh package-$(BR2_PACKAGE_OPENSSL) += openssl package-$(BR2_PACKAGE_OPENSWAN) += openswan package-$(BR2_PACKAGE_OPENVPN) += openvpn @@ -134,6 +135,7 @@ nfs-server-compile: portmap-compile nmap-compile: uclibc++-compile pcre-compile libpcap-compile nocatsplash-compile: glib-compile openldap-compile: cyrus-sasl-compile openssl-compile +openssh-compile: zlib-compile openssl-compile openssl-compile: zlib-compile openswan-compile: gmp-compile osiris-compile: openssl-compile diff --git a/openwrt/package/openssh/Config.in b/openwrt/package/openssh/Config.in new file mode 100644 index 0000000000..69068e8478 --- /dev/null +++ b/openwrt/package/openssh/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_OPENSSH + tristate "OpenSSH" + default m if CONFIG_DEVEL + select BR2_PACKAGE_OPENSSL + help + Popular SSH server and client + + http://www.openssh.com/ + + Depends: openssl diff --git a/openwrt/package/openssh/Makefile b/openwrt/package/openssh/Makefile new file mode 100644 index 0000000000..9d96f75f7a --- /dev/null +++ b/openwrt/package/openssh/Makefile @@ -0,0 +1,84 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=openssh +PKG_VERSION:=4.0p1 +PKG_RELEASE:=1 +PKG_MD5SUM:=7b36f28fc16e1b7f4ba3c1dca191ac92 + +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_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(TOPDIR)/package/rules.mk + +PKG_DEPEND:="openssl" + +$(eval $(call PKG_template,OPENSSH,openssh,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared + (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc/ssh \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --with-zlib=$(STAGING_DIR)/usr \ + --with-ssl-dir=$(STAGING_DIR)/usr \ + --disable-strip \ + --disable-lastlog \ + --disable-etc-default-login \ + --disable-utmp \ + --disable-utmpx \ + --disable-wtmp \ + --disable-wtmpx \ + --with-cflags="$(TARGET_CFLAGS)" \ + --includedir=$(STAGING_DIR)/include \ + --without-pam \ + --without-bsd-auth \ + --without-kerberos5 \ + --without-x \ + --disable-debug \ + ); + touch $(PKG_BUILD_DIR)/.configured + +$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR) + touch $(PKG_BUILD_DIR)/.built + +$(PKG_BUILD_DIR)/.installed: $(PKG_BUILD_DIR)/.built + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install + touch $(PKG_BUILD_DIR)/.installed + +$(IPKG_OPENSSH): $(IDIR_OPENSSH)/CONTROL/control $(PKG_BUILD_DIR)/.installed + mkdir -p $(IDIR_OPENSSH){/etc/ssh,/usr/sbin,/usr/bin} + cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/sshd $(IDIR_OPENSSH)/usr/sbin/ + cp -fpR $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(IDIR_OPENSSH)/usr/bin/ + #$(RSTRIP) $(IDIR_OPENSSH) + mkdir -p $(PACKAGE_DIR) + cp $(PKG_INSTALL_DIR)/etc/ssh/* $(IDIR_OPENSSH)/etc/ssh/ + mkdir -p $(IDIR_OPENSSH)/etc/init.d + install -m 755 ./files/S50sshd $(IDIR_OPENSSH)/etc/init.d/ + $(IPKG_BUILD) $(IDIR_OPENSSH) $(PACKAGE_DIR) + diff --git a/openwrt/package/openssh/files/S50sshd b/openwrt/package/openssh/files/S50sshd new file mode 100755 index 0000000000..bb23691954 --- /dev/null +++ b/openwrt/package/openssh/files/S50sshd @@ -0,0 +1,15 @@ +#!/bin/sh + +for type in rsa dsa; do { + # check for keys + key=/etc/ssh/ssh_${type}_host_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 + +/usr/sbin/sshd diff --git a/openwrt/package/openssh/ipkg/openssh.control b/openwrt/package/openssh/ipkg/openssh.control new file mode 100644 index 0000000000..7ad07c74cc --- /dev/null +++ b/openwrt/package/openssh/ipkg/openssh.control @@ -0,0 +1,7 @@ +Package: openssh +Priority: optional +Section: net +Maintainer: bugs@openwrt.org +Source: buildroot internal +Depends: zlib, libopenssl +Description: SSH Server and Client diff --git a/openwrt/package/openssh/patches/cross-compile.patch b/openwrt/package/openssh/patches/cross-compile.patch new file mode 100644 index 0000000000..7178e32ac1 --- /dev/null +++ b/openwrt/package/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