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.

292 lines
7.1 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.4p1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://ftp.spline.de/pub/OpenBSD/OpenSSH/portable/ \
  13. https://anorien.csc.warwick.ac.uk/pub/OpenBSD/OpenSSH/portable/ \
  14. https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/
  15. PKG_MD5SUM:=b2db2a83caf66a208bb78d6d287cdaa3
  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),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. $(INSTALL_DIR) $(1)/etc/init.d
  207. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  208. $(INSTALL_DIR) $(1)/usr/sbin
  209. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  210. endef
  211. define Package/openssh-server-pam/install
  212. $(call Package/openssh-server/install,$(1))
  213. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  214. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  215. $(INSTALL_DIR) $(1)/etc/pam.d
  216. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  217. $(INSTALL_DIR) $(1)/etc/security
  218. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  219. endef
  220. define Package/openssh-sftp-client/install
  221. $(INSTALL_DIR) $(1)/usr/bin
  222. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  223. endef
  224. define Package/openssh-sftp-server/install
  225. $(INSTALL_DIR) $(1)/usr/lib
  226. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  227. $(INSTALL_DIR) $(1)/usr/libexec
  228. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  229. endef
  230. define Package/openssh-sftp-avahi-service/install
  231. $(INSTALL_DIR) $(1)/etc/avahi/services
  232. $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
  233. endef
  234. $(eval $(call BuildPackage,openssh-client))
  235. $(eval $(call BuildPackage,openssh-moduli))
  236. $(eval $(call BuildPackage,openssh-client-utils))
  237. $(eval $(call BuildPackage,openssh-keygen))
  238. $(eval $(call BuildPackage,openssh-server))
  239. $(eval $(call BuildPackage,openssh-server-pam))
  240. $(eval $(call BuildPackage,openssh-sftp-client))
  241. $(eval $(call BuildPackage,openssh-sftp-server))
  242. $(eval $(call BuildPackage,openssh-sftp-avahi-service))