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.

291 lines
7.0 KiB

  1. #
  2. # Copyright (C) 2006-2014 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:=7.1p1
  10. PKG_RELEASE:=1
  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:=8709736bc8a8c253bc4eeb4829888ca5
  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
  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. # Strip dependencies to avoid pulling in OpenSSL etc.
  101. DEPENDS:=
  102. endef
  103. define Package/openssh-sftp-server/description
  104. OpenSSH SFTP server.
  105. endef
  106. define Package/openssh-sftp-avahi-service
  107. $(call Package/openssh/Default)
  108. TITLE+= (SFTP Avahi service)
  109. DEPENDS:=+openssh-sftp-server +avahi-daemon
  110. endef
  111. define Package/openssh-sftp-avahi-service/description
  112. This package contains the service definition for announcing
  113. SFTP support via mDNS/DNS-SD.
  114. endef
  115. define Package/openssh-sftp-avahi-service/conffiles
  116. /etc/avahi/services/sftp-ssh.service
  117. endef
  118. CONFIGURE_ARGS+= \
  119. $(DISABLE_NLS) \
  120. --sysconfdir=/etc/ssh \
  121. --with-privsep-user=sshd \
  122. --with-privsep-path=/var/empty \
  123. --enable-shared \
  124. --disable-static \
  125. --disable-debug \
  126. --disable-strip \
  127. --disable-etc-default-login \
  128. --disable-lastlog \
  129. --disable-utmp \
  130. --disable-utmpx \
  131. --disable-wtmp \
  132. --disable-wtmpx \
  133. --without-bsd-auth \
  134. --without-kerberos5 \
  135. --without-x
  136. ifeq ($(BUILD_VARIANT),with-pam)
  137. CONFIGURE_ARGS += \
  138. --with-pam
  139. else
  140. CONFIGURE_ARGS += \
  141. --without-pam
  142. endif
  143. ifeq ($(CONFIG_OPENSSL_ENGINE),y)
  144. CONFIGURE_ARGS+= \
  145. --with-ssl-engine
  146. endif
  147. ifneq ($(CONFIG_SSP_SUPPORT),y)
  148. CONFIGURE_ARGS += \
  149. --without-stackprotect
  150. endif
  151. CONFIGURE_VARS += LD="$(TARGET_CC)"
  152. ifeq ($(BUILD_VARIANT),with-pam)
  153. TARGET_LDFLAGS += -lpthread
  154. endif
  155. define Build/Compile
  156. $(MAKE) -C $(PKG_BUILD_DIR) \
  157. DESTDIR="$(PKG_INSTALL_DIR)" \
  158. LIBS="" \
  159. sftp-server
  160. $(MAKE) -C $(PKG_BUILD_DIR) \
  161. DESTDIR="$(PKG_INSTALL_DIR)" \
  162. STRIP_OPT="" \
  163. all install
  164. endef
  165. define Package/openssh-client/preinst
  166. #!/bin/sh
  167. if [ -L $${IPKG_INSTROOT}/usr/bin/ssh ] && [ -L $${IPKG_INSTROOT}/usr/bin/scp ]; then
  168. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  169. fi
  170. exit 0
  171. endef
  172. define Package/openssh-client/postrm
  173. #!/bin/sh
  174. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  175. if [ -x $${IPKG_INSTROOT}/usr/sbin/dropbear ] ; then
  176. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/ssh;
  177. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/scp;
  178. fi
  179. exit 0
  180. endef
  181. define Package/openssh-moduli/install
  182. $(INSTALL_DIR) $(1)/etc/ssh
  183. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  184. endef
  185. define Package/openssh-client/install
  186. $(INSTALL_DIR) $(1)/etc/ssh
  187. chmod 0700 $(1)/etc/ssh
  188. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  189. $(INSTALL_DIR) $(1)/usr/bin
  190. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
  191. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
  192. endef
  193. define Package/openssh-client-utils/install
  194. $(INSTALL_DIR) $(1)/usr/bin
  195. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  196. endef
  197. define Package/openssh-keygen/install
  198. $(INSTALL_DIR) $(1)/usr/bin
  199. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  200. endef
  201. define Package/openssh-server/install
  202. $(INSTALL_DIR) $(1)/etc/ssh
  203. chmod 0700 $(1)/etc/ssh
  204. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  205. $(INSTALL_DIR) $(1)/etc/init.d
  206. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  207. $(INSTALL_DIR) $(1)/usr/sbin
  208. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  209. endef
  210. define Package/openssh-server-pam/install
  211. $(call Package/openssh-server/install,$(1))
  212. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  213. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  214. $(INSTALL_DIR) $(1)/etc/pam.d
  215. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  216. $(INSTALL_DIR) $(1)/etc/security
  217. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  218. endef
  219. define Package/openssh-sftp-client/install
  220. $(INSTALL_DIR) $(1)/usr/bin
  221. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  222. endef
  223. define Package/openssh-sftp-server/install
  224. $(INSTALL_DIR) $(1)/usr/lib
  225. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  226. $(INSTALL_DIR) $(1)/usr/libexec
  227. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  228. endef
  229. define Package/openssh-sftp-avahi-service/install
  230. $(INSTALL_DIR) $(1)/etc/avahi/services
  231. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  232. endef
  233. $(eval $(call BuildPackage,openssh-client))
  234. $(eval $(call BuildPackage,openssh-moduli))
  235. $(eval $(call BuildPackage,openssh-client-utils))
  236. $(eval $(call BuildPackage,openssh-keygen))
  237. $(eval $(call BuildPackage,openssh-server))
  238. $(eval $(call BuildPackage,openssh-server-pam))
  239. $(eval $(call BuildPackage,openssh-sftp-client))
  240. $(eval $(call BuildPackage,openssh-sftp-server))
  241. $(eval $(call BuildPackage,openssh-sftp-avahi-service))