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