openthread-br: fix actually building
[feed/packages.git] / net / openssh / Makefile
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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=openssh
11 PKG_VERSION:=9.4p1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
16 https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/
17 PKG_HASH:=3608fd9088db2163ceb3e600c85ab79d0de3d221e59192ea1923e23263866a85
18
19 PKG_LICENSE:=BSD ISC
20 PKG_LICENSE_FILES:=LICENCE
21 PKG_CPE_ID:=cpe:/a:openssh:openssh
22
23 PKG_REMOVE_FILES:=
24 PKG_CONFIG_DEPENDS := \
25 CONFIG_OPENSSH_LIBFIDO2
26
27 PKG_BUILD_DEPENDS += OPENSSH_LIBFIDO2:libfido2
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/openssh/Default
32 SECTION:=net
33 CATEGORY:=Network
34 DEPENDS:=
35 TITLE:=OpenSSH
36 MAINTAINER:=Peter Wagner <tripolar@gmx.at>
37 URL:=https://www.openssh.com/
38 SUBMENU:=SSH
39 endef
40
41 define Package/openssh-moduli
42 $(call Package/openssh/Default)
43 DEPENDS+= +openssh-keygen
44 TITLE+= moduli file
45 endef
46
47 define Package/openssh-moduli/description
48 OpenSSH server moduli file.
49 endef
50
51 define Package/openssh-client
52 $(call Package/openssh/Default)
53 DEPENDS+= +libopenssl +zlib
54 TITLE+= client
55 ALTERNATIVES:=\
56 200:/usr/bin/ssh:/usr/libexec/ssh-openssh \
57 200:/usr/bin/scp:/usr/libexec/scp-openssh
58 endef
59
60 define Package/openssh-client/description
61 OpenSSH client.
62 endef
63
64 define Package/openssh-client/conffiles
65 /etc/ssh/ssh_config
66 endef
67
68 define Package/openssh-client-utils
69 $(call Package/openssh/Default)
70 DEPENDS+= +libopenssl +zlib +openssh-client +openssh-keygen
71 TITLE+= client utilities
72 endef
73
74 define Package/openssh-client-utils/description
75 OpenSSH client utilities.
76 endef
77
78 define Package/openssh-keygen
79 $(call Package/openssh/Default)
80 DEPENDS+= +libopenssl +zlib
81 TITLE+= keygen
82 endef
83
84 define Package/openssh-keygen/description
85 OpenSSH keygen.
86 endef
87
88 define Package/openssh-server
89 $(call Package/openssh/Default)
90 DEPENDS+= +libopenssl +zlib +openssh-keygen +OPENSSH_LIBFIDO2:libfido2
91 TITLE+= server
92 USERID:=sshd=22:sshd=22
93 VARIANT:=without-pam
94 endef
95
96 define Package/openssh-server/config
97 source "$(SOURCE)/Config.in"
98 endef
99
100 define Package/openssh-server/description
101 OpenSSH server.
102 endef
103
104 define Package/openssh-server/conffiles
105 /etc/ssh/sshd_config
106 /etc/ssh/sshd_config.d/
107 /etc/ssh/ssh_host_ed25519_key
108 /etc/ssh/ssh_host_ed25519_key.pub
109 /etc/ssh/ssh_host_rsa_key
110 /etc/ssh/ssh_host_rsa_key.pub
111 /root/.ssh/authorized_keys
112 endef
113
114 define Package/openssh-server-pam
115 $(call Package/openssh/Default)
116 DEPENDS+= +libopenssl +zlib +libpthread +openssh-keygen +libpam
117 TITLE+= server (with PAM support)
118 VARIANT:=with-pam
119 USERID:=sshd=22:sshd=22
120 endef
121
122 define Package/openssh-server-pam/description
123 OpenSSH server (with PAM support).
124 endef
125
126 define Package/openssh-server-pam/conffiles
127 /etc/pam.d/sshd
128 /etc/security/access-sshd-local.conf
129 $(Package/openssh-server/conffiles)
130 endef
131
132 define Package/openssh-sftp-client
133 $(call Package/openssh/Default)
134 TITLE+= SFTP client
135 endef
136
137 define Package/openssh-sftp-client/description
138 OpenSSH SFTP client.
139 endef
140
141 define Package/openssh-sftp-server
142 $(call Package/openssh/Default)
143 TITLE+= SFTP server
144 endef
145
146 define Package/openssh-sftp-server/description
147 OpenSSH SFTP server.
148 endef
149
150 define Package/openssh-sftp-avahi-service
151 $(call Package/openssh/Default)
152 TITLE+= (SFTP Avahi service)
153 DEPENDS:=+openssh-sftp-server +avahi-daemon
154 endef
155
156 define Package/openssh-sftp-avahi-service/description
157 This package contains the service definition for announcing
158 SFTP support via mDNS/DNS-SD.
159 endef
160
161 define Package/openssh-sftp-avahi-service/conffiles
162 /etc/avahi/services/sftp-ssh.service
163 endef
164
165 CONFIGURE_ARGS += \
166 --sysconfdir=/etc/ssh \
167 --with-privsep-user=sshd \
168 --with-privsep-path=/var/empty \
169 --disable-strip \
170 --disable-etc-default-login \
171 --disable-lastlog \
172 --disable-utmp \
173 --disable-utmpx \
174 --disable-wtmp \
175 --disable-wtmpx \
176 --without-bsd-auth \
177 --without-kerberos5 \
178 --with-stackprotect \
179 --with$(if $(CONFIG_OPENSSL_ENGINE),,out)-ssl-engine \
180 --with$(if $(CONFIG_OPENSSH_LIBFIDO2),,out)-security-key-builtin
181
182 ifeq ($(BUILD_VARIANT),with-pam)
183 CONFIGURE_ARGS += \
184 --with-pam
185 else
186 CONFIGURE_ARGS += \
187 --without-pam
188 endif
189
190 CONFIGURE_VARS += LD="$(TARGET_CC)" PATH_PASSWD_PROG="/bin/passwd"
191
192 ifeq ($(BUILD_VARIANT),with-pam)
193 TARGET_LDFLAGS += -lpthread
194 endif
195
196 define Build/Compile
197 $(MAKE) -C $(PKG_BUILD_DIR) \
198 DESTDIR="$(PKG_INSTALL_DIR)" \
199 STRIP_OPT="" \
200 all install
201 endef
202
203 define Package/openssh-moduli/install
204 install -d -m0700 $(1)/etc/ssh
205 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
206 endef
207
208 define Package/openssh-client/install
209 install -d -m0700 $(1)/etc/ssh
210 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
211 $(INSTALL_DIR) $(1)/usr/libexec
212 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/libexec/ssh-openssh
213 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/libexec/scp-openssh
214 endef
215
216 define Package/openssh-client-utils/install
217 $(INSTALL_DIR) $(1)/usr/bin
218 $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
219 endef
220
221 define Package/openssh-keygen/install
222 $(INSTALL_DIR) $(1)/usr/bin
223 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
224 endef
225
226 define Package/openssh-server/install
227 install -d -m0700 $(1)/etc/ssh $(1)/etc/ssh/sshd_config.d
228 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
229 sed -r -i 's,^#(HostKey /etc/ssh/ssh_host_(rsa|ed25519)_key)$$$$,\1,' $(1)/etc/ssh/sshd_config
230 $(INSTALL_DIR) $(1)/etc/init.d
231 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
232 $(INSTALL_DIR) $(1)/lib/preinit
233 $(INSTALL_BIN) ./files/sshd.failsafe $(1)/lib/preinit/99_10_failsafe_sshd
234 $(INSTALL_DIR) $(1)/usr/sbin
235 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
236 endef
237
238 define Package/openssh-server-pam/install
239 $(call Package/openssh-server/install,$(1))
240 sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
241 sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
242 $(INSTALL_DIR) $(1)/etc/pam.d
243 $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
244 $(INSTALL_DIR) $(1)/etc/security
245 $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
246 endef
247
248 define Package/openssh-sftp-client/install
249 $(INSTALL_DIR) $(1)/usr/bin
250 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
251 endef
252
253 define Package/openssh-sftp-server/install
254 $(INSTALL_DIR) $(1)/usr/lib
255 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
256 $(INSTALL_DIR) $(1)/usr/libexec
257 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
258 endef
259
260 define Package/openssh-sftp-avahi-service/install
261 $(INSTALL_DIR) $(1)/etc/avahi/services
262 $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
263 endef
264
265 $(eval $(call BuildPackage,openssh-client))
266 $(eval $(call BuildPackage,openssh-moduli))
267 $(eval $(call BuildPackage,openssh-client-utils))
268 $(eval $(call BuildPackage,openssh-keygen))
269 $(eval $(call BuildPackage,openssh-server))
270 $(eval $(call BuildPackage,openssh-server-pam))
271 $(eval $(call BuildPackage,openssh-sftp-client))
272 $(eval $(call BuildPackage,openssh-sftp-server))
273 $(eval $(call BuildPackage,openssh-sftp-avahi-service))