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.

269 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. $(Package/openssh-server/conffiles)
  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)" PATH_PASSWD_PROG="/bin/passwd"
  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 -d -m0700 $(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 -d -m0700 $(1)/etc/ssh
  168. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  169. $(INSTALL_DIR) $(1)/usr/libexec
  170. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/libexec/ssh-openssh
  171. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/libexec/scp-openssh
  172. endef
  173. define Package/openssh-client-utils/install
  174. $(INSTALL_DIR) $(1)/usr/bin
  175. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  176. endef
  177. define Package/openssh-keygen/install
  178. $(INSTALL_DIR) $(1)/usr/bin
  179. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  180. endef
  181. define Package/openssh-server/install
  182. install -d -m0700 $(1)/etc/ssh
  183. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  184. sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config
  185. $(INSTALL_DIR) $(1)/etc/init.d
  186. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  187. $(INSTALL_DIR) $(1)/lib/preinit
  188. $(INSTALL_BIN) ./files/sshd.failsafe $(1)/lib/preinit/99_10_failsafe_sshd
  189. $(INSTALL_DIR) $(1)/usr/sbin
  190. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  191. endef
  192. define Package/openssh-server-pam/install
  193. $(call Package/openssh-server/install,$(1))
  194. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  195. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  196. $(INSTALL_DIR) $(1)/etc/pam.d
  197. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  198. $(INSTALL_DIR) $(1)/etc/security
  199. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  200. endef
  201. define Package/openssh-sftp-client/install
  202. $(INSTALL_DIR) $(1)/usr/bin
  203. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  204. endef
  205. define Package/openssh-sftp-server/install
  206. $(INSTALL_DIR) $(1)/usr/lib
  207. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  208. $(INSTALL_DIR) $(1)/usr/libexec
  209. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  210. endef
  211. define Package/openssh-sftp-avahi-service/install
  212. $(INSTALL_DIR) $(1)/etc/avahi/services
  213. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  214. endef
  215. $(eval $(call BuildPackage,openssh-client))
  216. $(eval $(call BuildPackage,openssh-moduli))
  217. $(eval $(call BuildPackage,openssh-client-utils))
  218. $(eval $(call BuildPackage,openssh-keygen))
  219. $(eval $(call BuildPackage,openssh-server))
  220. $(eval $(call BuildPackage,openssh-server-pam))
  221. $(eval $(call BuildPackage,openssh-sftp-client))
  222. $(eval $(call BuildPackage,openssh-sftp-server))
  223. $(eval $(call BuildPackage,openssh-sftp-avahi-service))