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.

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