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.

295 lines
7.3 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.6p1
  10. PKG_RELEASE:=1
  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:=a323caeeddfe145baaa0db16e98d784b1fbc7dd436a6bf1f479dfd5cd1d21723
  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. /etc/ssh/ssh_host_*_key
  76. /etc/ssh/ssh_host_*_key.pub
  77. endef
  78. define Package/openssh-server-pam
  79. $(call Package/openssh/Default)
  80. DEPENDS+= +libpthread +openssh-keygen +libpam
  81. TITLE+= server (with PAM support)
  82. VARIANT:=with-pam
  83. USERID:=sshd=22:sshd=22
  84. endef
  85. define Package/openssh-server-pam/description
  86. OpenSSH server (with PAM support).
  87. endef
  88. define Package/openssh-server-pam/conffiles
  89. /etc/pam.d/sshd
  90. /etc/security/access-sshd-local.conf
  91. /etc/ssh/sshd_config
  92. endef
  93. define Package/openssh-sftp-client
  94. $(call Package/openssh/Default)
  95. TITLE+= SFTP client
  96. endef
  97. define Package/openssh-sftp-client/description
  98. OpenSSH SFTP client.
  99. endef
  100. define Package/openssh-sftp-server
  101. $(call Package/openssh/Default)
  102. TITLE+= SFTP server
  103. # Strip dependencies to avoid pulling in OpenSSL etc.
  104. DEPENDS:=
  105. endef
  106. define Package/openssh-sftp-server/description
  107. OpenSSH SFTP server.
  108. endef
  109. define Package/openssh-sftp-avahi-service
  110. $(call Package/openssh/Default)
  111. TITLE+= (SFTP Avahi service)
  112. DEPENDS:=+openssh-sftp-server +avahi-daemon
  113. endef
  114. define Package/openssh-sftp-avahi-service/description
  115. This package contains the service definition for announcing
  116. SFTP support via mDNS/DNS-SD.
  117. endef
  118. define Package/openssh-sftp-avahi-service/conffiles
  119. /etc/avahi/services/sftp-ssh.service
  120. endef
  121. CONFIGURE_ARGS+= \
  122. $(DISABLE_NLS) \
  123. --sysconfdir=/etc/ssh \
  124. --with-privsep-user=sshd \
  125. --with-privsep-path=/var/empty \
  126. --enable-shared \
  127. --disable-static \
  128. --disable-debug \
  129. --disable-strip \
  130. --disable-etc-default-login \
  131. --disable-lastlog \
  132. --disable-utmp \
  133. --disable-utmpx \
  134. --disable-wtmp \
  135. --disable-wtmpx \
  136. --without-bsd-auth \
  137. --without-kerberos5 \
  138. --without-x
  139. ifeq ($(BUILD_VARIANT),with-pam)
  140. CONFIGURE_ARGS += \
  141. --with-pam
  142. else
  143. CONFIGURE_ARGS += \
  144. --without-pam
  145. endif
  146. ifeq ($(CONFIG_OPENSSL_ENGINE_CRYPTO),y)
  147. CONFIGURE_ARGS+= \
  148. --with-ssl-engine
  149. endif
  150. ifneq ($(CONFIG_SSP_SUPPORT),y)
  151. CONFIGURE_ARGS += \
  152. --without-stackprotect
  153. endif
  154. CONFIGURE_VARS += LD="$(TARGET_CC)"
  155. ifeq ($(BUILD_VARIANT),with-pam)
  156. TARGET_LDFLAGS += -lpthread
  157. endif
  158. define Build/Compile
  159. $(MAKE) -C $(PKG_BUILD_DIR) \
  160. DESTDIR="$(PKG_INSTALL_DIR)" \
  161. LIBS="" \
  162. sftp-server
  163. $(MAKE) -C $(PKG_BUILD_DIR) \
  164. DESTDIR="$(PKG_INSTALL_DIR)" \
  165. STRIP_OPT="" \
  166. all install
  167. endef
  168. define Package/openssh-client/preinst
  169. #!/bin/sh
  170. if [ -L $${IPKG_INSTROOT}/usr/bin/ssh ] && [ -L $${IPKG_INSTROOT}/usr/bin/scp ]; then
  171. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  172. fi
  173. exit 0
  174. endef
  175. define Package/openssh-client/postrm
  176. #!/bin/sh
  177. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  178. if [ -x $${IPKG_INSTROOT}/usr/sbin/dropbear ] ; then
  179. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/ssh;
  180. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/scp;
  181. fi
  182. exit 0
  183. endef
  184. define Package/openssh-moduli/install
  185. $(INSTALL_DIR) $(1)/etc/ssh
  186. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  187. endef
  188. define Package/openssh-client/install
  189. $(INSTALL_DIR) $(1)/etc/ssh
  190. chmod 0700 $(1)/etc/ssh
  191. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  192. $(INSTALL_DIR) $(1)/usr/bin
  193. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
  194. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
  195. endef
  196. define Package/openssh-client-utils/install
  197. $(INSTALL_DIR) $(1)/usr/bin
  198. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  199. endef
  200. define Package/openssh-keygen/install
  201. $(INSTALL_DIR) $(1)/usr/bin
  202. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  203. endef
  204. define Package/openssh-server/install
  205. $(INSTALL_DIR) $(1)/etc/ssh
  206. chmod 0700 $(1)/etc/ssh
  207. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  208. sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ecdsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config
  209. $(INSTALL_DIR) $(1)/etc/init.d
  210. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  211. $(INSTALL_DIR) $(1)/usr/sbin
  212. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  213. endef
  214. define Package/openssh-server-pam/install
  215. $(call Package/openssh-server/install,$(1))
  216. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  217. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  218. $(INSTALL_DIR) $(1)/etc/pam.d
  219. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  220. $(INSTALL_DIR) $(1)/etc/security
  221. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  222. endef
  223. define Package/openssh-sftp-client/install
  224. $(INSTALL_DIR) $(1)/usr/bin
  225. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  226. endef
  227. define Package/openssh-sftp-server/install
  228. $(INSTALL_DIR) $(1)/usr/lib
  229. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  230. $(INSTALL_DIR) $(1)/usr/libexec
  231. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  232. endef
  233. define Package/openssh-sftp-avahi-service/install
  234. $(INSTALL_DIR) $(1)/etc/avahi/services
  235. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  236. endef
  237. $(eval $(call BuildPackage,openssh-client))
  238. $(eval $(call BuildPackage,openssh-moduli))
  239. $(eval $(call BuildPackage,openssh-client-utils))
  240. $(eval $(call BuildPackage,openssh-keygen))
  241. $(eval $(call BuildPackage,openssh-server))
  242. $(eval $(call BuildPackage,openssh-server-pam))
  243. $(eval $(call BuildPackage,openssh-sftp-client))
  244. $(eval $(call BuildPackage,openssh-sftp-server))
  245. $(eval $(call BuildPackage,openssh-sftp-avahi-service))