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.

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