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