Merge pull request #21500 from grahamc/openssh
Patch Openssh for Roundup #15
This commit is contained in:
commit
b5000249a8
@ -264,8 +264,7 @@ in
|
|||||||
StandardInput = "socket";
|
StandardInput = "socket";
|
||||||
} else {
|
} else {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
Type = "forking";
|
Type = "simple";
|
||||||
PIDFile = "/run/sshd.pid";
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -322,8 +321,6 @@ in
|
|||||||
|
|
||||||
services.openssh.extraConfig = mkOrder 0
|
services.openssh.extraConfig = mkOrder 0
|
||||||
''
|
''
|
||||||
PidFile /run/sshd.pid
|
|
||||||
|
|
||||||
Protocol 2
|
Protocol 2
|
||||||
|
|
||||||
UsePAM yes
|
UsePAM yes
|
||||||
|
@ -35,6 +35,18 @@ in {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
server_lazy =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.openssh = { enable = true; startWhenNeeded = true; };
|
||||||
|
security.pam.services.sshd.limits =
|
||||||
|
[ { domain = "*"; item = "memlock"; type = "-"; value = 1024; } ];
|
||||||
|
users.extraUsers.root.openssh.authorizedKeys.keys = [
|
||||||
|
snakeOilPublicKey
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
client =
|
client =
|
||||||
{ config, pkgs, ... }: { };
|
{ config, pkgs, ... }: { };
|
||||||
|
|
||||||
@ -50,6 +62,8 @@ in {
|
|||||||
subtest "manual-authkey", sub {
|
subtest "manual-authkey", sub {
|
||||||
$server->succeed("mkdir -m 700 /root/.ssh");
|
$server->succeed("mkdir -m 700 /root/.ssh");
|
||||||
$server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
|
$server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
|
||||||
|
$server_lazy->succeed("mkdir -m 700 /root/.ssh");
|
||||||
|
$server_lazy->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
|
||||||
|
|
||||||
$client->succeed("mkdir -m 700 /root/.ssh");
|
$client->succeed("mkdir -m 700 /root/.ssh");
|
||||||
$client->copyFileFromHost("key", "/root/.ssh/id_ed25519");
|
$client->copyFileFromHost("key", "/root/.ssh/id_ed25519");
|
||||||
@ -58,6 +72,10 @@ in {
|
|||||||
$client->waitForUnit("network.target");
|
$client->waitForUnit("network.target");
|
||||||
$client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'echo hello world' >&2");
|
$client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'echo hello world' >&2");
|
||||||
$client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'ulimit -l' | grep 1024");
|
$client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'ulimit -l' | grep 1024");
|
||||||
|
|
||||||
|
$client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server_lazy 'echo hello world' >&2");
|
||||||
|
$client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server_lazy 'ulimit -l' | grep 1024");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest "configured-authkey", sub {
|
subtest "configured-authkey", sub {
|
||||||
@ -66,6 +84,11 @@ in {
|
|||||||
$client->succeed("ssh -o UserKnownHostsFile=/dev/null" .
|
$client->succeed("ssh -o UserKnownHostsFile=/dev/null" .
|
||||||
" -o StrictHostKeyChecking=no -i privkey.snakeoil" .
|
" -o StrictHostKeyChecking=no -i privkey.snakeoil" .
|
||||||
" server true");
|
" server true");
|
||||||
|
|
||||||
|
$client->succeed("ssh -o UserKnownHostsFile=/dev/null" .
|
||||||
|
" -o StrictHostKeyChecking=no -i privkey.snakeoil" .
|
||||||
|
" server_lazy true");
|
||||||
|
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
diff --git a/kex.c b/kex.c
|
|
||||||
index 50c7a0f..823668b 100644
|
|
||||||
--- a/kex.c
|
|
||||||
+++ b/kex.c
|
|
||||||
@@ -419,6 +419,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
|
|
||||||
ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error);
|
|
||||||
if ((r = sshpkt_get_end(ssh)) != 0)
|
|
||||||
return r;
|
|
||||||
+ if ((r = ssh_set_newkeys(ssh, MODE_IN)) != 0)
|
|
||||||
+ return r;
|
|
||||||
kex->done = 1;
|
|
||||||
sshbuf_reset(kex->peer);
|
|
||||||
/* sshbuf_reset(kex->my); */
|
|
||||||
diff --git a/packet.c b/packet.c
|
|
||||||
index d6dad2d..f96566b 100644
|
|
||||||
--- a/packet.c
|
|
||||||
+++ b/packet.c
|
|
||||||
@@ -38,7 +38,7 @@
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "includes.h"
|
|
||||||
-
|
|
||||||
+
|
|
||||||
#include <sys/param.h> /* MIN roundup */
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include "openbsd-compat/sys-queue.h"
|
|
||||||
@@ -1907,9 +1907,7 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
|
|
||||||
return r;
|
|
||||||
return SSH_ERR_PROTOCOL_ERROR;
|
|
||||||
}
|
|
||||||
- if (*typep == SSH2_MSG_NEWKEYS)
|
|
||||||
- r = ssh_set_newkeys(ssh, MODE_IN);
|
|
||||||
- else if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
|
|
||||||
+ if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
|
|
||||||
r = ssh_packet_enable_delayed_compress(ssh);
|
|
||||||
else
|
|
||||||
r = 0;
|
|
@ -19,8 +19,10 @@ let
|
|||||||
|
|
||||||
# **please** update this patch when you update to a new openssh release.
|
# **please** update this patch when you update to a new openssh release.
|
||||||
gssapiSrc = fetchpatch {
|
gssapiSrc = fetchpatch {
|
||||||
url = "https://anonscm.debian.org/cgit/pkg-ssh/openssh.git/plain/debian/patches/gssapi.patch?id=477bb7636238c106f8cd7c868a8c0c5eabcfb3db";
|
name = "openssh-gssapi.patch";
|
||||||
sha256 = "1kcx2rw6z7y591vr60ww2m2civ0cx6f6awdpi66p1sric9b65si3";
|
url = "https://anonscm.debian.org/cgit/pkg-ssh/openssh.git/plain/debian"
|
||||||
|
+ "/patches/gssapi.patch?id=255b8554a50b5c75fca63f76b1ac837c0d4fb7aa";
|
||||||
|
sha256 = "0yg9iq7vb2fkvy36ar0jxk29pkw0h3dhv5vn8qncc3pgwx3617n2";
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -29,11 +31,11 @@ stdenv.mkDerivation rec {
|
|||||||
# Please ensure that openssh_with_kerberos still builds when
|
# Please ensure that openssh_with_kerberos still builds when
|
||||||
# bumping the version here!
|
# bumping the version here!
|
||||||
name = "openssh-${version}";
|
name = "openssh-${version}";
|
||||||
version = "7.3p1";
|
version = "7.4p1";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://openbsd/OpenSSH/portable/${name}.tar.gz";
|
url = "mirror://openbsd/OpenSSH/portable/${name}.tar.gz";
|
||||||
sha256 = "1k5y1wi29d47cgizbryxrhc1fbjsba2x8l5mqfa9b9nadnd9iyrz";
|
sha256 = "1l8r3x4fr2kb6xm95s7kjdif1wp6f94d4kljh4qjj9109shw87qv";
|
||||||
};
|
};
|
||||||
|
|
||||||
prePatch = optionalString hpnSupport
|
prePatch = optionalString hpnSupport
|
||||||
@ -44,13 +46,11 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
patches =
|
patches =
|
||||||
[
|
[
|
||||||
./RH-1380296-NEWKEYS-null-pointer-deref.patch
|
|
||||||
./locale_archive.patch
|
./locale_archive.patch
|
||||||
./fix-host-key-algorithms-plus.patch
|
./fix-host-key-algorithms-plus.patch
|
||||||
|
|
||||||
# See discussion in https://github.com/NixOS/nixpkgs/pull/16966
|
# See discussion in https://github.com/NixOS/nixpkgs/pull/16966
|
||||||
./dont_create_privsep_path.patch
|
./dont_create_privsep_path.patch
|
||||||
./fix-CVE-2016-8858.patch
|
|
||||||
]
|
]
|
||||||
++ optional withGssapiPatches gssapiSrc;
|
++ optional withGssapiPatches gssapiSrc;
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
diff -u -r1.126 -r1.127
|
|
||||||
--- ssh/kex.c 2016/09/28 21:44:52 1.126
|
|
||||||
+++ ssh/kex.c 2016/10/10 19:28:48 1.127
|
|
||||||
@@ -461,6 +461,7 @@
|
|
||||||
if (kex == NULL)
|
|
||||||
return SSH_ERR_INVALID_ARGUMENT;
|
|
||||||
|
|
||||||
+ ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL);
|
|
||||||
ptr = sshpkt_ptr(ssh, &dlen);
|
|
||||||
if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0)
|
|
||||||
return r;
|
|
Loading…
Reference in New Issue
Block a user