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.

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