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