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.

280 lines
6.9 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.9p1
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
  13. https://ftp.spline.de/pub/OpenBSD/OpenSSH/portable/ \
  14. https://anorien.csc.warwick.ac.uk/pub/OpenBSD/OpenSSH/portable/
  15. PKG_HASH:=6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad
  16. PKG_LICENSE:=BSD ISC
  17. PKG_LICENSE_FILES:=LICENCE
  18. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  19. PKG_REMOVE_FILES:=
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/openssh/Default
  22. SECTION:=net
  23. CATEGORY:=Network
  24. DEPENDS:=+libopenssl +zlib
  25. TITLE:=OpenSSH
  26. MAINTAINER:=Peter Wagner <tripolar@gmx.at>
  27. URL:=http://www.openssh.com/
  28. SUBMENU:=SSH
  29. VARIANT:=without-pam
  30. endef
  31. define Package/openssh-moduli
  32. $(call Package/openssh/Default)
  33. DEPENDS+= +openssh-keygen
  34. TITLE+= moduli file
  35. endef
  36. define Package/openssh-moduli/description
  37. OpenSSH server moduli file.
  38. endef
  39. define Package/openssh-client
  40. $(call Package/openssh/Default)
  41. TITLE+= client
  42. ALTERNATIVES:=\
  43. 200:/usr/bin/ssh:/usr/bin/openssh-ssh \
  44. 200:/usr/bin/scp:/usr/bin/openssh-scp \
  45. endef
  46. define Package/openssh-client/description
  47. OpenSSH client.
  48. endef
  49. define Package/openssh-client/conffiles
  50. /etc/ssh/ssh_config
  51. endef
  52. define Package/openssh-client-utils
  53. $(call Package/openssh/Default)
  54. DEPENDS+= +openssh-client +openssh-keygen
  55. TITLE+= client utilities
  56. endef
  57. define Package/openssh-client-utils/description
  58. OpenSSH client utilities.
  59. endef
  60. define Package/openssh-keygen
  61. $(call Package/openssh/Default)
  62. TITLE+= keygen
  63. endef
  64. define Package/openssh-keygen/description
  65. OpenSSH keygen.
  66. endef
  67. define Package/openssh-server
  68. $(call Package/openssh/Default)
  69. DEPENDS+= +openssh-keygen
  70. TITLE+= server
  71. USERID:=sshd=22:sshd=22
  72. endef
  73. define Package/openssh-server/description
  74. OpenSSH server.
  75. endef
  76. define Package/openssh-server/conffiles
  77. /etc/ssh/sshd_config
  78. /etc/ssh/ssh_host_*_key
  79. /etc/ssh/ssh_host_*_key.pub
  80. endef
  81. define Package/openssh-server-pam
  82. $(call Package/openssh/Default)
  83. DEPENDS+= +libpthread +openssh-keygen +libpam
  84. TITLE+= server (with PAM support)
  85. VARIANT:=with-pam
  86. USERID:=sshd=22:sshd=22
  87. endef
  88. define Package/openssh-server-pam/description
  89. OpenSSH server (with PAM support).
  90. endef
  91. define Package/openssh-server-pam/conffiles
  92. /etc/pam.d/sshd
  93. /etc/security/access-sshd-local.conf
  94. /etc/ssh/sshd_config
  95. endef
  96. define Package/openssh-sftp-client
  97. $(call Package/openssh/Default)
  98. TITLE+= SFTP client
  99. endef
  100. define Package/openssh-sftp-client/description
  101. OpenSSH SFTP client.
  102. endef
  103. define Package/openssh-sftp-server
  104. $(call Package/openssh/Default)
  105. TITLE+= SFTP server
  106. # Strip dependencies to avoid pulling in OpenSSL etc.
  107. DEPENDS:=
  108. endef
  109. define Package/openssh-sftp-server/description
  110. OpenSSH SFTP server.
  111. endef
  112. define Package/openssh-sftp-avahi-service
  113. $(call Package/openssh/Default)
  114. TITLE+= (SFTP Avahi service)
  115. DEPENDS:=+openssh-sftp-server +avahi-daemon
  116. endef
  117. define Package/openssh-sftp-avahi-service/description
  118. This package contains the service definition for announcing
  119. SFTP support via mDNS/DNS-SD.
  120. endef
  121. define Package/openssh-sftp-avahi-service/conffiles
  122. /etc/avahi/services/sftp-ssh.service
  123. endef
  124. CONFIGURE_ARGS+= \
  125. $(DISABLE_NLS) \
  126. --sysconfdir=/etc/ssh \
  127. --with-privsep-user=sshd \
  128. --with-privsep-path=/var/empty \
  129. --enable-shared \
  130. --disable-static \
  131. --disable-debug \
  132. --disable-strip \
  133. --disable-etc-default-login \
  134. --disable-lastlog \
  135. --disable-utmp \
  136. --disable-utmpx \
  137. --disable-wtmp \
  138. --disable-wtmpx \
  139. --without-bsd-auth \
  140. --without-kerberos5 \
  141. --without-x
  142. ifeq ($(BUILD_VARIANT),with-pam)
  143. CONFIGURE_ARGS += \
  144. --with-pam
  145. else
  146. CONFIGURE_ARGS += \
  147. --without-pam
  148. endif
  149. ifeq ($(CONFIG_OPENSSL_ENGINE_CRYPTO),y)
  150. CONFIGURE_ARGS+= \
  151. --with-ssl-engine
  152. endif
  153. ifneq ($(CONFIG_SSP_SUPPORT),y)
  154. CONFIGURE_ARGS += \
  155. --without-stackprotect
  156. endif
  157. CONFIGURE_VARS += LD="$(TARGET_CC)"
  158. ifeq ($(BUILD_VARIANT),with-pam)
  159. TARGET_LDFLAGS += -lpthread
  160. endif
  161. define Build/Compile
  162. $(MAKE) -C $(PKG_BUILD_DIR) \
  163. DESTDIR="$(PKG_INSTALL_DIR)" \
  164. LIBS="" \
  165. sftp-server
  166. $(MAKE) -C $(PKG_BUILD_DIR) \
  167. DESTDIR="$(PKG_INSTALL_DIR)" \
  168. STRIP_OPT="" \
  169. all install
  170. endef
  171. define Package/openssh-moduli/install
  172. $(INSTALL_DIR) $(1)/etc/ssh
  173. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  174. endef
  175. define Package/openssh-client/install
  176. $(INSTALL_DIR) $(1)/etc/ssh
  177. chmod 0700 $(1)/etc/ssh
  178. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  179. $(INSTALL_DIR) $(1)/usr/bin
  180. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/openssh-ssh
  181. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/openssh-scp
  182. endef
  183. define Package/openssh-client-utils/install
  184. $(INSTALL_DIR) $(1)/usr/bin
  185. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  186. endef
  187. define Package/openssh-keygen/install
  188. $(INSTALL_DIR) $(1)/usr/bin
  189. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  190. endef
  191. define Package/openssh-server/install
  192. $(INSTALL_DIR) $(1)/etc/ssh
  193. chmod 0700 $(1)/etc/ssh
  194. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  195. sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ecdsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config
  196. $(INSTALL_DIR) $(1)/etc/init.d
  197. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  198. $(INSTALL_DIR) $(1)/usr/sbin
  199. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  200. endef
  201. define Package/openssh-server-pam/install
  202. $(call Package/openssh-server/install,$(1))
  203. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  204. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  205. $(INSTALL_DIR) $(1)/etc/pam.d
  206. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  207. $(INSTALL_DIR) $(1)/etc/security
  208. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  209. endef
  210. define Package/openssh-sftp-client/install
  211. $(INSTALL_DIR) $(1)/usr/bin
  212. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  213. endef
  214. define Package/openssh-sftp-server/install
  215. $(INSTALL_DIR) $(1)/usr/lib
  216. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  217. $(INSTALL_DIR) $(1)/usr/libexec
  218. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  219. endef
  220. define Package/openssh-sftp-avahi-service/install
  221. $(INSTALL_DIR) $(1)/etc/avahi/services
  222. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  223. endef
  224. $(eval $(call BuildPackage,openssh-client))
  225. $(eval $(call BuildPackage,openssh-moduli))
  226. $(eval $(call BuildPackage,openssh-client-utils))
  227. $(eval $(call BuildPackage,openssh-keygen))
  228. $(eval $(call BuildPackage,openssh-server))
  229. $(eval $(call BuildPackage,openssh-server-pam))
  230. $(eval $(call BuildPackage,openssh-sftp-client))
  231. $(eval $(call BuildPackage,openssh-sftp-server))
  232. $(eval $(call BuildPackage,openssh-sftp-avahi-service))