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.

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