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