[packages] add openssh-server-pam
[packages.git] / net / openssh / Makefile
index 0c6aeea..4b8a10e 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006,2008 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,15 +8,18 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssh
-PKG_VERSION:=5.8p2
-PKG_RELEASE:=1
+PKG_VERSION:=6.3p1
+PKG_RELEASE:=2
 
 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:=0541579adf9d55abb15ef927048d372e
+PKG_MD5SUM:=225e75c9856f76011966013163784038
+
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 
 PKG_BUILD_DEPENDS:=libopenssl
 
@@ -25,11 +28,22 @@ include $(INCLUDE_DIR)/package.mk
 define Package/openssh/Default
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libopenssl +zlib +libgcc
+  DEPENDS:=+libopenssl +zlib +SSP_SUPPORT:libssp
   TITLE:=OpenSSH
   MAINTAINER:=Peter Wagner <tripolar@gmx.at>
   URL:=http://www.openssh.com/
   SUBMENU:=SSH
+  VARIANT:=without-pam
+endef
+
+define Package/openssh-moduli
+  $(call Package/openssh/Default)
+  DEPENDS+= +openssh-keygen
+  TITLE+= moduli file
+endef
+
+define Package/openssh-moduli/description
+OpenSSH server moduli file.
 endef
 
 define Package/openssh-client
@@ -78,6 +92,23 @@ define Package/openssh-server/conffiles
 /etc/ssh/sshd_config
 endef
 
+define Package/openssh-server-pam
+  $(call Package/openssh/Default)
+  DEPENDS+= +libpthread +openssh-keygen +libpam
+  TITLE+= server (with PAM support)
+  VARIANT:=with-pam
+endef
+
+define Package/openssh-server-pam/description
+OpenSSH server (with PAM support).
+endef
+
+define Package/openssh-server-pam/conffiles
+/etc/pam.d/sshd
+/etc/security/access-sshd-local.conf
+/etc/ssh/sshd_config
+endef
+
 define Package/openssh-sftp-client
   $(call Package/openssh/Default)
   TITLE+= SFTP client
@@ -89,7 +120,6 @@ endef
 
 define Package/openssh-sftp-server
   $(call Package/openssh/Default)
-  DEPENDS:=+libgcc
   TITLE+= SFTP server
 endef
 
@@ -100,6 +130,8 @@ endef
 CONFIGURE_ARGS+= \
        $(DISABLE_NLS) \
        --sysconfdir=/etc/ssh \
+       --with-privsep-user=sshd \
+       --with-privsep-path=/var/empty \
        --enable-shared \
        --disable-static \
        --disable-debug \
@@ -112,9 +144,21 @@ CONFIGURE_ARGS+= \
        --disable-wtmpx \
        --without-bsd-auth \
        --without-kerberos5 \
-       --without-pam \
        --without-x
 
+ifeq ($(BUILD_VARIANT),with-pam)
+CONFIGURE_ARGS += \
+       --with-pam
+else
+CONFIGURE_ARGS += \
+       --without-pam
+endif
+
+ifeq ($(CONFIG_OPENSSL_ENGINE),y)
+CONFIGURE_ARGS+= \
+       --with-ssl-engine
+endif
+
 ifneq ($(CONFIG_SSP_SUPPORT),y)
 CONFIGURE_ARGS += \
        --without-stackprotect
@@ -122,6 +166,10 @@ endif
 
 CONFIGURE_VARS += LD="$(TARGET_CC)"
 
+ifeq ($(BUILD_VARIANT),with-pam)
+TARGET_LDFLAGS += -lpthread
+endif
+
 define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                DESTDIR="$(PKG_INSTALL_DIR)" \
@@ -133,6 +181,11 @@ define Build/Compile
                all install
 endef
 
+define Package/openssh-moduli/install
+       $(INSTALL_DIR) $(1)/etc/ssh
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
+endef
+
 define Package/openssh-client/install
        $(INSTALL_DIR) $(1)/etc/ssh
        chmod 0700 $(1)/etc/ssh
@@ -156,28 +209,25 @@ endef
 define Package/openssh-server/install
        $(INSTALL_DIR) $(1)/etc/ssh
        chmod 0700 $(1)/etc/ssh
-       $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
 endef
 
-define Package/openssh-server/postinst
-#!/bin/sh
-
-name=sshd
-id=22
-
-if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
-       echo "adding group $$name to /etc/group"
-       echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
-fi
-
-if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
-       echo "adding user $$name to /etc/passwd"
-       echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
-fi
+define Package/openssh-server-pam/install
+       $(INSTALL_DIR) $(1)/etc/ssh
+       chmod 0700 $(1)/etc/ssh
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
+       $(INSTALL_DIR) $(1)/etc/pam.d
+       $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
+       $(INSTALL_DIR) $(1)/etc/security
+       $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
 endef
 
 define Package/openssh-sftp-client/install
@@ -193,8 +243,10 @@ define Package/openssh-sftp-server/install
 endef
 
 $(eval $(call BuildPackage,openssh-client))
+$(eval $(call BuildPackage,openssh-moduli))
 $(eval $(call BuildPackage,openssh-client-utils))
 $(eval $(call BuildPackage,openssh-keygen))
 $(eval $(call BuildPackage,openssh-server))
+$(eval $(call BuildPackage,openssh-server-pam))
 $(eval $(call BuildPackage,openssh-sftp-client))
 $(eval $(call BuildPackage,openssh-sftp-server))