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.

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