1 |
commit: 4c0b9982d08f85a5701b2d0552fe0e38d2a90094 |
2 |
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com> |
3 |
AuthorDate: Fri Apr 19 03:55:01 2019 +0000 |
4 |
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 19 03:55:55 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c0b9982 |
7 |
|
8 |
net-misc/openssh: Version bump to 8.0_p1 |
9 |
|
10 |
- Bump the X509 patchset as well to 12.0 |
11 |
- No longer apply the AES-CTR-MT with USE=X509 since it hasn't worked |
12 |
in quite some time |
13 |
|
14 |
- Forward port the HPN patchset |
15 |
- Set the maxium number of threads in AES-CTR-MT to 16, since it |
16 |
hangs at 20 threads |
17 |
|
18 |
Copyright: Sony Interactive Entertainment Inc. |
19 |
Package-Manager: Portage-2.3.63, Repoman-2.3.12 |
20 |
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org> |
21 |
|
22 |
net-misc/openssh/Manifest | 3 + |
23 |
.../openssh/files/openssh-8.0_p1-GSSAPI-dns.patch | 359 ++++++++++++++++ |
24 |
.../files/openssh-8.0_p1-X509-12.0-tests.patch | 12 + |
25 |
...openssh-8.0_p1-X509-dont-make-piddir-12.0.patch | 16 + |
26 |
.../files/openssh-8.0_p1-X509-glue-12.0.patch | 19 + |
27 |
.../files/openssh-8.0_p1-hpn-X509-glue.patch | 114 +++++ |
28 |
.../openssh/files/openssh-8.0_p1-hpn-glue.patch | 194 +++++++++ |
29 |
.../openssh/files/openssh-8.0_p1-hpn-version.patch | 13 + |
30 |
net-misc/openssh/files/openssh-8.0_p1-tests.patch | 43 ++ |
31 |
net-misc/openssh/openssh-8.0_p1.ebuild | 461 +++++++++++++++++++++ |
32 |
10 files changed, 1234 insertions(+) |
33 |
|
34 |
diff --git a/net-misc/openssh/Manifest b/net-misc/openssh/Manifest |
35 |
index d019cc5b6fd..c71f5ce7b9f 100644 |
36 |
--- a/net-misc/openssh/Manifest |
37 |
+++ b/net-misc/openssh/Manifest |
38 |
@@ -13,4 +13,7 @@ DIST openssh-7.9p1-sctp-1.2.patch.xz 7360 BLAKE2B 60e209371ecac24d0b60e48459d4d4 |
39 |
DIST openssh-7.9p1.tar.gz 1565384 BLAKE2B de15795e03d33d4f9fe4792f6b14500123230b6c00c1e5bd7207bb6d6bf6df0b2e057c1b1de0fee709f58dd159203fdd69fe1473118a6baedebaa0c1c4c55b59 SHA512 0412c9c429c9287f0794023951469c8e6ec833cdb55821bfa0300dd90d0879ff60484f620cffd93372641ab69bf0b032c2d700ccc680950892725fb631b7708e |
40 |
DIST openssh-7_8_P1-hpn-AES-CTR-14.16.diff 29231 BLAKE2B e25877c5e22f674e6db5a0bc107e5daa2509fe762fb14ce7bb2ce9a115e8177a93340c1d19247b6c2c854b7e1f9ae9af9fd932e5fa9c0a6b2ba438cd11a42991 SHA512 1867fb94c29a51294a71a3ec6a299757565a7cda5696118b0b346ed9c78f2c81bb1b888cff5e3418776b2fa277a8f070c5eb9327bb005453e2ffd72d35cdafa7 |
41 |
DIST openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff 43356 BLAKE2B 776fa140d64a16c339b46a7c773258d2f4fe44e48b16abccad1a8757a51cb6362722fc5f42c39159af12849f5c88cf574de64815085c97157e16653f18d4909b SHA512 53f2752b7aa02719c8dfe0fe0ef16e874101ba2ba87924aa1122cd445ece218ca09c22abaa3377307f25d459579bc28d3854e2402c71b794db65d58cdd1ebc08 |
42 |
+DIST openssh-8.0p1+x509-12.0.diff.gz 623765 BLAKE2B b1c0d533a58c55b0f8451ce5aa8ee9b462afdc1eee44018f30962d3427c73b12a57c2c88bc8656c09c2b39a2ac72755539eeb29e7060ced5d3e8470647f88c0a SHA512 5f678fd303e39df7a2fb23af682c5a02b33f7fdcafe6171b9db2067098a2048677c415c3bee75225eb9fbaf308cfac7f37b0865951cdb6dda0577908499a8295 |
43 |
+DIST openssh-8.0p1-sctp-1.2.patch.xz 7684 BLAKE2B 5d6af23549a152dabf6a54aab5957fd76f0c78528c58896d4265543b121bc4add483fc465876377554041dc88a290dfd7c42fdcc0b55c5509b403a16f0b63989 SHA512 fb0ed1f37b4f26d27e9f09f67a6368b0a277999e514498203bc09483943e5d6b02bca66becc200c7a44eef4d9a9b296b57678fafe390fd7ab3c3b74be380e9bb |
44 |
+DIST openssh-8.0p1.tar.gz 1597697 BLAKE2B 5ba79872eabb3b3964d95a8cdd690bfe0323f018d7f944d4e1acb52576c9f6d7a1ddac15e88dc42eac6ecbfabfad1c228e303a2262588769e307c38107a4cd54 SHA512 e280fa2d56f550efd37c5d2477670326261aa8b94d991f9eb17aad90e0c6c9c939efa90fe87d33260d0f709485cb05c379f0fd1bd44fc0d5190298b6398c9982 |
45 |
DIST openssh-lpk-7.5p1-0.3.14.patch.xz 17040 BLAKE2B 5b2204316dd244bb8dd11db50d5bc3a194e2cc4b64964a2d3df68bbe54c53588f15fc5176dbc3811e929573fa3e41cf91f412aa2513bb9a4b6ed02c2523c1e24 SHA512 9ce5d7e5d831c972f0f866b686bf93a048a03979ab38627973f5491eeeaa45f9faab0520b3a7ed90a13a67213fdc9cd4cf11e423acad441ea91b71037c8b435b |
46 |
|
47 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-GSSAPI-dns.patch b/net-misc/openssh/files/openssh-8.0_p1-GSSAPI-dns.patch |
48 |
new file mode 100644 |
49 |
index 00000000000..a3bd128aa46 |
50 |
--- /dev/null |
51 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-GSSAPI-dns.patch |
52 |
@@ -0,0 +1,359 @@ |
53 |
+diff --git a/auth.c b/auth.c |
54 |
+index 8696f258..f4cd70a3 100644 |
55 |
+--- a/auth.c |
56 |
++++ b/auth.c |
57 |
+@@ -723,120 +723,6 @@ fakepw(void) |
58 |
+ return (&fake); |
59 |
+ } |
60 |
+ |
61 |
+-/* |
62 |
+- * Returns the remote DNS hostname as a string. The returned string must not |
63 |
+- * be freed. NB. this will usually trigger a DNS query the first time it is |
64 |
+- * called. |
65 |
+- * This function does additional checks on the hostname to mitigate some |
66 |
+- * attacks on legacy rhosts-style authentication. |
67 |
+- * XXX is RhostsRSAAuthentication vulnerable to these? |
68 |
+- * XXX Can we remove these checks? (or if not, remove RhostsRSAAuthentication?) |
69 |
+- */ |
70 |
+- |
71 |
+-static char * |
72 |
+-remote_hostname(struct ssh *ssh) |
73 |
+-{ |
74 |
+- struct sockaddr_storage from; |
75 |
+- socklen_t fromlen; |
76 |
+- struct addrinfo hints, *ai, *aitop; |
77 |
+- char name[NI_MAXHOST], ntop2[NI_MAXHOST]; |
78 |
+- const char *ntop = ssh_remote_ipaddr(ssh); |
79 |
+- |
80 |
+- /* Get IP address of client. */ |
81 |
+- fromlen = sizeof(from); |
82 |
+- memset(&from, 0, sizeof(from)); |
83 |
+- if (getpeername(ssh_packet_get_connection_in(ssh), |
84 |
+- (struct sockaddr *)&from, &fromlen) < 0) { |
85 |
+- debug("getpeername failed: %.100s", strerror(errno)); |
86 |
+- return strdup(ntop); |
87 |
+- } |
88 |
+- |
89 |
+- ipv64_normalise_mapped(&from, &fromlen); |
90 |
+- if (from.ss_family == AF_INET6) |
91 |
+- fromlen = sizeof(struct sockaddr_in6); |
92 |
+- |
93 |
+- debug3("Trying to reverse map address %.100s.", ntop); |
94 |
+- /* Map the IP address to a host name. */ |
95 |
+- if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), |
96 |
+- NULL, 0, NI_NAMEREQD) != 0) { |
97 |
+- /* Host name not found. Use ip address. */ |
98 |
+- return strdup(ntop); |
99 |
+- } |
100 |
+- |
101 |
+- /* |
102 |
+- * if reverse lookup result looks like a numeric hostname, |
103 |
+- * someone is trying to trick us by PTR record like following: |
104 |
+- * 1.1.1.10.in-addr.arpa. IN PTR 2.3.4.5 |
105 |
+- */ |
106 |
+- memset(&hints, 0, sizeof(hints)); |
107 |
+- hints.ai_socktype = SOCK_DGRAM; /*dummy*/ |
108 |
+- hints.ai_flags = AI_NUMERICHOST; |
109 |
+- if (getaddrinfo(name, NULL, &hints, &ai) == 0) { |
110 |
+- logit("Nasty PTR record \"%s\" is set up for %s, ignoring", |
111 |
+- name, ntop); |
112 |
+- freeaddrinfo(ai); |
113 |
+- return strdup(ntop); |
114 |
+- } |
115 |
+- |
116 |
+- /* Names are stored in lowercase. */ |
117 |
+- lowercase(name); |
118 |
+- |
119 |
+- /* |
120 |
+- * Map it back to an IP address and check that the given |
121 |
+- * address actually is an address of this host. This is |
122 |
+- * necessary because anyone with access to a name server can |
123 |
+- * define arbitrary names for an IP address. Mapping from |
124 |
+- * name to IP address can be trusted better (but can still be |
125 |
+- * fooled if the intruder has access to the name server of |
126 |
+- * the domain). |
127 |
+- */ |
128 |
+- memset(&hints, 0, sizeof(hints)); |
129 |
+- hints.ai_family = from.ss_family; |
130 |
+- hints.ai_socktype = SOCK_STREAM; |
131 |
+- if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { |
132 |
+- logit("reverse mapping checking getaddrinfo for %.700s " |
133 |
+- "[%s] failed.", name, ntop); |
134 |
+- return strdup(ntop); |
135 |
+- } |
136 |
+- /* Look for the address from the list of addresses. */ |
137 |
+- for (ai = aitop; ai; ai = ai->ai_next) { |
138 |
+- if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, |
139 |
+- sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 && |
140 |
+- (strcmp(ntop, ntop2) == 0)) |
141 |
+- break; |
142 |
+- } |
143 |
+- freeaddrinfo(aitop); |
144 |
+- /* If we reached the end of the list, the address was not there. */ |
145 |
+- if (ai == NULL) { |
146 |
+- /* Address not found for the host name. */ |
147 |
+- logit("Address %.100s maps to %.600s, but this does not " |
148 |
+- "map back to the address.", ntop, name); |
149 |
+- return strdup(ntop); |
150 |
+- } |
151 |
+- return strdup(name); |
152 |
+-} |
153 |
+- |
154 |
+-/* |
155 |
+- * Return the canonical name of the host in the other side of the current |
156 |
+- * connection. The host name is cached, so it is efficient to call this |
157 |
+- * several times. |
158 |
+- */ |
159 |
+- |
160 |
+-const char * |
161 |
+-auth_get_canonical_hostname(struct ssh *ssh, int use_dns) |
162 |
+-{ |
163 |
+- static char *dnsname; |
164 |
+- |
165 |
+- if (!use_dns) |
166 |
+- return ssh_remote_ipaddr(ssh); |
167 |
+- else if (dnsname != NULL) |
168 |
+- return dnsname; |
169 |
+- else { |
170 |
+- dnsname = remote_hostname(ssh); |
171 |
+- return dnsname; |
172 |
+- } |
173 |
+-} |
174 |
+- |
175 |
+ /* |
176 |
+ * Runs command in a subprocess with a minimal environment. |
177 |
+ * Returns pid on success, 0 on failure. |
178 |
+diff --git a/canohost.c b/canohost.c |
179 |
+index f71a0856..3e162d8c 100644 |
180 |
+--- a/canohost.c |
181 |
++++ b/canohost.c |
182 |
+@@ -202,3 +202,117 @@ get_local_port(int sock) |
183 |
+ { |
184 |
+ return get_sock_port(sock, 1); |
185 |
+ } |
186 |
++ |
187 |
++/* |
188 |
++ * Returns the remote DNS hostname as a string. The returned string must not |
189 |
++ * be freed. NB. this will usually trigger a DNS query the first time it is |
190 |
++ * called. |
191 |
++ * This function does additional checks on the hostname to mitigate some |
192 |
++ * attacks on legacy rhosts-style authentication. |
193 |
++ * XXX is RhostsRSAAuthentication vulnerable to these? |
194 |
++ * XXX Can we remove these checks? (or if not, remove RhostsRSAAuthentication?) |
195 |
++ */ |
196 |
++ |
197 |
++static char * |
198 |
++remote_hostname(struct ssh *ssh) |
199 |
++{ |
200 |
++ struct sockaddr_storage from; |
201 |
++ socklen_t fromlen; |
202 |
++ struct addrinfo hints, *ai, *aitop; |
203 |
++ char name[NI_MAXHOST], ntop2[NI_MAXHOST]; |
204 |
++ const char *ntop = ssh_remote_ipaddr(ssh); |
205 |
++ |
206 |
++ /* Get IP address of client. */ |
207 |
++ fromlen = sizeof(from); |
208 |
++ memset(&from, 0, sizeof(from)); |
209 |
++ if (getpeername(ssh_packet_get_connection_in(ssh), |
210 |
++ (struct sockaddr *)&from, &fromlen) < 0) { |
211 |
++ debug("getpeername failed: %.100s", strerror(errno)); |
212 |
++ return strdup(ntop); |
213 |
++ } |
214 |
++ |
215 |
++ ipv64_normalise_mapped(&from, &fromlen); |
216 |
++ if (from.ss_family == AF_INET6) |
217 |
++ fromlen = sizeof(struct sockaddr_in6); |
218 |
++ |
219 |
++ debug3("Trying to reverse map address %.100s.", ntop); |
220 |
++ /* Map the IP address to a host name. */ |
221 |
++ if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), |
222 |
++ NULL, 0, NI_NAMEREQD) != 0) { |
223 |
++ /* Host name not found. Use ip address. */ |
224 |
++ return strdup(ntop); |
225 |
++ } |
226 |
++ |
227 |
++ /* |
228 |
++ * if reverse lookup result looks like a numeric hostname, |
229 |
++ * someone is trying to trick us by PTR record like following: |
230 |
++ * 1.1.1.10.in-addr.arpa. IN PTR 2.3.4.5 |
231 |
++ */ |
232 |
++ memset(&hints, 0, sizeof(hints)); |
233 |
++ hints.ai_socktype = SOCK_DGRAM; /*dummy*/ |
234 |
++ hints.ai_flags = AI_NUMERICHOST; |
235 |
++ if (getaddrinfo(name, NULL, &hints, &ai) == 0) { |
236 |
++ logit("Nasty PTR record \"%s\" is set up for %s, ignoring", |
237 |
++ name, ntop); |
238 |
++ freeaddrinfo(ai); |
239 |
++ return strdup(ntop); |
240 |
++ } |
241 |
++ |
242 |
++ /* Names are stored in lowercase. */ |
243 |
++ lowercase(name); |
244 |
++ |
245 |
++ /* |
246 |
++ * Map it back to an IP address and check that the given |
247 |
++ * address actually is an address of this host. This is |
248 |
++ * necessary because anyone with access to a name server can |
249 |
++ * define arbitrary names for an IP address. Mapping from |
250 |
++ * name to IP address can be trusted better (but can still be |
251 |
++ * fooled if the intruder has access to the name server of |
252 |
++ * the domain). |
253 |
++ */ |
254 |
++ memset(&hints, 0, sizeof(hints)); |
255 |
++ hints.ai_family = from.ss_family; |
256 |
++ hints.ai_socktype = SOCK_STREAM; |
257 |
++ if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { |
258 |
++ logit("reverse mapping checking getaddrinfo for %.700s " |
259 |
++ "[%s] failed.", name, ntop); |
260 |
++ return strdup(ntop); |
261 |
++ } |
262 |
++ /* Look for the address from the list of addresses. */ |
263 |
++ for (ai = aitop; ai; ai = ai->ai_next) { |
264 |
++ if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, |
265 |
++ sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 && |
266 |
++ (strcmp(ntop, ntop2) == 0)) |
267 |
++ break; |
268 |
++ } |
269 |
++ freeaddrinfo(aitop); |
270 |
++ /* If we reached the end of the list, the address was not there. */ |
271 |
++ if (ai == NULL) { |
272 |
++ /* Address not found for the host name. */ |
273 |
++ logit("Address %.100s maps to %.600s, but this does not " |
274 |
++ "map back to the address.", ntop, name); |
275 |
++ return strdup(ntop); |
276 |
++ } |
277 |
++ return strdup(name); |
278 |
++} |
279 |
++ |
280 |
++/* |
281 |
++ * Return the canonical name of the host in the other side of the current |
282 |
++ * connection. The host name is cached, so it is efficient to call this |
283 |
++ * several times. |
284 |
++ */ |
285 |
++ |
286 |
++const char * |
287 |
++auth_get_canonical_hostname(struct ssh *ssh, int use_dns) |
288 |
++{ |
289 |
++ static char *dnsname; |
290 |
++ |
291 |
++ if (!use_dns) |
292 |
++ return ssh_remote_ipaddr(ssh); |
293 |
++ else if (dnsname != NULL) |
294 |
++ return dnsname; |
295 |
++ else { |
296 |
++ dnsname = remote_hostname(ssh); |
297 |
++ return dnsname; |
298 |
++ } |
299 |
++} |
300 |
+diff --git a/readconf.c b/readconf.c |
301 |
+index 71a5c795..2a8c6990 100644 |
302 |
+--- a/readconf.c |
303 |
++++ b/readconf.c |
304 |
+@@ -163,6 +163,7 @@ typedef enum { |
305 |
+ oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
306 |
+ oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
307 |
+ oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
308 |
++ oGssTrustDns, |
309 |
+ oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
310 |
+ oSendEnv, oSetEnv, oControlPath, oControlMaster, oControlPersist, |
311 |
+ oHashKnownHosts, |
312 |
+@@ -204,9 +205,11 @@ static struct { |
313 |
+ #if defined(GSSAPI) |
314 |
+ { "gssapiauthentication", oGssAuthentication }, |
315 |
+ { "gssapidelegatecredentials", oGssDelegateCreds }, |
316 |
++ { "gssapitrustdns", oGssTrustDns }, |
317 |
+ # else |
318 |
+ { "gssapiauthentication", oUnsupported }, |
319 |
+ { "gssapidelegatecredentials", oUnsupported }, |
320 |
++ { "gssapitrustdns", oUnsupported }, |
321 |
+ #endif |
322 |
+ #ifdef ENABLE_PKCS11 |
323 |
+ { "pkcs11provider", oPKCS11Provider }, |
324 |
+@@ -993,6 +996,10 @@ parse_time: |
325 |
+ intptr = &options->gss_deleg_creds; |
326 |
+ goto parse_flag; |
327 |
+ |
328 |
++ case oGssTrustDns: |
329 |
++ intptr = &options->gss_trust_dns; |
330 |
++ goto parse_flag; |
331 |
++ |
332 |
+ case oBatchMode: |
333 |
+ intptr = &options->batch_mode; |
334 |
+ goto parse_flag; |
335 |
+@@ -1875,6 +1882,7 @@ initialize_options(Options * options) |
336 |
+ options->challenge_response_authentication = -1; |
337 |
+ options->gss_authentication = -1; |
338 |
+ options->gss_deleg_creds = -1; |
339 |
++ options->gss_trust_dns = -1; |
340 |
+ options->password_authentication = -1; |
341 |
+ options->kbd_interactive_authentication = -1; |
342 |
+ options->kbd_interactive_devices = NULL; |
343 |
+@@ -2023,6 +2031,8 @@ fill_default_options(Options * options) |
344 |
+ options->gss_authentication = 0; |
345 |
+ if (options->gss_deleg_creds == -1) |
346 |
+ options->gss_deleg_creds = 0; |
347 |
++ if (options->gss_trust_dns == -1) |
348 |
++ options->gss_trust_dns = 0; |
349 |
+ if (options->password_authentication == -1) |
350 |
+ options->password_authentication = 1; |
351 |
+ if (options->kbd_interactive_authentication == -1) |
352 |
+diff --git a/readconf.h b/readconf.h |
353 |
+index 69c24700..2758b633 100644 |
354 |
+--- a/readconf.h |
355 |
++++ b/readconf.h |
356 |
+@@ -45,6 +45,7 @@ typedef struct { |
357 |
+ /* Try S/Key or TIS, authentication. */ |
358 |
+ int gss_authentication; /* Try GSS authentication */ |
359 |
+ int gss_deleg_creds; /* Delegate GSS credentials */ |
360 |
++ int gss_trust_dns; /* Trust DNS for GSS canonicalization */ |
361 |
+ int password_authentication; /* Try password |
362 |
+ * authentication. */ |
363 |
+ int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ |
364 |
+diff --git a/ssh_config.5 b/ssh_config.5 |
365 |
+index b7566782..64897e4e 100644 |
366 |
+--- a/ssh_config.5 |
367 |
++++ b/ssh_config.5 |
368 |
+@@ -758,6 +758,16 @@ The default is |
369 |
+ Forward (delegate) credentials to the server. |
370 |
+ The default is |
371 |
+ .Cm no . |
372 |
++Note that this option applies to protocol version 2 connections using GSSAPI. |
373 |
++.It Cm GSSAPITrustDns |
374 |
++Set to |
375 |
++.Dq yes to indicate that the DNS is trusted to securely canonicalize |
376 |
++the name of the host being connected to. If |
377 |
++.Dq no, the hostname entered on the |
378 |
++command line will be passed untouched to the GSSAPI library. |
379 |
++The default is |
380 |
++.Dq no . |
381 |
++This option only applies to protocol version 2 connections using GSSAPI. |
382 |
+ .It Cm HashKnownHosts |
383 |
+ Indicates that |
384 |
+ .Xr ssh 1 |
385 |
+diff --git a/sshconnect2.c b/sshconnect2.c |
386 |
+index dffee90b..a25a32b9 100644 |
387 |
+--- a/sshconnect2.c |
388 |
++++ b/sshconnect2.c |
389 |
+@@ -698,6 +698,13 @@ userauth_gssapi(struct ssh *ssh) |
390 |
+ OM_uint32 min; |
391 |
+ int r, ok = 0; |
392 |
+ gss_OID mech = NULL; |
393 |
++ const char *gss_host; |
394 |
++ |
395 |
++ if (options.gss_trust_dns) { |
396 |
++ extern const char *auth_get_canonical_hostname(struct ssh *ssh, int use_dns); |
397 |
++ gss_host = auth_get_canonical_hostname(active_state, 1); |
398 |
++ } else |
399 |
++ gss_host = authctxt->host; |
400 |
+ |
401 |
+ /* Try one GSSAPI method at a time, rather than sending them all at |
402 |
+ * once. */ |
403 |
+@@ -712,7 +719,7 @@ userauth_gssapi(struct ssh *ssh) |
404 |
+ elements[authctxt->mech_tried]; |
405 |
+ /* My DER encoding requires length<128 */ |
406 |
+ if (mech->length < 128 && ssh_gssapi_check_mechanism(&gssctxt, |
407 |
+- mech, authctxt->host)) { |
408 |
++ mech, gss_host)) { |
409 |
+ ok = 1; /* Mechanism works */ |
410 |
+ } else { |
411 |
+ authctxt->mech_tried++; |
412 |
|
413 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-X509-12.0-tests.patch b/net-misc/openssh/files/openssh-8.0_p1-X509-12.0-tests.patch |
414 |
new file mode 100644 |
415 |
index 00000000000..9766b1594ea |
416 |
--- /dev/null |
417 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-X509-12.0-tests.patch |
418 |
@@ -0,0 +1,12 @@ |
419 |
+diff -ur openssh-7.9p1.orig/openbsd-compat/regress/Makefile.in openssh-7.9p1/openbsd-compat/regress/Makefile.in |
420 |
+--- openssh-7.9p1.orig/openbsd-compat/regress/Makefile.in 2018-10-16 17:01:20.000000000 -0700 |
421 |
++++ openssh-7.9p1/openbsd-compat/regress/Makefile.in 2018-12-19 11:03:14.421028691 -0800 |
422 |
+@@ -7,7 +7,7 @@ |
423 |
+ CC=@CC@ |
424 |
+ LD=@LD@ |
425 |
+ CFLAGS=@CFLAGS@ |
426 |
+-CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ |
427 |
++CPPFLAGS=-I. -I.. -I$(srcdir) -I../.. @CPPFLAGS@ @DEFS@ |
428 |
+ EXEEXT=@EXEEXT@ |
429 |
+ LIBCOMPAT=../libopenbsd-compat.a |
430 |
+ LIBS=@LIBS@ |
431 |
|
432 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-X509-dont-make-piddir-12.0.patch b/net-misc/openssh/files/openssh-8.0_p1-X509-dont-make-piddir-12.0.patch |
433 |
new file mode 100644 |
434 |
index 00000000000..aac98fef35d |
435 |
--- /dev/null |
436 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-X509-dont-make-piddir-12.0.patch |
437 |
@@ -0,0 +1,16 @@ |
438 |
+--- a/openssh-8.0p1+x509-12.0.diff 2019-04-18 14:53:26.850768799 -0700 |
439 |
++++ b/openssh-8.0p1+x509-12.0.diff 2019-04-18 14:56:48.870364519 -0700 |
440 |
+@@ -33578,12 +33578,11 @@ |
441 |
+ |
442 |
+ install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config |
443 |
+ install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf |
444 |
+-@@ -334,6 +352,8 @@ |
445 |
++@@ -334,6 +352,7 @@ |
446 |
+ $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5 |
447 |
+ $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8 |
448 |
+ $(MKDIR_P) $(DESTDIR)$(libexecdir) |
449 |
+ + $(MKDIR_P) $(DESTDIR)$(sshcadir) |
450 |
+-+ $(MKDIR_P) $(DESTDIR)$(piddir) |
451 |
+ $(MKDIR_P) -m 0755 $(DESTDIR)$(PRIVSEP_PATH) |
452 |
+ $(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT) |
453 |
+ $(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT) |
454 |
|
455 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-X509-glue-12.0.patch b/net-misc/openssh/files/openssh-8.0_p1-X509-glue-12.0.patch |
456 |
new file mode 100644 |
457 |
index 00000000000..1667e13850c |
458 |
--- /dev/null |
459 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-X509-glue-12.0.patch |
460 |
@@ -0,0 +1,19 @@ |
461 |
+--- a/openssh-8.0p1+x509-12.0.diff 2019-04-18 14:53:02.804935946 -0700 |
462 |
++++ b/openssh-8.0p1+x509-12.0.diff 2019-04-18 14:53:26.850768799 -0700 |
463 |
+@@ -75925,16 +75925,6 @@ |
464 |
+ + return mbtowc(NULL, s, n); |
465 |
+ +} |
466 |
+ +#endif |
467 |
+-diff -ruN openssh-8.0p1/version.h openssh-8.0p1+x509-12.0/version.h |
468 |
+---- openssh-8.0p1/version.h 2019-04-18 01:52:57.000000000 +0300 |
469 |
+-+++ openssh-8.0p1+x509-12.0/version.h 2019-04-18 19:07:00.000000000 +0300 |
470 |
+-@@ -2,5 +2,4 @@ |
471 |
+- |
472 |
+- #define SSH_VERSION "OpenSSH_8.0" |
473 |
+- |
474 |
+--#define SSH_PORTABLE "p1" |
475 |
+--#define SSH_RELEASE SSH_VERSION SSH_PORTABLE |
476 |
+-+#define SSH_RELEASE PACKAGE_STRING ", " SSH_VERSION "p1" |
477 |
+ diff -ruN openssh-8.0p1/version.m4 openssh-8.0p1+x509-12.0/version.m4 |
478 |
+ --- openssh-8.0p1/version.m4 1970-01-01 02:00:00.000000000 +0200 |
479 |
+ +++ openssh-8.0p1+x509-12.0/version.m4 2019-04-18 19:07:00.000000000 +0300 |
480 |
|
481 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-hpn-X509-glue.patch b/net-misc/openssh/files/openssh-8.0_p1-hpn-X509-glue.patch |
482 |
new file mode 100644 |
483 |
index 00000000000..2a9d3bd2f33 |
484 |
--- /dev/null |
485 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-hpn-X509-glue.patch |
486 |
@@ -0,0 +1,114 @@ |
487 |
+--- a/openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff 2019-04-18 17:07:59.413376785 -0700 |
488 |
++++ b/openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff 2019-04-18 20:05:12.622588051 -0700 |
489 |
+@@ -382,7 +382,7 @@ |
490 |
+ @@ -822,6 +822,10 @@ kex_choose_conf(struct ssh *ssh) |
491 |
+ int nenc, nmac, ncomp; |
492 |
+ u_int mode, ctos, need, dh_need, authlen; |
493 |
+- int r, first_kex_follows; |
494 |
++ int r, first_kex_follows = 0; |
495 |
+ + int auth_flag; |
496 |
+ + |
497 |
+ + auth_flag = packet_authentication_state(ssh); |
498 |
+@@ -441,6 +441,39 @@ |
499 |
+ int ssh_packet_get_state(struct ssh *, struct sshbuf *); |
500 |
+ int ssh_packet_set_state(struct ssh *, struct sshbuf *); |
501 |
+ |
502 |
++diff --git a/packet.c b/packet.c |
503 |
++index dcf35e6..9433f08 100644 |
504 |
++--- a/packet.c |
505 |
+++++ b/packet.c |
506 |
++@@ -920,6 +920,14 @@ ssh_set_newkeys(struct ssh *ssh, int mode) |
507 |
++ return 0; |
508 |
++ } |
509 |
++ |
510 |
+++/* this supports the forced rekeying required for the NONE cipher */ |
511 |
+++int rekey_requested = 0; |
512 |
+++void |
513 |
+++packet_request_rekeying(void) |
514 |
+++{ |
515 |
+++ rekey_requested = 1; |
516 |
+++} |
517 |
+++ |
518 |
++ #define MAX_PACKETS (1U<<31) |
519 |
++ static int |
520 |
++ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len) |
521 |
++@@ -946,6 +954,13 @@ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len) |
522 |
++ if (state->p_send.packets == 0 && state->p_read.packets == 0) |
523 |
++ return 0; |
524 |
++ |
525 |
+++ /* used to force rekeying when called for by the none |
526 |
+++ * cipher switch and aes-mt-ctr methods -cjr */ |
527 |
+++ if (rekey_requested == 1) { |
528 |
+++ rekey_requested = 0; |
529 |
+++ return 1; |
530 |
+++ } |
531 |
+++ |
532 |
++ /* Time-based rekeying */ |
533 |
++ if (state->rekey_interval != 0 && |
534 |
++ (int64_t)state->rekey_time + state->rekey_interval <= monotime()) |
535 |
+ diff --git a/readconf.c b/readconf.c |
536 |
+ index db5f2d5..33f18c9 100644 |
537 |
+ --- a/readconf.c |
538 |
+@@ -453,10 +486,9 @@ |
539 |
+ |
540 |
+ /* Format of the configuration file: |
541 |
+ |
542 |
+-@@ -166,6 +167,8 @@ typedef enum { |
543 |
++@@ -166,5 +167,7 @@ typedef enum { |
544 |
+ oTunnel, oTunnelDevice, |
545 |
+ oLocalCommand, oPermitLocalCommand, oRemoteCommand, |
546 |
+- oDisableMTAES, |
547 |
+ + oTcpRcvBufPoll, oTcpRcvBuf, oHPNDisabled, oHPNBufferSize, |
548 |
+ + oNoneEnabled, oNoneSwitch, |
549 |
+ oVisualHostKey, |
550 |
+@@ -592,10 +624,9 @@ |
551 |
+ int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */ |
552 |
+ int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */ |
553 |
+ SyslogFacility log_facility; /* Facility for system logging. */ |
554 |
+-@@ -111,7 +115,10 @@ typedef struct { |
555 |
++@@ -111,6 +115,9 @@ typedef struct { |
556 |
+ int enable_ssh_keysign; |
557 |
+ int64_t rekey_limit; |
558 |
+- int disable_multithreaded; /*disable multithreaded aes-ctr*/ |
559 |
+ + int none_switch; /* Use none cipher */ |
560 |
+ + int none_enabled; /* Allow none to be used */ |
561 |
+ int rekey_interval; |
562 |
+@@ -650,10 +681,8 @@ |
563 |
+ |
564 |
+ /* Portable-specific options */ |
565 |
+ if (options->use_pam == -1) |
566 |
+-@@ -391,6 +400,43 @@ fill_default_server_options(ServerOptions *options) |
567 |
++@@ -391,4 +400,41 @@ fill_default_server_options(ServerOptions *options) |
568 |
+ options->permit_tun = SSH_TUNMODE_NO; |
569 |
+- if (options->disable_multithreaded == -1) |
570 |
+- options->disable_multithreaded = 0; |
571 |
+ + if (options->none_enabled == -1) |
572 |
+ + options->none_enabled = 0; |
573 |
+ + if (options->hpn_disabled == -1) |
574 |
+@@ -1095,9 +1124,9 @@ |
575 |
+ + fprintf(stderr, "NONE cipher switch disabled when a TTY is allocated\n"); |
576 |
+ + } |
577 |
+ + } |
578 |
++ debug("Authentication succeeded (%s).", authctxt.method->name); |
579 |
++ } |
580 |
+ |
581 |
+- #ifdef WITH_OPENSSL |
582 |
+- if (options.disable_multithreaded == 0) { |
583 |
+ diff --git a/sshd.c b/sshd.c |
584 |
+ index a738c3a..b32dbe0 100644 |
585 |
+ --- a/sshd.c |
586 |
+@@ -1181,14 +1210,3 @@ |
587 |
+ # Example of overriding settings on a per-user basis |
588 |
+ #Match User anoncvs |
589 |
+ # X11Forwarding no |
590 |
+-diff --git a/version.h b/version.h |
591 |
+-index f1bbf00..21a70c2 100644 |
592 |
+---- a/version.h |
593 |
+-+++ b/version.h |
594 |
+-@@ -3,4 +3,5 @@ |
595 |
+- #define SSH_VERSION "OpenSSH_7.8" |
596 |
+- |
597 |
+- #define SSH_PORTABLE "p1" |
598 |
+--#define SSH_RELEASE SSH_VERSION SSH_PORTABLE |
599 |
+-+#define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN |
600 |
+-+ |
601 |
|
602 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-hpn-glue.patch b/net-misc/openssh/files/openssh-8.0_p1-hpn-glue.patch |
603 |
new file mode 100644 |
604 |
index 00000000000..adbfa87af68 |
605 |
--- /dev/null |
606 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-hpn-glue.patch |
607 |
@@ -0,0 +1,194 @@ |
608 |
+diff -ur --exclude '.*.un*' a/openssh-7_8_P1-hpn-AES-CTR-14.16.diff b/openssh-7_8_P1-hpn-AES-CTR-14.16.diff |
609 |
+--- a/openssh-7_8_P1-hpn-AES-CTR-14.16.diff 2019-04-18 15:07:06.748067368 -0700 |
610 |
++++ b/openssh-7_8_P1-hpn-AES-CTR-14.16.diff 2019-04-18 19:42:26.689298696 -0700 |
611 |
+@@ -998,7 +998,7 @@ |
612 |
+ + * so we repoint the define to the multithreaded evp. To start the threads we |
613 |
+ + * then force a rekey |
614 |
+ + */ |
615 |
+-+ const void *cc = ssh_packet_get_send_context(active_state); |
616 |
+++ const void *cc = ssh_packet_get_send_context(ssh); |
617 |
+ + |
618 |
+ + /* only do this for the ctr cipher. otherwise gcm mode breaks. Don't know why though */ |
619 |
+ + if (strstr(cipher_ctx_name(cc), "ctr")) { |
620 |
+@@ -1028,7 +1028,7 @@ |
621 |
+ + * so we repoint the define to the multithreaded evp. To start the threads we |
622 |
+ + * then force a rekey |
623 |
+ + */ |
624 |
+-+ const void *cc = ssh_packet_get_send_context(active_state); |
625 |
+++ const void *cc = ssh_packet_get_send_context(ssh); |
626 |
+ + |
627 |
+ + /* only rekey if necessary. If we don't do this gcm mode cipher breaks */ |
628 |
+ + if (strstr(cipher_ctx_name(cc), "ctr")) { |
629 |
+diff -ur --exclude '.*.un*' a/openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff b/openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff |
630 |
+--- a/openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff 2019-04-18 15:07:11.289035776 -0700 |
631 |
++++ b/openssh-7_8_P1-hpn-DynWinNoneSwitch-14.16.diff 2019-04-18 17:07:59.413376785 -0700 |
632 |
+@@ -162,24 +162,24 @@ |
633 |
+ } |
634 |
+ |
635 |
+ +static int |
636 |
+-+channel_tcpwinsz(void) |
637 |
+++channel_tcpwinsz(struct ssh *ssh) |
638 |
+ +{ |
639 |
+ + u_int32_t tcpwinsz = 0; |
640 |
+ + socklen_t optsz = sizeof(tcpwinsz); |
641 |
+ + int ret = -1; |
642 |
+ + |
643 |
+ + /* if we aren't on a socket return 128KB */ |
644 |
+-+ if (!packet_connection_is_on_socket()) |
645 |
+++ if (!ssh_packet_connection_is_on_socket(ssh)) |
646 |
+ + return 128 * 1024; |
647 |
+ + |
648 |
+-+ ret = getsockopt(packet_get_connection_in(), |
649 |
+++ ret = getsockopt(ssh_packet_get_connection_in(ssh), |
650 |
+ + SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz); |
651 |
+ + /* return no more than SSHBUF_SIZE_MAX (currently 256MB) */ |
652 |
+ + if ((ret == 0) && tcpwinsz > SSHBUF_SIZE_MAX) |
653 |
+ + tcpwinsz = SSHBUF_SIZE_MAX; |
654 |
+ + |
655 |
+ + debug2("tcpwinsz: tcp connection %d, Receive window: %d", |
656 |
+-+ packet_get_connection_in(), tcpwinsz); |
657 |
+++ ssh_packet_get_connection_in(ssh), tcpwinsz); |
658 |
+ + return tcpwinsz; |
659 |
+ +} |
660 |
+ + |
661 |
+@@ -191,7 +191,7 @@ |
662 |
+ c->local_window < c->local_window_max/2) && |
663 |
+ c->local_consumed > 0) { |
664 |
+ + u_int addition = 0; |
665 |
+-+ u_int32_t tcpwinsz = channel_tcpwinsz(); |
666 |
+++ u_int32_t tcpwinsz = channel_tcpwinsz(ssh); |
667 |
+ + /* adjust max window size if we are in a dynamic environment */ |
668 |
+ + if (c->dynamic_window && (tcpwinsz > c->local_window_max)) { |
669 |
+ + /* grow the window somewhat aggressively to maintain pressure */ |
670 |
+@@ -409,18 +409,10 @@ |
671 |
+ index dcf35e6..da4ced0 100644 |
672 |
+ --- a/packet.c |
673 |
+ +++ b/packet.c |
674 |
+-@@ -920,6 +920,24 @@ ssh_set_newkeys(struct ssh *ssh, int mode) |
675 |
++@@ -920,6 +920,16 @@ ssh_set_newkeys(struct ssh *ssh, int mode) |
676 |
+ return 0; |
677 |
+ } |
678 |
+ |
679 |
+-+/* this supports the forced rekeying required for the NONE cipher */ |
680 |
+-+int rekey_requested = 0; |
681 |
+-+void |
682 |
+-+packet_request_rekeying(void) |
683 |
+-+{ |
684 |
+-+ rekey_requested = 1; |
685 |
+-+} |
686 |
+-+ |
687 |
+ +/* used to determine if pre or post auth when rekeying for aes-ctr |
688 |
+ + * and none cipher switch */ |
689 |
+ +int |
690 |
+@@ -434,20 +426,6 @@ |
691 |
+ #define MAX_PACKETS (1U<<31) |
692 |
+ static int |
693 |
+ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len) |
694 |
+-@@ -946,6 +964,13 @@ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len) |
695 |
+- if (state->p_send.packets == 0 && state->p_read.packets == 0) |
696 |
+- return 0; |
697 |
+- |
698 |
+-+ /* used to force rekeying when called for by the none |
699 |
+-+ * cipher switch methods -cjr */ |
700 |
+-+ if (rekey_requested == 1) { |
701 |
+-+ rekey_requested = 0; |
702 |
+-+ return 1; |
703 |
+-+ } |
704 |
+-+ |
705 |
+- /* Time-based rekeying */ |
706 |
+- if (state->rekey_interval != 0 && |
707 |
+- (int64_t)state->rekey_time + state->rekey_interval <= monotime()) |
708 |
+ diff --git a/packet.h b/packet.h |
709 |
+ index 170203c..f4d9df2 100644 |
710 |
+ --- a/packet.h |
711 |
+@@ -476,9 +454,9 @@ |
712 |
+ /* Format of the configuration file: |
713 |
+ |
714 |
+ @@ -166,6 +167,8 @@ typedef enum { |
715 |
+- oHashKnownHosts, |
716 |
+ oTunnel, oTunnelDevice, |
717 |
+ oLocalCommand, oPermitLocalCommand, oRemoteCommand, |
718 |
++ oDisableMTAES, |
719 |
+ + oTcpRcvBufPoll, oTcpRcvBuf, oHPNDisabled, oHPNBufferSize, |
720 |
+ + oNoneEnabled, oNoneSwitch, |
721 |
+ oVisualHostKey, |
722 |
+@@ -615,9 +593,9 @@ |
723 |
+ int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */ |
724 |
+ SyslogFacility log_facility; /* Facility for system logging. */ |
725 |
+ @@ -111,7 +115,10 @@ typedef struct { |
726 |
+- |
727 |
+ int enable_ssh_keysign; |
728 |
+ int64_t rekey_limit; |
729 |
++ int disable_multithreaded; /*disable multithreaded aes-ctr*/ |
730 |
+ + int none_switch; /* Use none cipher */ |
731 |
+ + int none_enabled; /* Allow none to be used */ |
732 |
+ int rekey_interval; |
733 |
+@@ -673,9 +651,9 @@ |
734 |
+ /* Portable-specific options */ |
735 |
+ if (options->use_pam == -1) |
736 |
+ @@ -391,6 +400,43 @@ fill_default_server_options(ServerOptions *options) |
737 |
+- } |
738 |
+- if (options->permit_tun == -1) |
739 |
+ options->permit_tun = SSH_TUNMODE_NO; |
740 |
++ if (options->disable_multithreaded == -1) |
741 |
++ options->disable_multithreaded = 0; |
742 |
+ + if (options->none_enabled == -1) |
743 |
+ + options->none_enabled = 0; |
744 |
+ + if (options->hpn_disabled == -1) |
745 |
+@@ -1092,7 +1070,7 @@ |
746 |
+ xxx_host = host; |
747 |
+ xxx_hostaddr = hostaddr; |
748 |
+ |
749 |
+-@@ -412,6 +423,28 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, |
750 |
++@@ -412,6 +423,27 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, |
751 |
+ |
752 |
+ if (!authctxt.success) |
753 |
+ fatal("Authentication failed."); |
754 |
+@@ -1108,7 +1086,7 @@ |
755 |
+ + memcpy(&myproposal, &myproposal_default, sizeof(myproposal)); |
756 |
+ + myproposal[PROPOSAL_ENC_ALGS_STOC] = "none"; |
757 |
+ + myproposal[PROPOSAL_ENC_ALGS_CTOS] = "none"; |
758 |
+-+ kex_prop2buf(active_state->kex->my, myproposal); |
759 |
+++ kex_prop2buf(ssh->kex->my, myproposal); |
760 |
+ + packet_request_rekeying(); |
761 |
+ + fprintf(stderr, "WARNING: ENABLED NONE CIPHER\n"); |
762 |
+ + } else { |
763 |
+@@ -1117,23 +1095,13 @@ |
764 |
+ + fprintf(stderr, "NONE cipher switch disabled when a TTY is allocated\n"); |
765 |
+ + } |
766 |
+ + } |
767 |
+-+ |
768 |
+- debug("Authentication succeeded (%s).", authctxt.method->name); |
769 |
+- } |
770 |
+ |
771 |
++ #ifdef WITH_OPENSSL |
772 |
++ if (options.disable_multithreaded == 0) { |
773 |
+ diff --git a/sshd.c b/sshd.c |
774 |
+ index a738c3a..b32dbe0 100644 |
775 |
+ --- a/sshd.c |
776 |
+ +++ b/sshd.c |
777 |
+-@@ -373,7 +373,7 @@ sshd_exchange_identification(struct ssh *ssh, int sock_in, int sock_out) |
778 |
+- char remote_version[256]; /* Must be at least as big as buf. */ |
779 |
+- |
780 |
+- xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s\r\n", |
781 |
+-- PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION, |
782 |
+-+ PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE, |
783 |
+- *options.version_addendum == '\0' ? "" : " ", |
784 |
+- options.version_addendum); |
785 |
+- |
786 |
+ @@ -1037,6 +1037,8 @@ listen_on_addrs(struct listenaddr *la) |
787 |
+ int ret, listen_sock; |
788 |
+ struct addrinfo *ai; |
789 |
+@@ -1217,11 +1185,10 @@ |
790 |
+ index f1bbf00..21a70c2 100644 |
791 |
+ --- a/version.h |
792 |
+ +++ b/version.h |
793 |
+-@@ -3,4 +3,6 @@ |
794 |
++@@ -3,4 +3,5 @@ |
795 |
+ #define SSH_VERSION "OpenSSH_7.8" |
796 |
+ |
797 |
+ #define SSH_PORTABLE "p1" |
798 |
+ -#define SSH_RELEASE SSH_VERSION SSH_PORTABLE |
799 |
+-+#define SSH_HPN "-hpn14v16" |
800 |
+ +#define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN |
801 |
+ + |
802 |
|
803 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-hpn-version.patch b/net-misc/openssh/files/openssh-8.0_p1-hpn-version.patch |
804 |
new file mode 100644 |
805 |
index 00000000000..37905ce6afc |
806 |
--- /dev/null |
807 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-hpn-version.patch |
808 |
@@ -0,0 +1,13 @@ |
809 |
+diff --git a/kex.c b/kex.c |
810 |
+index 34808b5c..88d7ccac 100644 |
811 |
+--- a/kex.c |
812 |
++++ b/kex.c |
813 |
+@@ -1126,7 +1126,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, |
814 |
+ if (version_addendum != NULL && *version_addendum == '\0') |
815 |
+ version_addendum = NULL; |
816 |
+ if ((r = sshbuf_putf(our_version, "SSH-%d.%d-%.100s%s%s\r\n", |
817 |
+- PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION, |
818 |
++ PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE, |
819 |
+ version_addendum == NULL ? "" : " ", |
820 |
+ version_addendum == NULL ? "" : version_addendum)) != 0) { |
821 |
+ error("%s: sshbuf_putf: %s", __func__, ssh_err(r)); |
822 |
|
823 |
diff --git a/net-misc/openssh/files/openssh-8.0_p1-tests.patch b/net-misc/openssh/files/openssh-8.0_p1-tests.patch |
824 |
new file mode 100644 |
825 |
index 00000000000..6b2ae489d0e |
826 |
--- /dev/null |
827 |
+++ b/net-misc/openssh/files/openssh-8.0_p1-tests.patch |
828 |
@@ -0,0 +1,43 @@ |
829 |
+diff --git a/openbsd-compat/regress/utimensattest.c b/openbsd-compat/regress/utimensattest.c |
830 |
+index a7bc7634..46f79db2 100644 |
831 |
+--- a/openbsd-compat/regress/utimensattest.c |
832 |
++++ b/openbsd-compat/regress/utimensattest.c |
833 |
+@@ -23,6 +23,7 @@ |
834 |
+ #include <stdlib.h> |
835 |
+ #include <string.h> |
836 |
+ #include <unistd.h> |
837 |
++#include <time.h> |
838 |
+ |
839 |
+ #define TMPFILE "utimensat.tmp" |
840 |
+ #define TMPFILE2 "utimensat.tmp2" |
841 |
+@@ -88,8 +89,30 @@ main(void) |
842 |
+ if (symlink(TMPFILE2, TMPFILE) == -1) |
843 |
+ fail("symlink", 0, 0); |
844 |
+ |
845 |
++#ifdef __linux__ |
846 |
++ /* |
847 |
++ * The semantics of the original test are wrong on Linux |
848 |
++ * From the man page for utimensat(): |
849 |
++ * AT_SYMLINK_NOFOLLOW |
850 |
++ * If pathname specifies a symbolic link, then update the |
851 |
++ * timestamps of the link, rather than the file to which it refers. |
852 |
++ * |
853 |
++ * So the call will succeed, and update the times on the symlink. |
854 |
++ */ |
855 |
++ if (utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW) != -1) { |
856 |
++ if (fstatat(AT_FDCWD, TMPFILE, &sb, 0) == -1) |
857 |
++ fail("could not follow and stat symlink", 0, 0); |
858 |
++ |
859 |
++ if (sb.st_atim.tv_sec == ts[0].tv_sec |
860 |
++ && sb.st_atim.tv_nsec == ts[0].tv_nsec |
861 |
++ && sb.st_mtim.tv_nsec == ts[1].tv_sec |
862 |
++ && sb.st_mtim.tv_nsec == ts[1].tv_nsec) |
863 |
++ fail("utimensat followed symlink", 0, 0); |
864 |
++ } |
865 |
++#else /* __linux__ */ |
866 |
+ if (utimensat(AT_FDCWD, TMPFILE, ts, AT_SYMLINK_NOFOLLOW) != -1) |
867 |
+ fail("utimensat followed symlink", 0, 0); |
868 |
++#endif /* __linux__ */ |
869 |
+ |
870 |
+ if (!(unlink(TMPFILE) == 0 && unlink(TMPFILE2) == 0)) |
871 |
+ fail("unlink", 0, 0); |
872 |
|
873 |
diff --git a/net-misc/openssh/openssh-8.0_p1.ebuild b/net-misc/openssh/openssh-8.0_p1.ebuild |
874 |
new file mode 100644 |
875 |
index 00000000000..20540fe239f |
876 |
--- /dev/null |
877 |
+++ b/net-misc/openssh/openssh-8.0_p1.ebuild |
878 |
@@ -0,0 +1,461 @@ |
879 |
+# Copyright 1999-2019 Gentoo Authors |
880 |
+# Distributed under the terms of the GNU General Public License v2 |
881 |
+ |
882 |
+EAPI=6 |
883 |
+ |
884 |
+inherit user flag-o-matic multilib autotools pam systemd |
885 |
+ |
886 |
+# Make it more portable between straight releases |
887 |
+# and _p? releases. |
888 |
+PARCH=${P/_} |
889 |
+#HPN_PV="${PV^^}" |
890 |
+HPN_PV="7.8_P1" |
891 |
+ |
892 |
+HPN_VER="14.16" |
893 |
+HPN_PATCHES=( |
894 |
+ ${PN}-${HPN_PV/./_}-hpn-DynWinNoneSwitch-${HPN_VER}.diff |
895 |
+ ${PN}-${HPN_PV/./_}-hpn-AES-CTR-${HPN_VER}.diff |
896 |
+) |
897 |
+ |
898 |
+SCTP_VER="1.2" SCTP_PATCH="${PARCH}-sctp-${SCTP_VER}.patch.xz" |
899 |
+X509_VER="12.0" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz" |
900 |
+ |
901 |
+PATCH_SET="openssh-7.9p1-patches-1.0" |
902 |
+ |
903 |
+DESCRIPTION="Port of OpenBSD's free SSH release" |
904 |
+HOMEPAGE="https://www.openssh.com/" |
905 |
+SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz |
906 |
+ ${SCTP_PATCH:+sctp? ( https://dev.gentoo.org/~whissi/dist/openssh/${SCTP_PATCH} )} |
907 |
+ ${HPN_VER:+hpn? ( $(printf "mirror://sourceforge/hpnssh/HPN-SSH%%20${HPN_VER/./v}%%20${HPN_PV/_P/p}/%s\n" "${HPN_PATCHES[@]}") )} |
908 |
+ ${X509_PATCH:+X509? ( https://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )} |
909 |
+ " |
910 |
+ |
911 |
+LICENSE="BSD GPL-2" |
912 |
+SLOT="0" |
913 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
914 |
+# Probably want to drop ssl defaulting to on in a future version. |
915 |
+IUSE="abi_mips_n32 audit bindist debug hpn kerberos kernel_linux ldns libedit libressl livecd pam +pie sctp selinux +ssl static test X X509" |
916 |
+RESTRICT="!test? ( test )" |
917 |
+REQUIRED_USE="ldns? ( ssl ) |
918 |
+ pie? ( !static ) |
919 |
+ static? ( !kerberos !pam ) |
920 |
+ X509? ( !sctp ssl ) |
921 |
+ test? ( ssl )" |
922 |
+ |
923 |
+LIB_DEPEND=" |
924 |
+ audit? ( sys-process/audit[static-libs(+)] ) |
925 |
+ ldns? ( |
926 |
+ net-libs/ldns[static-libs(+)] |
927 |
+ !bindist? ( net-libs/ldns[ecdsa,ssl(+)] ) |
928 |
+ bindist? ( net-libs/ldns[-ecdsa,ssl(+)] ) |
929 |
+ ) |
930 |
+ libedit? ( dev-libs/libedit:=[static-libs(+)] ) |
931 |
+ sctp? ( net-misc/lksctp-tools[static-libs(+)] ) |
932 |
+ selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] ) |
933 |
+ ssl? ( |
934 |
+ !libressl? ( |
935 |
+ || ( |
936 |
+ ( |
937 |
+ >=dev-libs/openssl-1.0.1:0[bindist=] |
938 |
+ <dev-libs/openssl-1.1.0:0[bindist=] |
939 |
+ ) |
940 |
+ >=dev-libs/openssl-1.1.0g:0[bindist=] |
941 |
+ ) |
942 |
+ dev-libs/openssl:0=[static-libs(+)] |
943 |
+ ) |
944 |
+ libressl? ( dev-libs/libressl:0=[static-libs(+)] ) |
945 |
+ ) |
946 |
+ >=sys-libs/zlib-1.2.3:=[static-libs(+)]" |
947 |
+RDEPEND=" |
948 |
+ !static? ( ${LIB_DEPEND//\[static-libs(+)]} ) |
949 |
+ pam? ( virtual/pam ) |
950 |
+ kerberos? ( virtual/krb5 )" |
951 |
+DEPEND="${RDEPEND} |
952 |
+ static? ( ${LIB_DEPEND} ) |
953 |
+ virtual/pkgconfig |
954 |
+ virtual/os-headers |
955 |
+ sys-devel/autoconf" |
956 |
+RDEPEND="${RDEPEND} |
957 |
+ pam? ( >=sys-auth/pambase-20081028 ) |
958 |
+ userland_GNU? ( virtual/shadow ) |
959 |
+ X? ( x11-apps/xauth )" |
960 |
+ |
961 |
+S="${WORKDIR}/${PARCH}" |
962 |
+ |
963 |
+pkg_pretend() { |
964 |
+ # this sucks, but i'd rather have people unable to `emerge -u openssh` |
965 |
+ # than not be able to log in to their server any more |
966 |
+ maybe_fail() { [[ -z ${!2} ]] && echo "$1" ; } |
967 |
+ local fail=" |
968 |
+ $(use hpn && maybe_fail hpn HPN_VER) |
969 |
+ $(use sctp && maybe_fail sctp SCTP_PATCH) |
970 |
+ $(use X509 && maybe_fail X509 X509_PATCH) |
971 |
+ " |
972 |
+ fail=$(echo ${fail}) |
973 |
+ if [[ -n ${fail} ]] ; then |
974 |
+ eerror "Sorry, but this version does not yet support features" |
975 |
+ eerror "that you requested: ${fail}" |
976 |
+ eerror "Please mask ${PF} for now and check back later:" |
977 |
+ eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask" |
978 |
+ die "booooo" |
979 |
+ fi |
980 |
+ |
981 |
+ # Make sure people who are using tcp wrappers are notified of its removal. #531156 |
982 |
+ if grep -qs '^ *sshd *:' "${EROOT%/}"/etc/hosts.{allow,deny} ; then |
983 |
+ ewarn "Sorry, but openssh no longer supports tcp-wrappers, and it seems like" |
984 |
+ ewarn "you're trying to use it. Update your ${EROOT}etc/hosts.{allow,deny} please." |
985 |
+ fi |
986 |
+} |
987 |
+ |
988 |
+src_prepare() { |
989 |
+ sed -i \ |
990 |
+ -e "/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX%/}/usr/bin/xauth:" \ |
991 |
+ pathnames.h || die |
992 |
+ |
993 |
+ # don't break .ssh/authorized_keys2 for fun |
994 |
+ sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die |
995 |
+ |
996 |
+ eapply "${FILESDIR}"/${PN}-7.9_p1-include-stdlib.patch |
997 |
+ eapply "${FILESDIR}"/${PN}-8.0_p1-GSSAPI-dns.patch #165444 integrated into gsskex |
998 |
+ eapply "${FILESDIR}"/${PN}-6.7_p1-openssl-ignore-status.patch |
999 |
+ eapply "${FILESDIR}"/${PN}-7.5_p1-disable-conch-interop-tests.patch |
1000 |
+ eapply "${FILESDIR}"/${PN}-8.0_p1-tests.patch |
1001 |
+ |
1002 |
+ [[ -d ${WORKDIR}/patches ]] && eapply "${WORKDIR}"/patches |
1003 |
+ |
1004 |
+ local PATCHSET_VERSION_MACROS=() |
1005 |
+ |
1006 |
+ if use X509 ; then |
1007 |
+ pushd "${WORKDIR}" || die |
1008 |
+ eapply "${FILESDIR}/${P}-X509-glue-${X509_VER}.patch" |
1009 |
+ eapply "${FILESDIR}/${P}-X509-dont-make-piddir-${X509_VER}.patch" |
1010 |
+ popd || die |
1011 |
+ |
1012 |
+ eapply "${WORKDIR}"/${X509_PATCH%.*} |
1013 |
+ eapply "${FILESDIR}"/${P}-X509-${X509_VER}-tests.patch |
1014 |
+ |
1015 |
+ # We need to patch package version or any X.509 sshd will reject our ssh client |
1016 |
+ # with "userauth_pubkey: could not parse key: string is too large [preauth]" |
1017 |
+ # error |
1018 |
+ einfo "Patching package version for X.509 patch set ..." |
1019 |
+ sed -i \ |
1020 |
+ -e "s/^AC_INIT(\[OpenSSH\], \[Portable\]/AC_INIT([OpenSSH], [${X509_VER}]/" \ |
1021 |
+ "${S}"/configure.ac || die "Failed to patch package version for X.509 patch" |
1022 |
+ |
1023 |
+ einfo "Patching version.h to expose X.509 patch set ..." |
1024 |
+ sed -i \ |
1025 |
+ -e "/^#define SSH_PORTABLE.*/a #define SSH_X509 \"-PKIXSSH-${X509_VER}\"" \ |
1026 |
+ "${S}"/version.h || die "Failed to sed-in X.509 patch version" |
1027 |
+ PATCHSET_VERSION_MACROS+=( 'SSH_X509' ) |
1028 |
+ fi |
1029 |
+ |
1030 |
+ if use sctp ; then |
1031 |
+ eapply "${WORKDIR}"/${SCTP_PATCH%.*} |
1032 |
+ |
1033 |
+ einfo "Patching version.h to expose SCTP patch set ..." |
1034 |
+ sed -i \ |
1035 |
+ -e "/^#define SSH_PORTABLE/a #define SSH_SCTP \"-sctp-${SCTP_VER}\"" \ |
1036 |
+ "${S}"/version.h || die "Failed to sed-in SCTP patch version" |
1037 |
+ PATCHSET_VERSION_MACROS+=( 'SSH_SCTP' ) |
1038 |
+ |
1039 |
+ einfo "Disabling know failing test (cfgparse) caused by SCTP patch ..." |
1040 |
+ sed -i \ |
1041 |
+ -e "/\t\tcfgparse \\\/d" \ |
1042 |
+ "${S}"/regress/Makefile || die "Failed to disable known failing test (cfgparse) caused by SCTP patch" |
1043 |
+ fi |
1044 |
+ |
1045 |
+ if use hpn ; then |
1046 |
+ local hpn_patchdir="${T}/${P}-hpn${HPN_VER}" |
1047 |
+ mkdir "${hpn_patchdir}" |
1048 |
+ cp $(printf -- "${DISTDIR}/%s\n" "${HPN_PATCHES[@]}") "${hpn_patchdir}" |
1049 |
+ pushd "${hpn_patchdir}" |
1050 |
+ eapply "${FILESDIR}"/${PN}-8.0_p1-hpn-glue.patch |
1051 |
+ if use X509; then |
1052 |
+ einfo "Will disable MT AES cipher due to incompatbility caused by X509 patch set" |
1053 |
+ # X509 and AES-CTR-MT don't get along, let's just drop it |
1054 |
+ rm openssh-${HPN_PV//./_}-hpn-AES-CTR-${HPN_VER}.diff || die |
1055 |
+ eapply "${FILESDIR}"/${PN}-8.0_p1-hpn-X509-glue.patch |
1056 |
+ fi |
1057 |
+ use sctp && eapply "${FILESDIR}"/${PN}-7.9_p1-hpn-sctp-glue.patch |
1058 |
+ popd |
1059 |
+ |
1060 |
+ eapply "${hpn_patchdir}" |
1061 |
+ |
1062 |
+ if ! use X509; then |
1063 |
+ eapply "${FILESDIR}/openssh-7.9_p1-hpn-openssl-1.1.patch" |
1064 |
+ eapply "${FILESDIR}/openssh-8.0_p1-hpn-version.patch" |
1065 |
+ fi |
1066 |
+ |
1067 |
+ einfo "Patching Makefile.in for HPN patch set ..." |
1068 |
+ sed -i \ |
1069 |
+ -e "/^LIBS=/ s/\$/ -lpthread/" \ |
1070 |
+ "${S}"/Makefile.in || die "Failed to patch Makefile.in" |
1071 |
+ |
1072 |
+ einfo "Patching version.h to expose HPN patch set ..." |
1073 |
+ sed -i \ |
1074 |
+ -e "/^#define SSH_PORTABLE/a #define SSH_HPN \"-hpn${HPN_VER//./v}\"" \ |
1075 |
+ "${S}"/version.h || die "Failed to sed-in HPN patch version" |
1076 |
+ PATCHSET_VERSION_MACROS+=( 'SSH_HPN' ) |
1077 |
+ |
1078 |
+ if [[ -n "${HPN_DISABLE_MTAES}" ]] ; then |
1079 |
+ einfo "Disabling known non-working MT AES cipher per default ..." |
1080 |
+ |
1081 |
+ cat > "${T}"/disable_mtaes.conf <<- EOF |
1082 |
+ |
1083 |
+ # HPN's Multi-Threaded AES CTR cipher is currently known to be broken |
1084 |
+ # and therefore disabled per default. |
1085 |
+ DisableMTAES yes |
1086 |
+ EOF |
1087 |
+ sed -i \ |
1088 |
+ -e "/^#HPNDisabled.*/r ${T}/disable_mtaes.conf" \ |
1089 |
+ "${S}"/sshd_config || die "Failed to disabled MT AES ciphers in sshd_config" |
1090 |
+ |
1091 |
+ sed -i \ |
1092 |
+ -e "/AcceptEnv.*_XXX_TEST$/a \\\tDisableMTAES\t\tyes" \ |
1093 |
+ "${S}"/regress/test-exec.sh || die "Failed to disable MT AES ciphers in test config" |
1094 |
+ fi |
1095 |
+ fi |
1096 |
+ |
1097 |
+ if use X509 || use sctp || use hpn ; then |
1098 |
+ einfo "Patching sshconnect.c to use SSH_RELEASE in send_client_banner() ..." |
1099 |
+ sed -i \ |
1100 |
+ -e "s/PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION/PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE/" \ |
1101 |
+ "${S}"/sshconnect.c || die "Failed to patch send_client_banner() to use SSH_RELEASE (sshconnect.c)" |
1102 |
+ |
1103 |
+ einfo "Patching sshd.c to use SSH_RELEASE in sshd_exchange_identification() ..." |
1104 |
+ sed -i \ |
1105 |
+ -e "s/PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION/PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE/" \ |
1106 |
+ "${S}"/sshd.c || die "Failed to patch sshd_exchange_identification() to use SSH_RELEASE (sshd.c)" |
1107 |
+ |
1108 |
+ einfo "Patching version.h to add our patch sets to SSH_RELEASE ..." |
1109 |
+ sed -i \ |
1110 |
+ -e "s/^#define SSH_RELEASE.*/#define SSH_RELEASE SSH_VERSION SSH_PORTABLE ${PATCHSET_VERSION_MACROS[*]}/" \ |
1111 |
+ "${S}"/version.h || die "Failed to patch SSH_RELEASE (version.h)" |
1112 |
+ fi |
1113 |
+ |
1114 |
+ sed -i \ |
1115 |
+ -e "/#UseLogin no/d" \ |
1116 |
+ "${S}"/sshd_config || die "Failed to remove removed UseLogin option (sshd_config)" |
1117 |
+ |
1118 |
+ eapply_user #473004 |
1119 |
+ |
1120 |
+ tc-export PKG_CONFIG |
1121 |
+ local sed_args=( |
1122 |
+ -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):" |
1123 |
+ # Disable PATH reset, trust what portage gives us #254615 |
1124 |
+ -e 's:^PATH=/:#PATH=/:' |
1125 |
+ # Disable fortify flags ... our gcc does this for us |
1126 |
+ -e 's:-D_FORTIFY_SOURCE=2::' |
1127 |
+ ) |
1128 |
+ |
1129 |
+ # The -ftrapv flag ICEs on hppa #505182 |
1130 |
+ use hppa && sed_args+=( |
1131 |
+ -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:' |
1132 |
+ -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d' |
1133 |
+ ) |
1134 |
+ # _XOPEN_SOURCE causes header conflicts on Solaris |
1135 |
+ [[ ${CHOST} == *-solaris* ]] && sed_args+=( |
1136 |
+ -e 's/-D_XOPEN_SOURCE//' |
1137 |
+ ) |
1138 |
+ sed -i "${sed_args[@]}" configure{.ac,} || die |
1139 |
+ |
1140 |
+ eautoreconf |
1141 |
+} |
1142 |
+ |
1143 |
+src_configure() { |
1144 |
+ addwrite /dev/ptmx |
1145 |
+ |
1146 |
+ use debug && append-cppflags -DSANDBOX_SECCOMP_FILTER_DEBUG |
1147 |
+ use static && append-ldflags -static |
1148 |
+ |
1149 |
+ local myconf=( |
1150 |
+ --with-ldflags="${LDFLAGS}" |
1151 |
+ --disable-strip |
1152 |
+ --with-pid-dir="${EPREFIX}"$(usex kernel_linux '' '/var')/run |
1153 |
+ --sysconfdir="${EPREFIX%/}"/etc/ssh |
1154 |
+ --libexecdir="${EPREFIX%/}"/usr/$(get_libdir)/misc |
1155 |
+ --datadir="${EPREFIX%/}"/usr/share/openssh |
1156 |
+ --with-privsep-path="${EPREFIX%/}"/var/empty |
1157 |
+ --with-privsep-user=sshd |
1158 |
+ $(use_with audit audit linux) |
1159 |
+ $(use_with kerberos kerberos5 "${EPREFIX%/}"/usr) |
1160 |
+ # We apply the sctp patch conditionally, so can't pass --without-sctp |
1161 |
+ # unconditionally else we get unknown flag warnings. |
1162 |
+ $(use sctp && use_with sctp) |
1163 |
+ $(use_with ldns ldns "${EPREFIX%/}"/usr) |
1164 |
+ $(use_with libedit) |
1165 |
+ $(use_with pam) |
1166 |
+ $(use_with pie) |
1167 |
+ $(use_with selinux) |
1168 |
+ $(use_with ssl openssl) |
1169 |
+ $(use_with ssl md5-passwords) |
1170 |
+ $(use_with ssl ssl-engine) |
1171 |
+ $(use_with !elibc_Cygwin hardening) #659210 |
1172 |
+ ) |
1173 |
+ |
1174 |
+ # stackprotect is broken on musl x86 |
1175 |
+ use elibc_musl && use x86 && myconf+=( --without-stackprotect ) |
1176 |
+ |
1177 |
+ # The seccomp sandbox is broken on x32, so use the older method for now. #553748 |
1178 |
+ use amd64 && [[ ${ABI} == "x32" ]] && myconf+=( --with-sandbox=rlimit ) |
1179 |
+ |
1180 |
+ econf "${myconf[@]}" |
1181 |
+} |
1182 |
+ |
1183 |
+src_test() { |
1184 |
+ local t skipped=() failed=() passed=() |
1185 |
+ local tests=( interop-tests compat-tests ) |
1186 |
+ |
1187 |
+ local shell=$(egetshell "${UID}") |
1188 |
+ if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then |
1189 |
+ elog "Running the full OpenSSH testsuite requires a usable shell for the 'portage'" |
1190 |
+ elog "user, so we will run a subset only." |
1191 |
+ skipped+=( tests ) |
1192 |
+ else |
1193 |
+ tests+=( tests ) |
1194 |
+ fi |
1195 |
+ |
1196 |
+ # It will also attempt to write to the homedir .ssh. |
1197 |
+ local sshhome=${T}/homedir |
1198 |
+ mkdir -p "${sshhome}"/.ssh |
1199 |
+ for t in "${tests[@]}" ; do |
1200 |
+ # Some tests read from stdin ... |
1201 |
+ HOMEDIR="${sshhome}" HOME="${sshhome}" SUDO="" \ |
1202 |
+ emake -k -j1 ${t} </dev/null \ |
1203 |
+ && passed+=( "${t}" ) \ |
1204 |
+ || failed+=( "${t}" ) |
1205 |
+ done |
1206 |
+ |
1207 |
+ einfo "Passed tests: ${passed[*]}" |
1208 |
+ [[ ${#skipped[@]} -gt 0 ]] && ewarn "Skipped tests: ${skipped[*]}" |
1209 |
+ [[ ${#failed[@]} -gt 0 ]] && die "Some tests failed: ${failed[*]}" |
1210 |
+} |
1211 |
+ |
1212 |
+# Gentoo tweaks to default config files. |
1213 |
+tweak_ssh_configs() { |
1214 |
+ local locale_vars=( |
1215 |
+ # These are language variables that POSIX defines. |
1216 |
+ # http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_02 |
1217 |
+ LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME |
1218 |
+ |
1219 |
+ # These are the GNU extensions. |
1220 |
+ # https://www.gnu.org/software/autoconf/manual/html_node/Special-Shell-Variables.html |
1221 |
+ LANGUAGE LC_ADDRESS LC_IDENTIFICATION LC_MEASUREMENT LC_NAME LC_PAPER LC_TELEPHONE |
1222 |
+ ) |
1223 |
+ |
1224 |
+ # First the server config. |
1225 |
+ cat <<-EOF >> "${ED%/}"/etc/ssh/sshd_config |
1226 |
+ |
1227 |
+ # Allow client to pass locale environment variables. #367017 |
1228 |
+ AcceptEnv ${locale_vars[*]} |
1229 |
+ |
1230 |
+ # Allow client to pass COLORTERM to match TERM. #658540 |
1231 |
+ AcceptEnv COLORTERM |
1232 |
+ EOF |
1233 |
+ |
1234 |
+ # Then the client config. |
1235 |
+ cat <<-EOF >> "${ED%/}"/etc/ssh/ssh_config |
1236 |
+ |
1237 |
+ # Send locale environment variables. #367017 |
1238 |
+ SendEnv ${locale_vars[*]} |
1239 |
+ |
1240 |
+ # Send COLORTERM to match TERM. #658540 |
1241 |
+ SendEnv COLORTERM |
1242 |
+ EOF |
1243 |
+ |
1244 |
+ if use pam ; then |
1245 |
+ sed -i \ |
1246 |
+ -e "/^#UsePAM /s:.*:UsePAM yes:" \ |
1247 |
+ -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \ |
1248 |
+ -e "/^#PrintMotd /s:.*:PrintMotd no:" \ |
1249 |
+ -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \ |
1250 |
+ "${ED%/}"/etc/ssh/sshd_config || die |
1251 |
+ fi |
1252 |
+ |
1253 |
+ if use livecd ; then |
1254 |
+ sed -i \ |
1255 |
+ -e '/^#PermitRootLogin/c# Allow root login with password on livecds.\nPermitRootLogin Yes' \ |
1256 |
+ "${ED%/}"/etc/ssh/sshd_config || die |
1257 |
+ fi |
1258 |
+} |
1259 |
+ |
1260 |
+src_install() { |
1261 |
+ emake install-nokeys DESTDIR="${D}" |
1262 |
+ fperms 600 /etc/ssh/sshd_config |
1263 |
+ dobin contrib/ssh-copy-id |
1264 |
+ newinitd "${FILESDIR}"/sshd-r1.initd sshd |
1265 |
+ newconfd "${FILESDIR}"/sshd-r1.confd sshd |
1266 |
+ |
1267 |
+ newpamd "${FILESDIR}"/sshd.pam_include.2 sshd |
1268 |
+ |
1269 |
+ tweak_ssh_configs |
1270 |
+ |
1271 |
+ doman contrib/ssh-copy-id.1 |
1272 |
+ dodoc CREDITS OVERVIEW README* TODO sshd_config |
1273 |
+ use hpn && dodoc HPN-README |
1274 |
+ use X509 || dodoc ChangeLog |
1275 |
+ |
1276 |
+ diropts -m 0700 |
1277 |
+ dodir /etc/skel/.ssh |
1278 |
+ |
1279 |
+ keepdir /var/empty |
1280 |
+ |
1281 |
+ systemd_dounit "${FILESDIR}"/sshd.{service,socket} |
1282 |
+ systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service' |
1283 |
+} |
1284 |
+ |
1285 |
+pkg_preinst() { |
1286 |
+ enewgroup sshd 22 |
1287 |
+ enewuser sshd 22 -1 /var/empty sshd |
1288 |
+} |
1289 |
+ |
1290 |
+pkg_postinst() { |
1291 |
+ if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then |
1292 |
+ elog "Starting with openssh-5.8p1, the server will default to a newer key" |
1293 |
+ elog "algorithm (ECDSA). You are encouraged to manually update your stored" |
1294 |
+ elog "keys list as servers update theirs. See ssh-keyscan(1) for more info." |
1295 |
+ fi |
1296 |
+ if has_version "<${CATEGORY}/${PN}-7.0_p1" ; then |
1297 |
+ elog "Starting with openssh-6.7, support for USE=tcpd has been dropped by upstream." |
1298 |
+ elog "Make sure to update any configs that you might have. Note that xinetd might" |
1299 |
+ elog "be an alternative for you as it supports USE=tcpd." |
1300 |
+ fi |
1301 |
+ if has_version "<${CATEGORY}/${PN}-7.1_p1" ; then #557388 #555518 |
1302 |
+ elog "Starting with openssh-7.0, support for ssh-dss keys were disabled due to their" |
1303 |
+ elog "weak sizes. If you rely on these key types, you can re-enable the key types by" |
1304 |
+ elog "adding to your sshd_config or ~/.ssh/config files:" |
1305 |
+ elog " PubkeyAcceptedKeyTypes=+ssh-dss" |
1306 |
+ elog "You should however generate new keys using rsa or ed25519." |
1307 |
+ |
1308 |
+ elog "Starting with openssh-7.0, the default for PermitRootLogin changed from 'yes'" |
1309 |
+ elog "to 'prohibit-password'. That means password auth for root users no longer works" |
1310 |
+ elog "out of the box. If you need this, please update your sshd_config explicitly." |
1311 |
+ fi |
1312 |
+ if has_version "<${CATEGORY}/${PN}-7.6_p1" ; then |
1313 |
+ elog "Starting with openssh-7.6p1, openssh upstream has removed ssh1 support entirely." |
1314 |
+ elog "Furthermore, rsa keys with less than 1024 bits will be refused." |
1315 |
+ fi |
1316 |
+ if has_version "<${CATEGORY}/${PN}-7.7_p1" ; then |
1317 |
+ elog "Starting with openssh-7.7p1, we no longer patch openssh to provide LDAP functionality." |
1318 |
+ elog "Install sys-auth/ssh-ldap-pubkey and use OpenSSH's \"AuthorizedKeysCommand\" option" |
1319 |
+ elog "if you need to authenticate against LDAP." |
1320 |
+ elog "See https://wiki.gentoo.org/wiki/SSH/LDAP_migration for more details." |
1321 |
+ fi |
1322 |
+ if ! use ssl && has_version "${CATEGORY}/${PN}[ssl]" ; then |
1323 |
+ elog "Be aware that by disabling openssl support in openssh, the server and clients" |
1324 |
+ elog "no longer support dss/rsa/ecdsa keys. You will need to generate ed25519 keys" |
1325 |
+ elog "and update all clients/servers that utilize them." |
1326 |
+ fi |
1327 |
+ |
1328 |
+ if use hpn && [[ -n "${HPN_DISABLE_MTAES}" ]] ; then |
1329 |
+ elog "" |
1330 |
+ elog "HPN's multi-threaded AES CTR cipher is currently known to be broken" |
1331 |
+ elog "and therefore disabled at runtime per default." |
1332 |
+ elog "Make sure your sshd_config is up to date and contains" |
1333 |
+ elog "" |
1334 |
+ elog " DisableMTAES yes" |
1335 |
+ elog "" |
1336 |
+ elog "Otherwise you maybe unable to connect to this sshd using any AES CTR cipher." |
1337 |
+ elog "" |
1338 |
+ fi |
1339 |
+} |