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.

293 lines
7.2 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.5p1
  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:=9846e3c5fab9f0547400b4d2c017992f914222b3fd1f8eee6c7dc6bc5e59f9f0
  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. PKG_BUILD_DEPENDS:=libopenssl
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/openssh/Default
  22. SECTION:=net
  23. CATEGORY:=Network
  24. DEPENDS:=+libopenssl +zlib
  25. TITLE:=OpenSSH
  26. MAINTAINER:=Peter Wagner <tripolar@gmx.at>
  27. URL:=http://www.openssh.com/
  28. SUBMENU:=SSH
  29. VARIANT:=without-pam
  30. endef
  31. define Package/openssh-moduli
  32. $(call Package/openssh/Default)
  33. DEPENDS+= +openssh-keygen
  34. TITLE+= moduli file
  35. endef
  36. define Package/openssh-moduli/description
  37. OpenSSH server moduli file.
  38. endef
  39. define Package/openssh-client
  40. $(call Package/openssh/Default)
  41. TITLE+= client
  42. endef
  43. define Package/openssh-client/description
  44. OpenSSH client.
  45. endef
  46. define Package/openssh-client/conffiles
  47. /etc/ssh/ssh_config
  48. endef
  49. define Package/openssh-client-utils
  50. $(call Package/openssh/Default)
  51. DEPENDS+= +openssh-client +openssh-keygen
  52. TITLE+= client utilities
  53. endef
  54. define Package/openssh-client-utils/description
  55. OpenSSH client utilities.
  56. endef
  57. define Package/openssh-keygen
  58. $(call Package/openssh/Default)
  59. TITLE+= keygen
  60. endef
  61. define Package/openssh-keygen/description
  62. OpenSSH keygen.
  63. endef
  64. define Package/openssh-server
  65. $(call Package/openssh/Default)
  66. DEPENDS+= +openssh-keygen
  67. TITLE+= server
  68. USERID:=sshd=22:sshd=22
  69. endef
  70. define Package/openssh-server/description
  71. OpenSSH server.
  72. endef
  73. define Package/openssh-server/conffiles
  74. /etc/ssh/sshd_config
  75. endef
  76. define Package/openssh-server-pam
  77. $(call Package/openssh/Default)
  78. DEPENDS+= +libpthread +openssh-keygen +libpam
  79. TITLE+= server (with PAM support)
  80. VARIANT:=with-pam
  81. USERID:=sshd=22:sshd=22
  82. endef
  83. define Package/openssh-server-pam/description
  84. OpenSSH server (with PAM support).
  85. endef
  86. define Package/openssh-server-pam/conffiles
  87. /etc/pam.d/sshd
  88. /etc/security/access-sshd-local.conf
  89. /etc/ssh/sshd_config
  90. endef
  91. define Package/openssh-sftp-client
  92. $(call Package/openssh/Default)
  93. TITLE+= SFTP client
  94. endef
  95. define Package/openssh-sftp-client/description
  96. OpenSSH SFTP client.
  97. endef
  98. define Package/openssh-sftp-server
  99. $(call Package/openssh/Default)
  100. TITLE+= SFTP server
  101. # Strip dependencies to avoid pulling in OpenSSL etc.
  102. DEPENDS:=
  103. endef
  104. define Package/openssh-sftp-server/description
  105. OpenSSH SFTP server.
  106. endef
  107. define Package/openssh-sftp-avahi-service
  108. $(call Package/openssh/Default)
  109. TITLE+= (SFTP Avahi service)
  110. DEPENDS:=+openssh-sftp-server +avahi-daemon
  111. endef
  112. define Package/openssh-sftp-avahi-service/description
  113. This package contains the service definition for announcing
  114. SFTP support via mDNS/DNS-SD.
  115. endef
  116. define Package/openssh-sftp-avahi-service/conffiles
  117. /etc/avahi/services/sftp-ssh.service
  118. endef
  119. CONFIGURE_ARGS+= \
  120. $(DISABLE_NLS) \
  121. --sysconfdir=/etc/ssh \
  122. --with-privsep-user=sshd \
  123. --with-privsep-path=/var/empty \
  124. --enable-shared \
  125. --disable-static \
  126. --disable-debug \
  127. --disable-strip \
  128. --disable-etc-default-login \
  129. --disable-lastlog \
  130. --disable-utmp \
  131. --disable-utmpx \
  132. --disable-wtmp \
  133. --disable-wtmpx \
  134. --without-bsd-auth \
  135. --without-kerberos5 \
  136. --without-x
  137. ifeq ($(BUILD_VARIANT),with-pam)
  138. CONFIGURE_ARGS += \
  139. --with-pam
  140. else
  141. CONFIGURE_ARGS += \
  142. --without-pam
  143. endif
  144. ifeq ($(CONFIG_OPENSSL_ENGINE_CRYPTO),y)
  145. CONFIGURE_ARGS+= \
  146. --with-ssl-engine
  147. endif
  148. ifneq ($(CONFIG_SSP_SUPPORT),y)
  149. CONFIGURE_ARGS += \
  150. --without-stackprotect
  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. LIBS="" \
  160. sftp-server
  161. $(MAKE) -C $(PKG_BUILD_DIR) \
  162. DESTDIR="$(PKG_INSTALL_DIR)" \
  163. STRIP_OPT="" \
  164. all install
  165. endef
  166. define Package/openssh-client/preinst
  167. #!/bin/sh
  168. if [ -L $${IPKG_INSTROOT}/usr/bin/ssh ] && [ -L $${IPKG_INSTROOT}/usr/bin/scp ]; then
  169. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  170. fi
  171. exit 0
  172. endef
  173. define Package/openssh-client/postrm
  174. #!/bin/sh
  175. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  176. if [ -x $${IPKG_INSTROOT}/usr/sbin/dropbear ] ; then
  177. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/ssh;
  178. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/scp;
  179. fi
  180. exit 0
  181. endef
  182. define Package/openssh-moduli/install
  183. $(INSTALL_DIR) $(1)/etc/ssh
  184. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  185. endef
  186. define Package/openssh-client/install
  187. $(INSTALL_DIR) $(1)/etc/ssh
  188. chmod 0700 $(1)/etc/ssh
  189. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  190. $(INSTALL_DIR) $(1)/usr/bin
  191. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
  192. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
  193. endef
  194. define Package/openssh-client-utils/install
  195. $(INSTALL_DIR) $(1)/usr/bin
  196. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  197. endef
  198. define Package/openssh-keygen/install
  199. $(INSTALL_DIR) $(1)/usr/bin
  200. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  201. endef
  202. define Package/openssh-server/install
  203. $(INSTALL_DIR) $(1)/etc/ssh
  204. chmod 0700 $(1)/etc/ssh
  205. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  206. sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ecdsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config
  207. $(INSTALL_DIR) $(1)/etc/init.d
  208. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  209. $(INSTALL_DIR) $(1)/usr/sbin
  210. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  211. endef
  212. define Package/openssh-server-pam/install
  213. $(call Package/openssh-server/install,$(1))
  214. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  215. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  216. $(INSTALL_DIR) $(1)/etc/pam.d
  217. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  218. $(INSTALL_DIR) $(1)/etc/security
  219. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  220. endef
  221. define Package/openssh-sftp-client/install
  222. $(INSTALL_DIR) $(1)/usr/bin
  223. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  224. endef
  225. define Package/openssh-sftp-server/install
  226. $(INSTALL_DIR) $(1)/usr/lib
  227. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  228. $(INSTALL_DIR) $(1)/usr/libexec
  229. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  230. endef
  231. define Package/openssh-sftp-avahi-service/install
  232. $(INSTALL_DIR) $(1)/etc/avahi/services
  233. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  234. endef
  235. $(eval $(call BuildPackage,openssh-client))
  236. $(eval $(call BuildPackage,openssh-moduli))
  237. $(eval $(call BuildPackage,openssh-client-utils))
  238. $(eval $(call BuildPackage,openssh-keygen))
  239. $(eval $(call BuildPackage,openssh-server))
  240. $(eval $(call BuildPackage,openssh-server-pam))
  241. $(eval $(call BuildPackage,openssh-sftp-client))
  242. $(eval $(call BuildPackage,openssh-sftp-server))
  243. $(eval $(call BuildPackage,openssh-sftp-avahi-service))