You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

269 lines
6.4 KiB

  1. #
  2. # Copyright (C) 2006-2011 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=openssh
  9. PKG_VERSION:=6.7p1
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
  13. http://ftp.belnet.be/pub/OpenBSD/OpenSSH/portable/
  14. PKG_MD5SUM:=3246aa79317b1d23cae783a3bf8275d6
  15. PKG_LICENSE:=BSD ISC
  16. PKG_LICENSE_FILES:=LICENCE
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  18. PKG_BUILD_DEPENDS:=libopenssl
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/openssh/Default
  21. SECTION:=net
  22. CATEGORY:=Network
  23. DEPENDS:=+libopenssl +zlib +SSP_SUPPORT:libssp
  24. TITLE:=OpenSSH
  25. MAINTAINER:=Peter Wagner <tripolar@gmx.at>
  26. URL:=http://www.openssh.com/
  27. SUBMENU:=SSH
  28. VARIANT:=without-pam
  29. endef
  30. define Package/openssh-moduli
  31. $(call Package/openssh/Default)
  32. DEPENDS+= +openssh-keygen
  33. TITLE+= moduli file
  34. endef
  35. define Package/openssh-moduli/description
  36. OpenSSH server moduli file.
  37. endef
  38. define Package/openssh-client
  39. $(call Package/openssh/Default)
  40. TITLE+= client
  41. endef
  42. define Package/openssh-client/description
  43. OpenSSH client.
  44. endef
  45. define Package/openssh-client/conffiles
  46. /etc/ssh/ssh_config
  47. endef
  48. define Package/openssh-client-utils
  49. $(call Package/openssh/Default)
  50. DEPENDS+= +openssh-client +openssh-keygen
  51. TITLE+= client utilities
  52. endef
  53. define Package/openssh-client-utils/description
  54. OpenSSH client utilities.
  55. endef
  56. define Package/openssh-keygen
  57. $(call Package/openssh/Default)
  58. TITLE+= keygen
  59. endef
  60. define Package/openssh-keygen/description
  61. OpenSSH keygen.
  62. endef
  63. define Package/openssh-server
  64. $(call Package/openssh/Default)
  65. DEPENDS+= +openssh-keygen
  66. TITLE+= server
  67. USERID:=sshd=22:sshd=22
  68. endef
  69. define Package/openssh-server/description
  70. OpenSSH server.
  71. endef
  72. define Package/openssh-server/conffiles
  73. /etc/ssh/sshd_config
  74. endef
  75. define Package/openssh-server-pam
  76. $(call Package/openssh/Default)
  77. DEPENDS+= +libpthread +openssh-keygen +libpam
  78. TITLE+= server (with PAM support)
  79. VARIANT:=with-pam
  80. USERID:=sshd=22:sshd=22
  81. endef
  82. define Package/openssh-server-pam/description
  83. OpenSSH server (with PAM support).
  84. endef
  85. define Package/openssh-server-pam/conffiles
  86. /etc/pam.d/sshd
  87. /etc/security/access-sshd-local.conf
  88. /etc/ssh/sshd_config
  89. endef
  90. define Package/openssh-sftp-client
  91. $(call Package/openssh/Default)
  92. TITLE+= SFTP client
  93. endef
  94. define Package/openssh-sftp-client/description
  95. OpenSSH SFTP client.
  96. endef
  97. define Package/openssh-sftp-server
  98. $(call Package/openssh/Default)
  99. TITLE+= SFTP server
  100. DEPENDS:=+SSP_SUPPORT:libssp
  101. endef
  102. define Package/openssh-sftp-server/description
  103. OpenSSH SFTP server.
  104. endef
  105. CONFIGURE_ARGS+= \
  106. $(DISABLE_NLS) \
  107. --sysconfdir=/etc/ssh \
  108. --with-privsep-user=sshd \
  109. --with-privsep-path=/var/empty \
  110. --enable-shared \
  111. --disable-static \
  112. --disable-debug \
  113. --disable-strip \
  114. --disable-etc-default-login \
  115. --disable-lastlog \
  116. --disable-utmp \
  117. --disable-utmpx \
  118. --disable-wtmp \
  119. --disable-wtmpx \
  120. --without-bsd-auth \
  121. --without-kerberos5 \
  122. --without-x
  123. ifeq ($(BUILD_VARIANT),with-pam)
  124. CONFIGURE_ARGS += \
  125. --with-pam
  126. else
  127. CONFIGURE_ARGS += \
  128. --without-pam
  129. endif
  130. ifeq ($(CONFIG_OPENSSL_ENGINE),y)
  131. CONFIGURE_ARGS+= \
  132. --with-ssl-engine
  133. endif
  134. ifneq ($(CONFIG_SSP_SUPPORT),y)
  135. CONFIGURE_ARGS += \
  136. --without-stackprotect
  137. endif
  138. CONFIGURE_VARS += LD="$(TARGET_CC)"
  139. ifeq ($(BUILD_VARIANT),with-pam)
  140. TARGET_LDFLAGS += -lpthread
  141. endif
  142. define Build/Compile
  143. $(MAKE) -C $(PKG_BUILD_DIR) \
  144. DESTDIR="$(PKG_INSTALL_DIR)" \
  145. LIBS="" \
  146. sftp-server
  147. $(MAKE) -C $(PKG_BUILD_DIR) \
  148. DESTDIR="$(PKG_INSTALL_DIR)" \
  149. STRIP_OPT="" \
  150. all install
  151. endef
  152. define Package/openssh-client/preinst
  153. #!/bin/sh
  154. if [ -L $${IPKG_INSTROOT}/usr/bin/ssh ] && [ -L $${IPKG_INSTROOT}/usr/bin/scp ]; then
  155. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  156. fi
  157. exit 0
  158. endef
  159. define Package/openssh-client/postrm
  160. #!/bin/sh
  161. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  162. if [ -x $${IPKG_INSTROOT}/usr/sbin/dropbear ] ; then
  163. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/ssh;
  164. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/scp;
  165. fi
  166. exit 0
  167. endef
  168. define Package/openssh-moduli/install
  169. $(INSTALL_DIR) $(1)/etc/ssh
  170. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  171. endef
  172. define Package/openssh-client/install
  173. $(INSTALL_DIR) $(1)/etc/ssh
  174. chmod 0700 $(1)/etc/ssh
  175. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  176. $(INSTALL_DIR) $(1)/usr/bin
  177. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
  178. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
  179. endef
  180. define Package/openssh-client-utils/install
  181. $(INSTALL_DIR) $(1)/usr/bin
  182. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  183. endef
  184. define Package/openssh-keygen/install
  185. $(INSTALL_DIR) $(1)/usr/bin
  186. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  187. endef
  188. define Package/openssh-server/install
  189. $(INSTALL_DIR) $(1)/etc/ssh
  190. chmod 0700 $(1)/etc/ssh
  191. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  192. $(INSTALL_DIR) $(1)/etc/init.d
  193. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  194. $(INSTALL_DIR) $(1)/usr/sbin
  195. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  196. endef
  197. define Package/openssh-server-pam/install
  198. $(call Package/openssh-server/install,$(1))
  199. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  200. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  201. $(INSTALL_DIR) $(1)/etc/pam.d
  202. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  203. $(INSTALL_DIR) $(1)/etc/security
  204. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  205. endef
  206. define Package/openssh-sftp-client/install
  207. $(INSTALL_DIR) $(1)/usr/bin
  208. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  209. endef
  210. define Package/openssh-sftp-server/install
  211. $(INSTALL_DIR) $(1)/usr/lib
  212. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  213. $(INSTALL_DIR) $(1)/usr/libexec
  214. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  215. endef
  216. $(eval $(call BuildPackage,openssh-client))
  217. $(eval $(call BuildPackage,openssh-moduli))
  218. $(eval $(call BuildPackage,openssh-client-utils))
  219. $(eval $(call BuildPackage,openssh-keygen))
  220. $(eval $(call BuildPackage,openssh-server))
  221. $(eval $(call BuildPackage,openssh-server-pam))
  222. $(eval $(call BuildPackage,openssh-sftp-client))
  223. $(eval $(call BuildPackage,openssh-sftp-server))