Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1d36a992b | ||
|
|
5efe59da2a | ||
|
|
338cee0576 | ||
|
|
1d94ba137e |
6 changed files with 164 additions and 14 deletions
|
|
@ -24,7 +24,7 @@
|
|||
%global libedit 1
|
||||
|
||||
%global openssh_ver 9.0p1
|
||||
%global openssh_rel 5
|
||||
%global openssh_rel 8
|
||||
|
||||
Summary: An implementation of the SSH protocol with GSI authentication
|
||||
Name: gsi-openssh
|
||||
|
|
@ -182,6 +182,10 @@ Patch1004: openssh-8.7p1-gssapi-auth.patch
|
|||
# upstream MR:
|
||||
# https://github.com/openssh/openssh-portable/pull/323
|
||||
Patch1006: openssh-8.7p1-negotiate-supported-algs.patch
|
||||
# CVE-2023-25136
|
||||
Patch1007: openssh-8.7p1-CVE-2023-25136.patch
|
||||
|
||||
Patch1015: openssh-9.3p1-upstream-cve-2023-38408.patch
|
||||
|
||||
# Fix issue with read-only ssh buffer during gssapi key exchange (#1938224)
|
||||
# https://github.com/openssh-gsskex/openssh-gsskex/pull/19
|
||||
|
|
@ -344,6 +348,8 @@ gpgv2 --quiet --keyring %{SOURCE3} %{SOURCE1} %{SOURCE0}
|
|||
%patch1003 -p1 -b .mem-leak
|
||||
%patch1004 -p1 -b .gssapi-auth
|
||||
%patch1006 -p1 -b .negotiate-supported-algs
|
||||
%patch1007 -p1 -b .cve-2023-25136
|
||||
%patch1015 -p1 -b .cve-2023-38408
|
||||
|
||||
%patch100 -p1 -b .coverity
|
||||
|
||||
|
|
@ -542,6 +548,15 @@ fi
|
|||
%attr(0744,root,root) %{_libexecdir}/gsissh/ssh-host-keys-migration.sh
|
||||
|
||||
%changelog
|
||||
* Sun Jul 23 2023 Mattias Ellert <mattias.ellert@physics.uu.se> - 9.0p1-8
|
||||
- Based on openssh-9.0p1-16.fc38
|
||||
|
||||
* Wed Jul 19 2023 Mattias Ellert <mattias.ellert@physics.uu.se> - 9.0p1-7
|
||||
- Fix keyex patch
|
||||
|
||||
* Sun Apr 16 2023 Mattias Ellert <mattias.ellert@physics.uu.se> - 9.0p1-6
|
||||
- Based on openssh-9.0p1-15.fc38
|
||||
|
||||
* Sat Mar 11 2023 Mattias Ellert <mattias.ellert@physics.uu.se> - 9.0p1-5
|
||||
- Based on openssh-9.0p1-12.fc38
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ index 9351e042..d6446c0c 100644
|
|||
+ * The 'gssapi_keyex' userauth mechanism.
|
||||
+ */
|
||||
+static int
|
||||
+userauth_gsskeyex(struct ssh *ssh)
|
||||
+userauth_gsskeyex(struct ssh *ssh, const char *method)
|
||||
+{
|
||||
+ Authctxt *authctxt = ssh->authctxt;
|
||||
+ int r, authenticated = 0;
|
||||
|
|
@ -212,19 +212,20 @@ index 9351e042..d6446c0c 100644
|
|||
else
|
||||
logit("GSSAPI MIC check failed");
|
||||
|
||||
@@ -326,6 +370,12 @@ input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh)
|
||||
@@ -326,6 +370,13 @@ input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+Authmethod method_gsskeyex = {
|
||||
+ "gssapi-keyex",
|
||||
+ NULL,
|
||||
+ userauth_gsskeyex,
|
||||
+ &options.gss_authentication
|
||||
+};
|
||||
+
|
||||
Authmethod method_gssapi = {
|
||||
"gssapi-with-mic",
|
||||
NULL,
|
||||
NULL,
|
||||
diff --git a/auth2.c b/auth2.c
|
||||
index 0e776224..1c217268 100644
|
||||
--- a/auth2.c
|
||||
|
|
@ -384,7 +385,7 @@ index ebd0dbca..1bdac6a4 100644
|
|||
/* Do channel operations unless rekeying in progress. */
|
||||
- if (!ssh_packet_is_rekeying(ssh))
|
||||
+ if (!ssh_packet_is_rekeying(ssh)) {
|
||||
channel_after_poll(ssh, pfd, npfd_active);
|
||||
channel_after_poll(ssh, pfd, npfd_active);
|
||||
|
||||
+#ifdef GSSAPI
|
||||
+ if (options.gss_renewal_rekey &&
|
||||
|
|
@ -396,8 +397,8 @@ index ebd0dbca..1bdac6a4 100644
|
|||
+ }
|
||||
+
|
||||
/* Buffer input from the connection. */
|
||||
if (conn_in_ready)
|
||||
client_process_net_input(ssh);
|
||||
if (conn_in_ready)
|
||||
client_process_net_input(ssh);
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index b689db4b..efafb6bd 100644
|
||||
--- a/configure.ac
|
||||
|
|
@ -1370,8 +1371,8 @@ index ce85f043..574c7609 100644
|
|||
+#ifdef GSSAPI
|
||||
+ free(kex->gss_host);
|
||||
+#endif /* GSSAPI */
|
||||
sshbuf_free(kex->initial_sig);
|
||||
sshkey_free(kex->initial_hostkey);
|
||||
sshbuf_free(kex->initial_sig);
|
||||
sshkey_free(kex->initial_hostkey);
|
||||
free(kex->failed_choice);
|
||||
diff --git a/kex.h b/kex.h
|
||||
index a5ae6ac0..fe714141 100644
|
||||
|
|
@ -3568,7 +3569,7 @@ index af00fb30..03bc87eb 100644
|
|||
+# endif
|
||||
+#endif /* WITH_OPENSSL */
|
||||
ssh->kex->kex[KEX_C25519_SHA256] = kex_gen_client;
|
||||
ssh->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_client;
|
||||
ssh->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_client;
|
||||
ssh->kex->verify_host_key=&verify_host_key_callback;
|
||||
|
||||
+#if defined(GSSAPI) && defined(WITH_OPENSSL)
|
||||
|
|
|
|||
38
openssh-8.7p1-CVE-2023-25136.patch
Normal file
38
openssh-8.7p1-CVE-2023-25136.patch
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
diff --git a/compat.c b/compat.c
|
||||
index 46dfe3a9c2e..478a9403eea 100644
|
||||
--- a/compat.c
|
||||
+++ b/compat.c
|
||||
@@ -190,26 +190,26 @@ compat_pkalg_proposal(struct ssh *ssh, char *pkalg_prop)
|
||||
char *
|
||||
compat_kex_proposal(struct ssh *ssh, char *p)
|
||||
{
|
||||
- char *cp = NULL;
|
||||
+ char *cp = NULL, *cp2 = NULL;
|
||||
|
||||
if ((ssh->compat & (SSH_BUG_CURVE25519PAD|SSH_OLD_DHGEX)) == 0)
|
||||
return xstrdup(p);
|
||||
debug2_f("original KEX proposal: %s", p);
|
||||
if ((ssh->compat & SSH_BUG_CURVE25519PAD) != 0)
|
||||
- if ((p = match_filter_denylist(p,
|
||||
+ if ((cp = match_filter_denylist(p,
|
||||
"curve25519-sha256@libssh.org")) == NULL)
|
||||
fatal("match_filter_denylist failed");
|
||||
if ((ssh->compat & SSH_OLD_DHGEX) != 0) {
|
||||
- cp = p;
|
||||
- if ((p = match_filter_denylist(p,
|
||||
+ if ((cp2 = match_filter_denylist(cp ? cp : p,
|
||||
"diffie-hellman-group-exchange-sha256,"
|
||||
"diffie-hellman-group-exchange-sha1")) == NULL)
|
||||
fatal("match_filter_denylist failed");
|
||||
free(cp);
|
||||
+ cp = cp2;
|
||||
}
|
||||
- debug2_f("compat KEX proposal: %s", p);
|
||||
- if (*p == '\0')
|
||||
+ if (cp == NULL || *cp == '\0')
|
||||
fatal("No supported key exchange algorithms found");
|
||||
- return p;
|
||||
+ debug2_f("compat KEX proposal: %s", cp);
|
||||
+ return cp;
|
||||
}
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ diff -Nur openssh-9.0p1.orig/auth2-gss.c openssh-9.0p1/auth2-gss.c
|
|||
+
|
||||
Authmethod method_gsskeyex = {
|
||||
"gssapi-keyex",
|
||||
userauth_gsskeyex,
|
||||
NULL,
|
||||
diff -Nur openssh-9.0p1.orig/auth.c openssh-9.0p1/auth.c
|
||||
--- openssh-9.0p1.orig/auth.c 2022-08-30 19:32:35.492051043 +0200
|
||||
+++ openssh-9.0p1/auth.c 2022-08-30 19:33:23.884176392 +0200
|
||||
|
|
|
|||
|
|
@ -2347,12 +2347,10 @@ diff -Nur openssh-9.0p1.orig/sshconnect2.c openssh-9.0p1/sshconnect2.c
|
|||
void
|
||||
ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port,
|
||||
const struct ssh_conn_info *cinfo)
|
||||
@@ -231,6 +240,10 @@
|
||||
@@ -231,6 +240,8 @@
|
||||
char *gss_host = NULL;
|
||||
#endif
|
||||
|
||||
+ memcpy(&myproposal, &myproposal_default, sizeof(myproposal));
|
||||
+
|
||||
+ memcpy(&myproposal, &myproposal_default, sizeof(myproposal));
|
||||
+
|
||||
xxx_host = host;
|
||||
|
|
|
|||
98
openssh-9.3p1-upstream-cve-2023-38408.patch
Normal file
98
openssh-9.3p1-upstream-cve-2023-38408.patch
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
diff --git a/ssh-agent.c b/ssh-agent.c
|
||||
index 618bb198..8ea831f4 100644
|
||||
diff -up openssh-9.3p1/ssh-agent.c.cve openssh-9.3p1/ssh-agent.c
|
||||
--- openssh-9.3p1/ssh-agent.c.cve 2023-07-21 15:38:13.237276580 +0200
|
||||
+++ openssh-9.3p1/ssh-agent.c 2023-07-21 15:41:30.269943569 +0200
|
||||
@@ -169,6 +169,12 @@ char socket_dir[PATH_MAX];
|
||||
/* Pattern-list of allowed PKCS#11/Security key paths */
|
||||
static char *allowed_providers;
|
||||
|
||||
+/*
|
||||
+ * Allows PKCS11 providers or SK keys that use non-internal providers to
|
||||
+ * be added over a remote connection (identified by session-bind@openssh.com).
|
||||
+ */
|
||||
+static int remote_add_provider;
|
||||
+
|
||||
/* locking */
|
||||
#define LOCK_SIZE 32
|
||||
#define LOCK_SALT_SIZE 16
|
||||
@@ -1228,6 +1234,12 @@ process_add_identity(SocketEntry *e)
|
||||
if (strcasecmp(sk_provider, "internal") == 0) {
|
||||
debug_f("internal provider");
|
||||
} else {
|
||||
+ if (e->nsession_ids != 0 && !remote_add_provider) {
|
||||
+ verbose("failed add of SK provider \"%.100s\": "
|
||||
+ "remote addition of providers is disabled",
|
||||
+ sk_provider);
|
||||
+ goto out;
|
||||
+ }
|
||||
if (realpath(sk_provider, canonical_provider) == NULL) {
|
||||
verbose("failed provider \"%.100s\": "
|
||||
"realpath: %s", sk_provider,
|
||||
@@ -1368,7 +1380,7 @@ no_identities(SocketEntry *e)
|
||||
|
||||
#ifdef ENABLE_PKCS11
|
||||
static char *
|
||||
-sanitize_pkcs11_provider(const char *provider)
|
||||
+sanitize_pkcs11_provider(SocketEntry *e, const char *provider)
|
||||
{
|
||||
struct pkcs11_uri *uri = NULL;
|
||||
char *sane_uri, *module_path = NULL; /* default path */
|
||||
@@ -1399,6 +1411,11 @@ sanitize_pkcs11_provider(const char *pro
|
||||
module_path = strdup(provider); /* simple path */
|
||||
|
||||
if (module_path != NULL) { /* do not validate default NULL path in URI */
|
||||
+ if (e->nsession_ids != 0 && !remote_add_provider) {
|
||||
+ verbose("failed PKCS#11 add of \"%.100s\": remote addition of "
|
||||
+ "providers is disabled", provider);
|
||||
+ return NULL;
|
||||
+ }
|
||||
if (realpath(module_path, canonical_provider) == NULL) {
|
||||
verbose("failed PKCS#11 provider \"%.100s\": realpath: %s",
|
||||
module_path, strerror(errno));
|
||||
@@ -1455,7 +1472,7 @@ process_add_smartcard_key(SocketEntry *e
|
||||
goto send;
|
||||
}
|
||||
|
||||
- sane_uri = sanitize_pkcs11_provider(provider);
|
||||
+ sane_uri = sanitize_pkcs11_provider(e, provider);
|
||||
if (sane_uri == NULL)
|
||||
goto send;
|
||||
|
||||
@@ -1516,7 +1533,7 @@ process_remove_smartcard_key(SocketEntry
|
||||
}
|
||||
free(pin);
|
||||
|
||||
- sane_uri = sanitize_pkcs11_provider(provider);
|
||||
+ sane_uri = sanitize_pkcs11_provider(e, provider);
|
||||
if (sane_uri == NULL)
|
||||
goto send;
|
||||
|
||||
@@ -2108,7 +2125,9 @@ main(int ac, char **av)
|
||||
break;
|
||||
case 'O':
|
||||
if (strcmp(optarg, "no-restrict-websafe") == 0)
|
||||
- restrict_websafe = 0;
|
||||
+ restrict_websafe = 0;
|
||||
+ else if (strcmp(optarg, "allow-remote-pkcs11") == 0)
|
||||
+ remote_add_provider = 1;
|
||||
else
|
||||
fatal("Unknown -O option");
|
||||
break;
|
||||
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
|
||||
index 6be647ec..ebddf6c3 100644
|
||||
--- a/ssh-pkcs11.c
|
||||
+++ b/ssh-pkcs11.c
|
||||
@@ -1537,10 +1537,8 @@ pkcs11_register_provider(char *provider_id, char *pin,
|
||||
error("dlopen %s failed: %s", provider_module, dlerror());
|
||||
goto fail;
|
||||
}
|
||||
- if ((getfunctionlist = dlsym(handle, "C_GetFunctionList")) == NULL) {
|
||||
- error("dlsym(C_GetFunctionList) failed: %s", dlerror());
|
||||
- goto fail;
|
||||
- }
|
||||
+ if ((getfunctionlist = dlsym(handle, "C_GetFunctionList")) == NULL)
|
||||
+ fatal("dlsym(C_GetFunctionList) failed: %s", dlerror());
|
||||
|
||||
p->module->handle = handle;
|
||||
/* setup the pkcs11 callbacks */
|
||||
Loading…
Add table
Add a link
Reference in a new issue