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.

274 lines
6.8 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:=8.0p1
  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:=bd943879e69498e8031eb6b7f44d08cdc37d59a7ab689aa0b437320c3481fd68
  16. PKG_LICENSE:=BSD ISC
  17. PKG_LICENSE_FILES:=LICENCE
  18. PKG_CPE_ID:=cpe:/a:openssh:openssh
  19. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  20. PKG_REMOVE_FILES:=
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/openssh/Default
  23. SECTION:=net
  24. CATEGORY:=Network
  25. DEPENDS:=+libopenssl +zlib
  26. TITLE:=OpenSSH
  27. MAINTAINER:=Peter Wagner <tripolar@gmx.at>
  28. URL:=http://www.openssh.com/
  29. SUBMENU:=SSH
  30. VARIANT:=without-pam
  31. endef
  32. define Package/openssh-moduli
  33. $(call Package/openssh/Default)
  34. DEPENDS+= +openssh-keygen
  35. TITLE+= moduli file
  36. endef
  37. define Package/openssh-moduli/description
  38. OpenSSH server moduli file.
  39. endef
  40. define Package/openssh-client
  41. $(call Package/openssh/Default)
  42. TITLE+= client
  43. ALTERNATIVES:=\
  44. 200:/usr/bin/ssh:/usr/bin/openssh-ssh \
  45. 200:/usr/bin/scp:/usr/bin/openssh-scp \
  46. endef
  47. define Package/openssh-client/description
  48. OpenSSH client.
  49. endef
  50. define Package/openssh-client/conffiles
  51. /etc/ssh/ssh_config
  52. endef
  53. define Package/openssh-client-utils
  54. $(call Package/openssh/Default)
  55. DEPENDS+= +openssh-client +openssh-keygen
  56. TITLE+= client utilities
  57. endef
  58. define Package/openssh-client-utils/description
  59. OpenSSH client utilities.
  60. endef
  61. define Package/openssh-keygen
  62. $(call Package/openssh/Default)
  63. TITLE+= keygen
  64. endef
  65. define Package/openssh-keygen/description
  66. OpenSSH keygen.
  67. endef
  68. define Package/openssh-server
  69. $(call Package/openssh/Default)
  70. DEPENDS+= +openssh-keygen
  71. TITLE+= server
  72. USERID:=sshd=22:sshd=22
  73. endef
  74. define Package/openssh-server/description
  75. OpenSSH server.
  76. endef
  77. define Package/openssh-server/conffiles
  78. /etc/ssh/sshd_config
  79. /etc/ssh/ssh_host_*_key
  80. /etc/ssh/ssh_host_*_key.pub
  81. endef
  82. define Package/openssh-server-pam
  83. $(call Package/openssh/Default)
  84. DEPENDS+= +libpthread +openssh-keygen +libpam
  85. TITLE+= server (with PAM support)
  86. VARIANT:=with-pam
  87. USERID:=sshd=22:sshd=22
  88. endef
  89. define Package/openssh-server-pam/description
  90. OpenSSH server (with PAM support).
  91. endef
  92. define Package/openssh-server-pam/conffiles
  93. /etc/pam.d/sshd
  94. /etc/security/access-sshd-local.conf
  95. /etc/ssh/sshd_config
  96. endef
  97. define Package/openssh-sftp-client
  98. $(call Package/openssh/Default)
  99. TITLE+= SFTP client
  100. endef
  101. define Package/openssh-sftp-client/description
  102. OpenSSH SFTP client.
  103. endef
  104. define Package/openssh-sftp-server
  105. $(call Package/openssh/Default)
  106. TITLE+= SFTP server
  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),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. STRIP_OPT="" \
  164. all install
  165. endef
  166. define Package/openssh-moduli/install
  167. $(INSTALL_DIR) $(1)/etc/ssh
  168. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  169. endef
  170. define Package/openssh-client/install
  171. $(INSTALL_DIR) $(1)/etc/ssh
  172. chmod 0700 $(1)/etc/ssh
  173. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  174. $(INSTALL_DIR) $(1)/usr/bin
  175. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/openssh-ssh
  176. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/openssh-scp
  177. endef
  178. define Package/openssh-client-utils/install
  179. $(INSTALL_DIR) $(1)/usr/bin
  180. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  181. endef
  182. define Package/openssh-keygen/install
  183. $(INSTALL_DIR) $(1)/usr/bin
  184. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  185. endef
  186. define Package/openssh-server/install
  187. $(INSTALL_DIR) $(1)/etc/ssh
  188. chmod 0700 $(1)/etc/ssh
  189. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  190. sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ecdsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config
  191. $(INSTALL_DIR) $(1)/etc/init.d
  192. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  193. $(INSTALL_DIR) $(1)/usr/sbin
  194. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  195. endef
  196. define Package/openssh-server-pam/install
  197. $(call Package/openssh-server/install,$(1))
  198. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  199. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  200. $(INSTALL_DIR) $(1)/etc/pam.d
  201. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  202. $(INSTALL_DIR) $(1)/etc/security
  203. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  204. endef
  205. define Package/openssh-sftp-client/install
  206. $(INSTALL_DIR) $(1)/usr/bin
  207. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  208. endef
  209. define Package/openssh-sftp-server/install
  210. $(INSTALL_DIR) $(1)/usr/lib
  211. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  212. $(INSTALL_DIR) $(1)/usr/libexec
  213. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  214. endef
  215. define Package/openssh-sftp-avahi-service/install
  216. $(INSTALL_DIR) $(1)/etc/avahi/services
  217. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  218. endef
  219. $(eval $(call BuildPackage,openssh-client))
  220. $(eval $(call BuildPackage,openssh-moduli))
  221. $(eval $(call BuildPackage,openssh-client-utils))
  222. $(eval $(call BuildPackage,openssh-keygen))
  223. $(eval $(call BuildPackage,openssh-server))
  224. $(eval $(call BuildPackage,openssh-server-pam))
  225. $(eval $(call BuildPackage,openssh-sftp-client))
  226. $(eval $(call BuildPackage,openssh-sftp-server))
  227. $(eval $(call BuildPackage,openssh-sftp-avahi-service))