Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d40c8a38aa | ||
|
|
2608e2de3a | ||
|
|
064da31af6 | ||
|
|
25272c68ef | ||
|
|
82b86d60c5 | ||
|
|
ceb1e2f209 | ||
|
|
23b9423768 |
27 changed files with 3254 additions and 5454 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -62,3 +62,5 @@ pam_ssh_agent_auth-0.9.2.tar.bz2
|
|||
/openssh-9.6p1.tar.gz.asc
|
||||
/openssh-9.8p1.tar.gz
|
||||
/openssh-9.8p1.tar.gz.asc
|
||||
/openssh-9.9p1.tar.gz
|
||||
/openssh-9.9p1.tar.gz.asc
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ diff -up openssh/sshd.c.ip-opts openssh/sshd.c
|
|||
+ }
|
||||
+ } while (i < option_size);
|
||||
}
|
||||
return;
|
||||
#endif /* IP_OPTIONS */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,22 +73,6 @@ diff -up openssh-8.5p1/loginrec.c.coverity openssh-8.5p1/loginrec.c
|
|||
strncpy(ut->ut_host, li->hostname,
|
||||
MIN_SIZEOF(ut->ut_host, li->hostname));
|
||||
# endif
|
||||
@@ -1690,6 +1692,7 @@ record_failed_login(struct ssh *ssh, con
|
||||
|
||||
memset(&ut, 0, sizeof(ut));
|
||||
/* strncpy because we don't necessarily want nul termination */
|
||||
+ /* coverity[buffer_size_warning : FALSE] */
|
||||
strncpy(ut.ut_user, username, sizeof(ut.ut_user));
|
||||
strlcpy(ut.ut_line, "ssh:notty", sizeof(ut.ut_line));
|
||||
|
||||
@@ -1699,6 +1702,7 @@ record_failed_login(struct ssh *ssh, con
|
||||
ut.ut_pid = getpid();
|
||||
|
||||
/* strncpy because we don't necessarily want nul termination */
|
||||
+ /* coverity[buffer_size_warning : FALSE] */
|
||||
strncpy(ut.ut_host, hostname, sizeof(ut.ut_host));
|
||||
|
||||
if (ssh_packet_connection_is_on_socket(ssh) &&
|
||||
diff -up openssh-8.5p1/misc.c.coverity openssh-8.5p1/misc.c
|
||||
--- openssh-8.5p1/misc.c.coverity 2021-03-24 12:03:33.745967902 +0100
|
||||
+++ openssh-8.5p1/misc.c 2021-03-24 13:31:47.037079617 +0100
|
||||
|
|
|
|||
|
|
@ -1086,7 +1086,7 @@ diff -up openssh-8.6p1/Makefile.in.audit openssh-8.6p1/Makefile.in
|
|||
--- openssh-8.6p1/Makefile.in.audit 2021-04-19 16:47:35.731061937 +0200
|
||||
+++ openssh-8.6p1/Makefile.in 2021-04-19 16:47:35.756062129 +0200
|
||||
@@ -112,7 +112,7 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
|
||||
kexsntrup761x25519.o sntrup761.o kexgen.o \
|
||||
kexsntrup761x25519.o kexmlkem768x25519.o sntrup761.o kexgen.o \
|
||||
kexgssc.o \
|
||||
sftp-realpath.o platform-pledge.o platform-tracing.o platform-misc.o \
|
||||
- sshbuf-io.o
|
||||
|
|
@ -2056,7 +2056,7 @@ diff -up openssh-8.6p1/sshd-session.c.audit openssh-8.6p1/sshd-session.c
|
|||
#include "ssh-sandbox.h"
|
||||
#include "auth-options.h"
|
||||
#include "version.h"
|
||||
@@ -260,8 +261,8 @@ struct sshbuf *loginmsg;
|
||||
@@ -260,8 +261,44 @@ struct sshbuf *loginmsg;
|
||||
struct sshbuf *loginmsg;
|
||||
|
||||
/* Prototypes for various functions defined later in this file. */
|
||||
|
|
@ -2064,6 +2064,42 @@ diff -up openssh-8.6p1/sshd-session.c.audit openssh-8.6p1/sshd-session.c
|
|||
-void demote_sensitive_data(void);
|
||||
+void destroy_sensitive_data(struct ssh *);
|
||||
+void demote_sensitive_data(struct ssh *);
|
||||
+
|
||||
+static int
|
||||
+sshkey_is_private(const struct sshkey *k)
|
||||
+{
|
||||
+ switch (k->type) {
|
||||
+#ifdef WITH_OPENSSL
|
||||
+ case KEY_RSA_CERT:
|
||||
+ case KEY_RSA: {
|
||||
+ const BIGNUM *d;
|
||||
+ const RSA *rsa = EVP_PKEY_get0_RSA(k->pkey);
|
||||
+ RSA_get0_key(rsa, NULL, NULL, &d);
|
||||
+ return d != NULL;
|
||||
+ }
|
||||
+ case KEY_DSA_CERT:
|
||||
+ case KEY_DSA: {
|
||||
+ const BIGNUM *priv_key;
|
||||
+ DSA_get0_key(k->dsa, NULL, &priv_key);
|
||||
+ return priv_key != NULL;
|
||||
+ }
|
||||
+#ifdef OPENSSL_HAS_ECC
|
||||
+ case KEY_ECDSA_CERT:
|
||||
+ case KEY_ECDSA: {
|
||||
+ const EC_KEY * ecdsa = EVP_PKEY_get0_EC_KEY(k->pkey);
|
||||
+ return EC_KEY_get0_private_key(ecdsa) != NULL;
|
||||
+ }
|
||||
+#endif /* OPENSSL_HAS_ECC */
|
||||
+#endif /* WITH_OPENSSL */
|
||||
+ case KEY_ED25519_CERT:
|
||||
+ case KEY_ED25519:
|
||||
+ return (k->ed25519_pk != NULL);
|
||||
+ default:
|
||||
+ /* fatal("key_is_private: bad key type %d", k->type); */
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void do_ssh2_kex(struct ssh *);
|
||||
|
||||
/*
|
||||
|
|
@ -2222,7 +2258,7 @@ diff -up openssh-8.6p1/sshd-session.c.audit openssh-8.6p1/sshd-session.c
|
|||
|
||||
if (the_active_state != NULL && the_authctxt != NULL) {
|
||||
@@ -2525,7 +2593,9 @@ cleanup_exit(int i)
|
||||
_exit(EXIT_AUTH_ATTEMPTED);
|
||||
}
|
||||
#ifdef SSH_AUDIT_EVENTS
|
||||
/* done after do_cleanup so it can cancel the PAM auth 'thread' */
|
||||
- if (the_active_state != NULL && mm_is_monitor())
|
||||
|
|
@ -2231,57 +2267,4 @@ diff -up openssh-8.6p1/sshd-session.c.audit openssh-8.6p1/sshd-session.c
|
|||
+ mm_is_monitor())
|
||||
audit_event(the_active_state, SSH_CONNECTION_ABANDON);
|
||||
#endif
|
||||
_exit(i);
|
||||
diff -up openssh-8.6p1/sshkey.c.audit openssh-8.6p1/sshkey.c
|
||||
--- openssh-8.6p1/sshkey.c.audit 2021-04-19 16:47:35.741062014 +0200
|
||||
+++ openssh-8.6p1/sshkey.c 2021-04-19 16:47:35.759062152 +0200
|
||||
@@ -371,6 +371,38 @@ sshkey_type_is_valid_ca(int type)
|
||||
}
|
||||
|
||||
int
|
||||
+sshkey_is_private(const struct sshkey *k)
|
||||
+{
|
||||
+ switch (k->type) {
|
||||
+#ifdef WITH_OPENSSL
|
||||
+ case KEY_RSA_CERT:
|
||||
+ case KEY_RSA: {
|
||||
+ const BIGNUM *d;
|
||||
+ RSA_get0_key(k->rsa, NULL, NULL, &d);
|
||||
+ return d != NULL;
|
||||
+ }
|
||||
+ case KEY_DSA_CERT:
|
||||
+ case KEY_DSA: {
|
||||
+ const BIGNUM *priv_key;
|
||||
+ DSA_get0_key(k->dsa, NULL, &priv_key);
|
||||
+ return priv_key != NULL;
|
||||
+ }
|
||||
+#ifdef OPENSSL_HAS_ECC
|
||||
+ case KEY_ECDSA_CERT:
|
||||
+ case KEY_ECDSA:
|
||||
+ return EC_KEY_get0_private_key(k->ecdsa) != NULL;
|
||||
+#endif /* OPENSSL_HAS_ECC */
|
||||
+#endif /* WITH_OPENSSL */
|
||||
+ case KEY_ED25519_CERT:
|
||||
+ case KEY_ED25519:
|
||||
+ return (k->ed25519_pk != NULL);
|
||||
+ default:
|
||||
+ /* fatal("key_is_private: bad key type %d", k->type); */
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int
|
||||
sshkey_is_cert(const struct sshkey *k)
|
||||
{
|
||||
if (k == NULL)
|
||||
diff -up openssh-8.6p1/sshkey.h.audit openssh-8.6p1/sshkey.h
|
||||
--- openssh-8.6p1/sshkey.h.audit 2021-04-19 16:47:35.741062014 +0200
|
||||
+++ openssh-8.6p1/sshkey.h 2021-04-19 16:47:35.759062152 +0200
|
||||
@@ -189,6 +189,7 @@ int sshkey_shield_private(struct sshke
|
||||
int sshkey_unshield_private(struct sshkey *);
|
||||
|
||||
int sshkey_type_from_name(const char *);
|
||||
+int sshkey_is_private(const struct sshkey *);
|
||||
int sshkey_is_cert(const struct sshkey *);
|
||||
int sshkey_is_sk(const struct sshkey *);
|
||||
int sshkey_type_is_cert(int);
|
||||
/* Override default fatal exit value when auth was attempted */
|
||||
|
|
|
|||
|
|
@ -427,9 +427,9 @@ diff -up openssh-8.6p1/sshkey.c.fips openssh-8.6p1/sshkey.c
|
|||
--- openssh-8.6p1/sshkey.c.fips 2021-05-06 12:08:36.493926838 +0200
|
||||
+++ openssh-8.6p1/sshkey.c 2021-05-06 12:08:36.502926908 +0200
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/core_names.h>
|
||||
#include <openssl/param_build.h>
|
||||
+#include <openssl/fips.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -544,13 +544,13 @@ diff -up openssh-8.6p1/ssh-keygen.c.fips openssh-8.6p1/ssh-keygen.c
|
|||
- name = _PATH_SSH_CLIENT_ID_ED25519;
|
||||
+ name = FIPS_mode() ? _PATH_SSH_CLIENT_ID_RSA : _PATH_SSH_CLIENT_ID_ED25519;
|
||||
else {
|
||||
switch (sshkey_type_from_name(key_type_name)) {
|
||||
switch (sshkey_type_from_shortname(key_type_name)) {
|
||||
#ifdef WITH_DSA
|
||||
@@ -1098,9 +1104,17 @@ do_gen_all_hostkeys(struct passwd *pw)
|
||||
first = 1;
|
||||
printf("%s: generating new host keys: ", __progname);
|
||||
}
|
||||
+ type = sshkey_type_from_name(key_types[i].key_type);
|
||||
+ type = sshkey_type_from_shortname(key_types[i].key_type);
|
||||
+
|
||||
+ /* Skip the keys that are not supported in FIPS mode */
|
||||
+ if (FIPS_mode() && (type == KEY_DSA || type == KEY_ED25519)) {
|
||||
|
|
@ -561,7 +561,7 @@ diff -up openssh-8.6p1/ssh-keygen.c.fips openssh-8.6p1/ssh-keygen.c
|
|||
+
|
||||
printf("%s ", key_types[i].key_type_display);
|
||||
fflush(stdout);
|
||||
- type = sshkey_type_from_name(key_types[i].key_type);
|
||||
- type = sshkey_type_from_shortname(key_types[i].key_type);
|
||||
if ((fd = mkstemp(prv_tmp)) == -1) {
|
||||
error("Could not save your private key in %s: %s",
|
||||
prv_tmp, strerror(errno));
|
||||
|
|
@ -572,31 +572,31 @@ diff -up openssh-8.6p1/ssh-keygen.c.fips openssh-8.6p1/ssh-keygen.c
|
|||
- key_type_name = DEFAULT_KEY_TYPE_NAME;
|
||||
+ key_type_name = FIPS_mode() ? FIPS_DEFAULT_KEY_TYPE_NAME : DEFAULT_KEY_TYPE_NAME;
|
||||
|
||||
type = sshkey_type_from_name(key_type_name);
|
||||
type = sshkey_type_from_shortname(key_type_name);
|
||||
type_bits_valid(type, key_type_name, &bits);
|
||||
diff -up openssh-9.3p1/ssh-rsa.c.evpgenrsa openssh-9.3p1/ssh-rsa.c
|
||||
--- openssh-9.3p1/ssh-rsa.c.evpgenrsa 2022-06-30 15:14:58.200518353 +0200
|
||||
+++ openssh-9.3p1/ssh-rsa.c 2022-06-30 15:24:31.499641196 +0200
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/core_names.h>
|
||||
#include <openssl/param_build.h>
|
||||
+#include <openssl/fips.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
@@ -1705,6 +1707,8 @@ ssh_rsa_generate(u_int bits, RSA
|
||||
goto out;
|
||||
|
||||
if (EVP_PKEY_keygen(ctx, &res) <= 0) {
|
||||
}
|
||||
if (EVP_PKEY_keygen(ctx, &res) <= 0 || res == NULL) {
|
||||
+ if (FIPS_mode())
|
||||
+ logit_f("the key length might be unsupported by FIPS mode approved key generation method");
|
||||
ret = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
diff -up openssh-8.7p1/kexgen.c.fips3 openssh-8.7p1/kexgen.c
|
||||
--- openssh-8.7p1/kexgen.c.fips3 2022-07-11 16:11:21.973519913 +0200
|
||||
+++ openssh-8.7p1/kexgen.c 2022-07-11 16:25:31.172187365 +0200
|
||||
diff -up openssh-9.9p1/kexgen.c.xxx openssh-9.9p1/kexgen.c
|
||||
--- openssh-9.9p1/kexgen.c.xxx 2024-10-09 10:35:56.285946080 +0200
|
||||
+++ openssh-9.9p1/kexgen.c 2024-10-09 10:41:52.792597194 +0200
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -605,7 +605,7 @@ diff -up openssh-8.7p1/kexgen.c.fips3 openssh-8.7p1/kexgen.c
|
|||
|
||||
#include "sshkey.h"
|
||||
#include "kex.h"
|
||||
@@ -115,10 +116,20 @@ kex_gen_client(struct ssh *ssh)
|
||||
@@ -115,13 +116,28 @@ kex_gen_client(struct ssh *ssh)
|
||||
break;
|
||||
#endif
|
||||
case KEX_C25519_SHA256:
|
||||
|
|
@ -624,11 +624,20 @@ diff -up openssh-8.7p1/kexgen.c.fips3 openssh-8.7p1/kexgen.c
|
|||
+ r = SSH_ERR_INVALID_ARGUMENT;
|
||||
+ } else {
|
||||
+ r = kex_kem_sntrup761x25519_keypair(kex);
|
||||
+ }
|
||||
break;
|
||||
case KEX_KEM_MLKEM768X25519_SHA256:
|
||||
- r = kex_kem_mlkem768x25519_keypair(kex);
|
||||
+ if (FIPS_mode()) {
|
||||
+ logit_f("Key exchange type mlkem768x25519 is not allowed in FIPS mode");
|
||||
+ r = SSH_ERR_INVALID_ARGUMENT;
|
||||
+ } else {
|
||||
+ r = kex_kem_mlkem768x25519_keypair(kex);
|
||||
+ }
|
||||
break;
|
||||
default:
|
||||
r = SSH_ERR_INVALID_ARGUMENT;
|
||||
@@ -186,11 +197,21 @@ input_kex_gen_reply(int type, u_int32_t
|
||||
@@ -189,15 +205,30 @@ input_kex_gen_reply(int type, u_int32_t
|
||||
break;
|
||||
#endif
|
||||
case KEX_C25519_SHA256:
|
||||
|
|
@ -649,11 +658,22 @@ diff -up openssh-8.7p1/kexgen.c.fips3 openssh-8.7p1/kexgen.c
|
|||
+ } else {
|
||||
+ r = kex_kem_sntrup761x25519_dec(kex, server_blob,
|
||||
+ &shared_secret);
|
||||
+ }
|
||||
break;
|
||||
case KEX_KEM_MLKEM768X25519_SHA256:
|
||||
- r = kex_kem_mlkem768x25519_dec(kex, server_blob,
|
||||
- &shared_secret);
|
||||
+ if (FIPS_mode()) {
|
||||
+ logit_f("Key exchange type mlkem768x25519 is not allowed in FIPS mode");
|
||||
+ r = SSH_ERR_INVALID_ARGUMENT;
|
||||
+ } else {
|
||||
+ r = kex_kem_mlkem768x25519_dec(kex, server_blob,
|
||||
+ &shared_secret);
|
||||
+ }
|
||||
break;
|
||||
default:
|
||||
r = SSH_ERR_INVALID_ARGUMENT;
|
||||
@@ -285,12 +306,22 @@ input_kex_gen_init(int type, u_int32_t s
|
||||
@@ -312,16 +343,31 @@ input_kex_gen_init(int type, u_int32_t s
|
||||
break;
|
||||
#endif
|
||||
case KEX_C25519_SHA256:
|
||||
|
|
@ -676,6 +696,17 @@ diff -up openssh-8.7p1/kexgen.c.fips3 openssh-8.7p1/kexgen.c
|
|||
+ } else {
|
||||
+ r = kex_kem_sntrup761x25519_enc(kex, client_pubkey,
|
||||
+ &server_pubkey, &shared_secret);
|
||||
+ }
|
||||
break;
|
||||
case KEX_KEM_MLKEM768X25519_SHA256:
|
||||
- r = kex_kem_mlkem768x25519_enc(kex, client_pubkey,
|
||||
- &server_pubkey, &shared_secret);
|
||||
+ if (FIPS_mode()) {
|
||||
+ logit_f("Key exchange type mlkem768x25519 is not allowed in FIPS mode");
|
||||
+ r = SSH_ERR_INVALID_ARGUMENT;
|
||||
+ } else {
|
||||
+ r = kex_kem_mlkem768x25519_enc(kex, client_pubkey,
|
||||
+ &server_pubkey, &shared_secret);
|
||||
+ }
|
||||
break;
|
||||
default:
|
||||
|
|
@ -713,3 +744,23 @@ diff -up openssh-8.7p1/ssh-ed25519.c.fips3 openssh-8.7p1/ssh-ed25519.c
|
|||
|
||||
if ((b = sshbuf_from(sig, siglen)) == NULL)
|
||||
return SSH_ERR_ALLOC_FAIL;
|
||||
diff -up openssh-9.9p1/kex.c.xxx openssh-9.9p1/kex.c
|
||||
--- openssh-9.9p1/kex.c.xxx 2024-10-11 12:44:08.087426597 +0200
|
||||
+++ openssh-9.9p1/kex.c 2024-10-11 14:00:10.404714521 +0200
|
||||
@@ -40,6 +40,7 @@
|
||||
#ifdef WITH_OPENSSL
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/dh.h>
|
||||
+#include <openssl/fips.h>
|
||||
# ifdef HAVE_EVP_KDF_CTX_NEW
|
||||
# include <openssl/kdf.h>
|
||||
# include <openssl/param_build.h>
|
||||
@@ -109,7 +110,7 @@ kex_proposal_populate_entries(struct ssh
|
||||
|
||||
/* Append EXT_INFO signalling to KexAlgorithms */
|
||||
if (kexalgos == NULL)
|
||||
- kexalgos = defprop[PROPOSAL_KEX_ALGS];
|
||||
+ kexalgos = FIPS_mode() ? KEX_DEFAULT_KEX_FIPS : defprop[PROPOSAL_KEX_ALGS];
|
||||
if ((cp = kex_names_cat(kexalgos, ssh->kex->server ?
|
||||
"ext-info-s,kex-strict-s-v00@openssh.com" :
|
||||
"ext-info-c,kex-strict-c-v00@openssh.com")) == NULL)
|
||||
|
|
|
|||
|
|
@ -166,8 +166,8 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x
|
|||
+.Pp
|
||||
Specifies the permitted KEX (Key Exchange) algorithms that will be used and
|
||||
their preference order.
|
||||
The selected algorithm will the the first algorithm in this list that
|
||||
@@ -1338,28 +1343,17 @@ Multiple algorithms must be comma-separa
|
||||
The selected algorithm will be the first algorithm in this list that
|
||||
@@ -1338,29 +1343,17 @@ Multiple algorithms must be comma-separa
|
||||
.Pp
|
||||
If the specified list begins with a
|
||||
.Sq +
|
||||
|
|
@ -187,7 +187,8 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x
|
|||
-.Pp
|
||||
-The default is:
|
||||
-.Bd -literal -offset indent
|
||||
-sntrup761x25519-sha512@openssh.com,
|
||||
-sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,
|
||||
-mlkem768x25519-sha256,
|
||||
-curve25519-sha256,curve25519-sha256@libssh.org,
|
||||
-ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
|
||||
-diffie-hellman-group-exchange-sha256,
|
||||
|
|
@ -517,13 +518,14 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x
|
|||
.Pp
|
||||
The supported algorithms are:
|
||||
.Pp
|
||||
@@ -1075,16 +1080,6 @@ ecdh-sha2-nistp521
|
||||
@@ -1075,17 +1080,6 @@ ecdh-sha2-nistp521
|
||||
sntrup761x25519-sha512@openssh.com
|
||||
.El
|
||||
.Pp
|
||||
-The default is:
|
||||
-.Bd -literal -offset indent
|
||||
-sntrup761x25519-sha512@openssh.com,
|
||||
-sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,
|
||||
-mlkem768x25519-sha256,
|
||||
-curve25519-sha256,curve25519-sha256@libssh.org,
|
||||
-ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
|
||||
-diffie-hellman-group-exchange-sha256,
|
||||
|
|
|
|||
|
|
@ -964,7 +964,7 @@ diff -up openssh-9.6p1/ssh-add.c.pkcs11-uri openssh-9.6p1/ssh-add.c
|
|||
diff -up openssh-9.6p1/ssh-agent.c.pkcs11-uri openssh-9.6p1/ssh-agent.c
|
||||
--- openssh-9.6p1/ssh-agent.c.pkcs11-uri 2023-12-18 15:59:50.000000000 +0100
|
||||
+++ openssh-9.6p1/ssh-agent.c 2024-01-12 14:25:25.234942360 +0100
|
||||
@@ -1549,10 +1549,72 @@ add_p11_identity(struct sshkey *key, cha
|
||||
@@ -1549,10 +1549,74 @@ add_p11_identity(struct sshkey *key, cha
|
||||
idtab->nentries++;
|
||||
}
|
||||
|
||||
|
|
@ -978,6 +978,8 @@ diff -up openssh-9.6p1/ssh-agent.c.pkcs11-uri openssh-9.6p1/ssh-agent.c
|
|||
+ if (provider == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ memset(canonical_provider, 0, sizeof(canonical_provider));
|
||||
+
|
||||
+ if (strlen(provider) >= strlen(PKCS11_URI_SCHEME) &&
|
||||
+ strncmp(provider, PKCS11_URI_SCHEME,
|
||||
+ strlen(PKCS11_URI_SCHEME)) == 0) {
|
||||
|
|
@ -1351,9 +1353,17 @@ diff -up openssh-9.6p1/ssh-pkcs11-client.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11-c
|
|||
for (i = 0; i < nkeys; i++) {
|
||||
/* XXX clean up properly instead of fatal() */
|
||||
if ((r = sshbuf_get_string(msg, &blob, &blen)) != 0 ||
|
||||
diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
||||
--- openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri 2023-12-18 15:59:50.000000000 +0100
|
||||
+++ openssh-9.6p1/ssh-pkcs11.c 2024-01-12 14:28:09.170975480 +0100
|
||||
diff -up openssh-9.9p1/ssh-pkcs11.c.xxx openssh-9.9p1/ssh-pkcs11.c
|
||||
--- openssh-9.9p1/ssh-pkcs11.c.xxx 2024-10-09 11:56:35.890126144 +0200
|
||||
+++ openssh-9.9p1/ssh-pkcs11.c 2024-10-09 11:56:48.528459585 +0200
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/err.h>
|
||||
+#include <openssl/evp.h>
|
||||
|
||||
#define CRYPTOKI_COMPAT
|
||||
#include "pkcs11.h"
|
||||
@@ -55,8 +55,8 @@ struct pkcs11_slotinfo {
|
||||
int logged_in;
|
||||
};
|
||||
|
|
@ -1554,7 +1564,7 @@ diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
|||
}
|
||||
|
||||
static RSA_METHOD *rsa_method;
|
||||
@@ -195,6 +286,56 @@ static EC_KEY_METHOD *ec_key_method;
|
||||
@@ -195,6 +286,60 @@ static EC_KEY_METHOD *ec_key_method;
|
||||
static int ec_key_idx = 0;
|
||||
#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
|
||||
|
||||
|
|
@ -1571,13 +1581,17 @@ diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
|||
+
|
||||
+ /* sanity - is it a RSA key with associated app_data? */
|
||||
+ switch (key->type) {
|
||||
+ case KEY_RSA:
|
||||
+ k11 = RSA_get_ex_data(key->rsa, rsa_idx);
|
||||
+ case KEY_RSA: {
|
||||
+ const RSA *rsa = EVP_PKEY_get0_RSA(key->pkey);
|
||||
+ k11 = RSA_get_ex_data(rsa, rsa_idx);
|
||||
+ break;
|
||||
+ }
|
||||
+#ifdef HAVE_EC_KEY_METHOD_NEW
|
||||
+ case KEY_ECDSA:
|
||||
+ k11 = EC_KEY_get_ex_data(key->ecdsa, ec_key_idx);
|
||||
+ case KEY_ECDSA: {
|
||||
+ const EC_KEY * ecdsa = EVP_PKEY_get0_EC_KEY(key->pkey);
|
||||
+ k11 = EC_KEY_get_ex_data(ecdsa, ec_key_idx);
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
+ default:
|
||||
+ error("Unknown key type %d", key->type);
|
||||
|
|
@ -1731,9 +1745,9 @@ diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
|||
+ k11->label[label_attrib->ulValueLen] = 0;
|
||||
+ }
|
||||
+
|
||||
RSA_set_method(rsa, rsa_method);
|
||||
RSA_set_ex_data(rsa, rsa_idx, k11);
|
||||
return (0);
|
||||
if (RSA_set_method(rsa, rsa_method) != 1)
|
||||
fatal_f("RSA_set_method failed");
|
||||
if (RSA_set_ex_data(rsa, rsa_idx, k11) != 1)
|
||||
@@ -532,8 +683,8 @@ ecdsa_do_sign(const unsigned char *dgst,
|
||||
return (NULL);
|
||||
}
|
||||
|
|
@ -1764,9 +1778,9 @@ diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
|||
+ k11->label[label_attrib->ulValueLen] = 0;
|
||||
+ }
|
||||
+
|
||||
EC_KEY_set_method(ec, ec_key_method);
|
||||
EC_KEY_set_ex_data(ec, ec_key_idx, k11);
|
||||
|
||||
if (EC_KEY_set_method(ec, ec_key_method) != 1)
|
||||
fatal_f("EC_KEY_set_method failed");
|
||||
if (EC_KEY_set_ex_data(ec, ec_key_idx, k11) != 1)
|
||||
@@ -622,7 +779,8 @@ pkcs11_ecdsa_wrap(struct pkcs11_provider
|
||||
}
|
||||
#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
|
||||
|
|
@ -1893,7 +1907,7 @@ diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
|||
|
||||
key = sshkey_new(KEY_UNSPEC);
|
||||
@@ -810,7 +970,7 @@ pkcs11_fetch_ecdsa_pubkey(struct pkcs11_
|
||||
ec = NULL; /* now owned by key */
|
||||
key->flags |= SSHKEY_FLAG_EXT;
|
||||
|
||||
fail:
|
||||
- for (i = 0; i < 3; i++)
|
||||
|
|
@ -1977,7 +1991,7 @@ diff -up openssh-9.6p1/ssh-pkcs11.c.pkcs11-uri openssh-9.6p1/ssh-pkcs11.c
|
|||
|
||||
key = sshkey_new(KEY_UNSPEC);
|
||||
@@ -905,7 +1067,7 @@ pkcs11_fetch_rsa_pubkey(struct pkcs11_pr
|
||||
rsa = NULL; /* now owned by key */
|
||||
key->flags |= SSHKEY_FLAG_EXT;
|
||||
|
||||
fail:
|
||||
- for (i = 0; i < 3; i++)
|
||||
|
|
|
|||
|
|
@ -1,106 +0,0 @@
|
|||
diff --color -ruNp a/audit-linux.c b/audit-linux.c
|
||||
--- a/audit-linux.c 2024-05-09 12:38:08.843017319 +0200
|
||||
+++ b/audit-linux.c 2024-05-09 12:47:05.162267634 +0200
|
||||
@@ -52,7 +52,7 @@ extern u_int utmp_len;
|
||||
const char *audit_username(void);
|
||||
|
||||
static void
|
||||
-linux_audit_user_logxxx(int uid, const char *username,
|
||||
+linux_audit_user_logxxx(int uid, const char *username, const char *hostname,
|
||||
const char *ip, const char *ttyn, int success, int event)
|
||||
{
|
||||
int audit_fd, rc, saved_errno;
|
||||
@@ -66,7 +66,7 @@ linux_audit_user_logxxx(int uid, const c
|
||||
}
|
||||
rc = audit_log_acct_message(audit_fd, event,
|
||||
NULL, "login", username ? username : "(unknown)",
|
||||
- username == NULL ? uid : -1, NULL, ip, ttyn, success);
|
||||
+ username == NULL ? uid : -1, hostname, ip, ttyn, success);
|
||||
saved_errno = errno;
|
||||
close(audit_fd);
|
||||
|
||||
@@ -181,9 +181,11 @@ audit_run_command(struct ssh *ssh, const
|
||||
{
|
||||
if (!user_login_count++)
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_LOGIN);
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_START);
|
||||
return 0;
|
||||
@@ -193,10 +195,12 @@ void
|
||||
audit_end_command(struct ssh *ssh, int handle, const char *command)
|
||||
{
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_END);
|
||||
if (user_login_count && !--user_login_count)
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_LOGOUT);
|
||||
}
|
||||
@@ -211,19 +215,27 @@ void
|
||||
audit_session_open(struct logininfo *li)
|
||||
{
|
||||
if (!user_login_count++)
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_LOGIN);
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_START);
|
||||
}
|
||||
|
||||
void
|
||||
audit_session_close(struct logininfo *li)
|
||||
{
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_END);
|
||||
if (user_login_count && !--user_login_count)
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_LOGOUT);
|
||||
}
|
||||
|
||||
@@ -236,6 +248,7 @@ audit_event(struct ssh *ssh, ssh_audit_e
|
||||
linux_audit_user_auth(-1, audit_username(),
|
||||
ssh_remote_ipaddr(ssh), "ssh", 0, event);
|
||||
linux_audit_user_logxxx(-1, audit_username(),
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh), "ssh", 0, AUDIT_USER_LOGIN);
|
||||
break;
|
||||
case SSH_AUTH_FAIL_PASSWD:
|
||||
@@ -254,9 +267,11 @@ audit_event(struct ssh *ssh, ssh_audit_e
|
||||
if (user_login_count) {
|
||||
while (user_login_count--)
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_END);
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_LOGOUT);
|
||||
}
|
||||
@@ -265,6 +280,7 @@ audit_event(struct ssh *ssh, ssh_audit_e
|
||||
case SSH_CONNECTION_ABANDON:
|
||||
case SSH_INVALID_USER:
|
||||
linux_audit_user_logxxx(-1, audit_username(),
|
||||
+ options.use_dns ? remote_hostname(ssh) : NULL,
|
||||
ssh_remote_ipaddr(ssh), "ssh", 0, AUDIT_USER_LOGIN);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -94,47 +94,6 @@ diff -up openssh-8.7p1/monitor.c.sshrsacheck openssh-8.7p1/monitor.c
|
|||
is_proof ? "hostkey proof" : "KEX", siglen);
|
||||
|
||||
sshbuf_reset(m);
|
||||
diff -up openssh-8.7p1/regress/cert-userkey.sh.sshrsacheck openssh-8.7p1/regress/cert-userkey.sh
|
||||
--- openssh-8.7p1/regress/cert-userkey.sh.sshrsacheck 2023-01-25 14:26:52.885963113 +0100
|
||||
+++ openssh-8.7p1/regress/cert-userkey.sh 2023-01-25 14:27:25.757219800 +0100
|
||||
@@ -7,7 +7,8 @@ rm -f $OBJ/authorized_keys_$USER $OBJ/us
|
||||
cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
|
||||
cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak
|
||||
|
||||
-PLAIN_TYPES=`$SSH -Q key-plain | maybe_filter_sk | sed 's/^ssh-dss/ssh-dsa/;s/^ssh-//'`
|
||||
+#ssh-dss keys are incompatible with DEFAULT crypto policy
|
||||
+PLAIN_TYPES=`$SSH -Q key-plain | maybe_filter_sk | grep -v 'ssh-dss' | sed 's/^ssh-dss/ssh-dsa/;s/^ssh-//'`
|
||||
EXTRA_TYPES=""
|
||||
rsa=""
|
||||
|
||||
diff -up openssh-8.7p1/regress/Makefile.sshrsacheck openssh-8.7p1/regress/Makefile
|
||||
--- openssh-8.7p1/regress/Makefile.sshrsacheck 2023-01-20 13:07:54.169676051 +0100
|
||||
+++ openssh-8.7p1/regress/Makefile 2023-01-20 13:07:54.290677074 +0100
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
tests: prep file-tests t-exec unit
|
||||
|
||||
-REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
|
||||
+#ssh-dss tests will not pass on DEFAULT crypto-policy because of SHA1, skipping
|
||||
+REGRESS_TARGETS= t1 t2 t3 t4 t5 t7 t8 t9 t10 t11 t12
|
||||
|
||||
# File based tests
|
||||
file-tests: $(REGRESS_TARGETS)
|
||||
diff -up openssh-8.7p1/regress/test-exec.sh.sshrsacheck openssh-8.7p1/regress/test-exec.sh
|
||||
--- openssh-8.7p1/regress/test-exec.sh.sshrsacheck 2023-01-25 14:24:54.778040819 +0100
|
||||
+++ openssh-8.7p1/regress/test-exec.sh 2023-01-25 14:26:39.500858590 +0100
|
||||
@@ -581,8 +581,9 @@ maybe_filter_sk() {
|
||||
fi
|
||||
}
|
||||
|
||||
-SSH_KEYTYPES=`$SSH -Q key-plain | maybe_filter_sk`
|
||||
-SSH_HOSTKEY_TYPES=`$SSH -Q key-plain | maybe_filter_sk`
|
||||
+#ssh-dss keys are incompatible with DEFAULT crypto policy
|
||||
+SSH_KEYTYPES=`$SSH -Q key-plain | maybe_filter_sk | grep -v 'ssh-dss'`
|
||||
+SSH_HOSTKEY_TYPES=`$SSH -Q key-plain | maybe_filter_sk | grep -v 'ssh-dss'`
|
||||
|
||||
for t in ${SSH_KEYTYPES}; do
|
||||
# generate user key
|
||||
diff -up openssh-8.7p1/regress/unittests/kex/test_kex.c.sshrsacheck openssh-8.7p1/regress/unittests/kex/test_kex.c
|
||||
--- openssh-8.7p1/regress/unittests/kex/test_kex.c.sshrsacheck 2023-01-26 13:34:52.645743677 +0100
|
||||
+++ openssh-8.7p1/regress/unittests/kex/test_kex.c 2023-01-26 13:36:56.220745823 +0100
|
||||
|
|
|
|||
|
|
@ -52,9 +52,27 @@ diff -up openssh-9.0p1/audit.h.patch openssh-9.0p1/audit.h
|
|||
void audit_key(struct ssh *, int, int *, const struct sshkey *);
|
||||
void audit_unsupported(struct ssh *, int);
|
||||
void audit_kex(struct ssh *, int, char *, char *, char *, char *);
|
||||
diff -up openssh-9.0p1/audit-linux.c.patch openssh-9.0p1/audit-linux.c
|
||||
--- openssh-9.0p1/audit-linux.c.patch 2022-10-24 15:02:16.544858331 +0200
|
||||
+++ openssh-9.0p1/audit-linux.c 2022-10-24 15:21:58.165303951 +0200
|
||||
diff -up openssh-9.9p1/audit-linux.c.xxx openssh-9.9p1/audit-linux.c
|
||||
--- openssh-9.9p1/audit-linux.c.xxx 2024-10-15 11:49:48.092151974 +0200
|
||||
+++ openssh-9.9p1/audit-linux.c 2024-10-15 12:08:17.179158343 +0200
|
||||
@@ -52,7 +52,7 @@ extern u_int utmp_len;
|
||||
const char *audit_username(void);
|
||||
|
||||
static void
|
||||
-linux_audit_user_logxxx(int uid, const char *username,
|
||||
+linux_audit_user_logxxx(int uid, const char *username, const char *hostname,
|
||||
const char *ip, const char *ttyn, int success, int event)
|
||||
{
|
||||
int audit_fd, rc, saved_errno;
|
||||
@@ -66,7 +66,7 @@ linux_audit_user_logxxx(int uid, const c
|
||||
}
|
||||
rc = audit_log_acct_message(audit_fd, event,
|
||||
NULL, "login", username ? username : "(unknown)",
|
||||
- username == NULL ? uid : -1, NULL, ip, ttyn, success);
|
||||
+ username == NULL ? uid : -1, hostname, ip, ttyn, success);
|
||||
saved_errno = errno;
|
||||
close(audit_fd);
|
||||
|
||||
@@ -137,10 +137,12 @@ fatal_report:
|
||||
}
|
||||
|
||||
|
|
@ -117,3 +135,112 @@ diff -up openssh-9.0p1/audit-linux.c.patch openssh-9.0p1/audit-linux.c
|
|||
out:
|
||||
saved_errno = errno;
|
||||
audit_close(audit_fd);
|
||||
@@ -179,26 +211,34 @@ audit_connection_from(const char *host,
|
||||
int
|
||||
audit_run_command(struct ssh *ssh, const char *command)
|
||||
{
|
||||
+ char * audit_hostname = options.use_dns ? remote_hostname(ssh) : NULL;
|
||||
if (!user_login_count++)
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_LOGIN);
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_START);
|
||||
+ free(audit_hostname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
audit_end_command(struct ssh *ssh, int handle, const char *command)
|
||||
{
|
||||
+ char * audit_hostname = options.use_dns ? remote_hostname(ssh) : NULL;
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_END);
|
||||
if (user_login_count && !--user_login_count)
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_LOGOUT);
|
||||
+ free(audit_hostname);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -211,31 +251,41 @@ void
|
||||
audit_session_open(struct logininfo *li)
|
||||
{
|
||||
if (!user_login_count++)
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_LOGIN);
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_START);
|
||||
}
|
||||
|
||||
void
|
||||
audit_session_close(struct logininfo *li)
|
||||
{
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_END);
|
||||
if (user_login_count && !--user_login_count)
|
||||
- linux_audit_user_logxxx(li->uid, NULL, li->hostname,
|
||||
+ linux_audit_user_logxxx(li->uid, NULL,
|
||||
+ options.use_dns ? li->hostname : NULL,
|
||||
+ options.use_dns ? NULL : li->hostname,
|
||||
li->line, 1, AUDIT_USER_LOGOUT);
|
||||
}
|
||||
|
||||
void
|
||||
audit_event(struct ssh *ssh, ssh_audit_event_t event)
|
||||
{
|
||||
+ char * audit_hostname = options.use_dns ? remote_hostname(ssh) : NULL;
|
||||
+
|
||||
switch(event) {
|
||||
case SSH_NOLOGIN:
|
||||
case SSH_LOGIN_ROOT_DENIED:
|
||||
linux_audit_user_auth(-1, audit_username(),
|
||||
ssh_remote_ipaddr(ssh), "ssh", 0, event);
|
||||
- linux_audit_user_logxxx(-1, audit_username(),
|
||||
+ linux_audit_user_logxxx(-1, audit_username(), audit_hostname,
|
||||
ssh_remote_ipaddr(ssh), "ssh", 0, AUDIT_USER_LOGIN);
|
||||
break;
|
||||
case SSH_AUTH_FAIL_PASSWD:
|
||||
@@ -255,9 +305,11 @@ audit_event(struct ssh *ssh, ssh_audit_e
|
||||
if (user_login_count) {
|
||||
while (user_login_count--)
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_END);
|
||||
linux_audit_user_logxxx(the_authctxt->pw->pw_uid, NULL,
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh),
|
||||
"ssh", 1, AUDIT_USER_LOGOUT);
|
||||
}
|
||||
@@ -266,12 +318,14 @@ audit_event(struct ssh *ssh, ssh_audit_e
|
||||
case SSH_CONNECTION_ABANDON:
|
||||
case SSH_INVALID_USER:
|
||||
linux_audit_user_logxxx(-1, audit_username(),
|
||||
+ audit_hostname,
|
||||
ssh_remote_ipaddr(ssh), "ssh", 0, AUDIT_USER_LOGIN);
|
||||
break;
|
||||
default:
|
||||
debug("%s: unhandled event %d", __func__, event);
|
||||
break;
|
||||
}
|
||||
+ free(audit_hostname);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,207 +0,0 @@
|
|||
diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac ../openssh-8.7p1/kexecdh.c ./kexecdh.c
|
||||
--- ../openssh-8.7p1/kexecdh.c 2021-08-20 06:03:49.000000000 +0200
|
||||
+++ ./kexecdh.c 2023-04-13 14:30:14.882449593 +0200
|
||||
@@ -35,17 +35,57 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include <openssl/ecdh.h>
|
||||
+#include <openssl/evp.h>
|
||||
+#include <openssl/core_names.h>
|
||||
+#include <openssl/param_build.h>
|
||||
+#include <openssl/err.h>
|
||||
|
||||
#include "sshkey.h"
|
||||
#include "kex.h"
|
||||
#include "sshbuf.h"
|
||||
#include "digest.h"
|
||||
#include "ssherr.h"
|
||||
+#include "log.h"
|
||||
|
||||
static int
|
||||
kex_ecdh_dec_key_group(struct kex *, const struct sshbuf *, EC_KEY *key,
|
||||
const EC_GROUP *, struct sshbuf **);
|
||||
|
||||
+static EC_KEY *
|
||||
+generate_ec_keys(int ec_nid)
|
||||
+{
|
||||
+ EC_KEY *client_key = NULL;
|
||||
+ EVP_PKEY *pkey = NULL;
|
||||
+ EVP_PKEY_CTX *ctx = NULL;
|
||||
+ OSSL_PARAM_BLD *param_bld = NULL;
|
||||
+ OSSL_PARAM *params = NULL;
|
||||
+ const char *group_name;
|
||||
+
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL)) == NULL ||
|
||||
+ (param_bld = OSSL_PARAM_BLD_new()) == NULL)
|
||||
+ goto out;
|
||||
+ if ((group_name = OSSL_EC_curve_nid2name(ec_nid)) == NULL ||
|
||||
+ OSSL_PARAM_BLD_push_utf8_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_GROUP_NAME, group_name, 0) != 1 ||
|
||||
+ (params = OSSL_PARAM_BLD_to_param(param_bld)) == NULL) {
|
||||
+ error_f("Could not create OSSL_PARAM");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (EVP_PKEY_keygen_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_CTX_set_params(ctx, params) != 1 ||
|
||||
+ EVP_PKEY_generate(ctx, &pkey) != 1 ||
|
||||
+ (client_key = EVP_PKEY_get1_EC_KEY(pkey)) == NULL) {
|
||||
+ error_f("Could not generate ec keys");
|
||||
+ goto out;
|
||||
+ }
|
||||
+out:
|
||||
+ EVP_PKEY_free(pkey);
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ OSSL_PARAM_BLD_free(param_bld);
|
||||
+ OSSL_PARAM_free(params);
|
||||
+ return client_key;
|
||||
+}
|
||||
+
|
||||
int
|
||||
kex_ecdh_keypair(struct kex *kex)
|
||||
{
|
||||
@@ -55,11 +95,7 @@
|
||||
struct sshbuf *buf = NULL;
|
||||
int r;
|
||||
|
||||
- if ((client_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) {
|
||||
- r = SSH_ERR_ALLOC_FAIL;
|
||||
- goto out;
|
||||
- }
|
||||
- if (EC_KEY_generate_key(client_key) != 1) {
|
||||
+ if ((client_key = generate_ec_keys(kex->ec_nid)) == NULL) {
|
||||
r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@@ -101,11 +137,7 @@
|
||||
*server_blobp = NULL;
|
||||
*shared_secretp = NULL;
|
||||
|
||||
- if ((server_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) {
|
||||
- r = SSH_ERR_ALLOC_FAIL;
|
||||
- goto out;
|
||||
- }
|
||||
- if (EC_KEY_generate_key(server_key) != 1) {
|
||||
+ if ((server_key = generate_ec_keys(kex->ec_nid)) == NULL) {
|
||||
r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@@ -140,11 +172,21 @@
|
||||
{
|
||||
struct sshbuf *buf = NULL;
|
||||
BIGNUM *shared_secret = NULL;
|
||||
- EC_POINT *dh_pub = NULL;
|
||||
- u_char *kbuf = NULL;
|
||||
- size_t klen = 0;
|
||||
+ EVP_PKEY_CTX *ctx = NULL;
|
||||
+ EVP_PKEY *pkey = NULL, *dh_pkey = NULL;
|
||||
+ OSSL_PARAM_BLD *param_bld = NULL;
|
||||
+ OSSL_PARAM *params = NULL;
|
||||
+ u_char *kbuf = NULL, *pub = NULL;
|
||||
+ size_t klen = 0, publen;
|
||||
+ const char *group_name;
|
||||
int r;
|
||||
|
||||
+ /* import EC_KEY to EVP_PKEY */
|
||||
+ if ((r = ssh_create_evp_ec(key, kex->ec_nid, &pkey)) != 0) {
|
||||
+ error_f("Could not create EVP_PKEY");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
*shared_secretp = NULL;
|
||||
|
||||
if ((buf = sshbuf_new()) == NULL) {
|
||||
@@ -153,45 +195,82 @@
|
||||
}
|
||||
if ((r = sshbuf_put_stringb(buf, ec_blob)) != 0)
|
||||
goto out;
|
||||
- if ((dh_pub = EC_POINT_new(group)) == NULL) {
|
||||
+
|
||||
+ /* the public key is in the buffer in octet string UNCOMPRESSED
|
||||
+ * format. See sshbuf_put_ec */
|
||||
+ if ((r = sshbuf_get_string(buf, &pub, &publen)) != 0)
|
||||
+ goto out;
|
||||
+ sshbuf_reset(buf);
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL)) == NULL ||
|
||||
+ (param_bld = OSSL_PARAM_BLD_new()) == NULL) {
|
||||
r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
- if ((r = sshbuf_get_ec(buf, dh_pub, group)) != 0) {
|
||||
+ if ((group_name = OSSL_EC_curve_nid2name(kex->ec_nid)) == NULL) {
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (OSSL_PARAM_BLD_push_octet_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_PUB_KEY, pub, publen) != 1 ||
|
||||
+ OSSL_PARAM_BLD_push_utf8_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_GROUP_NAME, group_name, 0) != 1 ||
|
||||
+ (params = OSSL_PARAM_BLD_to_param(param_bld)) == NULL) {
|
||||
+ error_f("Failed to set params for dh_pkey");
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (EVP_PKEY_fromdata_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_fromdata(ctx, &dh_pkey,
|
||||
+ EVP_PKEY_PUBLIC_KEY, params) != 1 ||
|
||||
+ EVP_PKEY_public_check(ctx) != 1) {
|
||||
+ error_f("Peer public key import failed");
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
- sshbuf_reset(buf);
|
||||
|
||||
#ifdef DEBUG_KEXECDH
|
||||
fputs("public key:\n", stderr);
|
||||
- sshkey_dump_ec_point(group, dh_pub);
|
||||
+ EVP_PKEY_print_public_fp(stderr, dh_pkey, 0, NULL);
|
||||
#endif
|
||||
- if (sshkey_ec_validate_public(group, dh_pub) != 0) {
|
||||
- r = SSH_ERR_MESSAGE_INCOMPLETE;
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ ctx = NULL;
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL)) == NULL ||
|
||||
+ EVP_PKEY_derive_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_derive_set_peer(ctx, dh_pkey) != 1 ||
|
||||
+ EVP_PKEY_derive(ctx, NULL, &klen) != 1) {
|
||||
+ error_f("Failed to get derive information");
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
- klen = (EC_GROUP_get_degree(group) + 7) / 8;
|
||||
- if ((kbuf = malloc(klen)) == NULL ||
|
||||
- (shared_secret = BN_new()) == NULL) {
|
||||
+ if ((kbuf = malloc(klen)) == NULL) {
|
||||
r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
- if (ECDH_compute_key(kbuf, klen, dh_pub, key, NULL) != (int)klen ||
|
||||
- BN_bin2bn(kbuf, klen, shared_secret) == NULL) {
|
||||
+ if (EVP_PKEY_derive(ctx, kbuf, &klen) != 1) {
|
||||
r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
#ifdef DEBUG_KEXECDH
|
||||
dump_digest("shared secret", kbuf, klen);
|
||||
#endif
|
||||
+ if ((shared_secret = BN_new()) == NULL ||
|
||||
+ (BN_bin2bn(kbuf, klen, shared_secret) == NULL)) {
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
+ goto out;
|
||||
+ }
|
||||
if ((r = sshbuf_put_bignum2(buf, shared_secret)) != 0)
|
||||
goto out;
|
||||
*shared_secretp = buf;
|
||||
buf = NULL;
|
||||
out:
|
||||
- EC_POINT_clear_free(dh_pub);
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ EVP_PKEY_free(pkey);
|
||||
+ EVP_PKEY_free(dh_pkey);
|
||||
+ OSSL_PARAM_BLD_free(param_bld);
|
||||
+ OSSL_PARAM_free(params);
|
||||
BN_clear_free(shared_secret);
|
||||
freezero(kbuf, klen);
|
||||
+ freezero(pub, publen);
|
||||
sshbuf_free(buf);
|
||||
return r;
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x
|
|||
diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac openssh-9.0p1/kex.c openssh-9.0p1-patched/kex.c
|
||||
--- openssh-9.0p1/kex.c 2023-05-25 09:24:28.731868327 +0200
|
||||
+++ openssh-9.0p1-patched/kex.c 2023-05-25 09:23:44.841379532 +0200
|
||||
@@ -1623,3 +1623,47 @@
|
||||
@@ -1623,3 +1623,142 @@
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +137,101 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x
|
|||
+ * Creates an EVP_PKEY from the given parameters and keys.
|
||||
+ * The private key can be omitted.
|
||||
+ */
|
||||
+EVP_PKEY *
|
||||
+sshkey_create_evp(OSSL_PARAM_BLD *param_bld, EVP_PKEY_CTX *ctx)
|
||||
+{
|
||||
+ EVP_PKEY *ret = NULL;
|
||||
+ OSSL_PARAM *params = NULL;
|
||||
+ if (param_bld == NULL || ctx == NULL) {
|
||||
+ debug2_f("param_bld or ctx is NULL");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if ((params = OSSL_PARAM_BLD_to_param(param_bld)) == NULL) {
|
||||
+ debug2_f("Could not build param list");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (EVP_PKEY_fromdata_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_fromdata(ctx, &ret, EVP_PKEY_KEYPAIR, params) != 1) {
|
||||
+ debug2_f("EVP_PKEY_fromdata failed");
|
||||
+ OSSL_PARAM_free(params);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+kex_create_evp_ec(EC_KEY *k, int ecdsa_nid, EVP_PKEY **pkey)
|
||||
+{
|
||||
+ OSSL_PARAM_BLD *param_bld = NULL;
|
||||
+ EVP_PKEY_CTX *ctx = NULL;
|
||||
+ BN_CTX *bn_ctx = NULL;
|
||||
+ uint8_t *pub_ser = NULL;
|
||||
+ const char *group_name;
|
||||
+ const EC_POINT *pub = NULL;
|
||||
+ const BIGNUM *priv = NULL;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (k == NULL)
|
||||
+ return SSH_ERR_INVALID_ARGUMENT;
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL)) == NULL ||
|
||||
+ (param_bld = OSSL_PARAM_BLD_new()) == NULL ||
|
||||
+ (bn_ctx = BN_CTX_new()) == NULL) {
|
||||
+ ret = SSH_ERR_ALLOC_FAIL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if ((group_name = OSSL_EC_curve_nid2name(ecdsa_nid)) == NULL ||
|
||||
+ OSSL_PARAM_BLD_push_utf8_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_GROUP_NAME,
|
||||
+ group_name,
|
||||
+ strlen(group_name)) != 1) {
|
||||
+ ret = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if ((pub = EC_KEY_get0_public_key(k)) != NULL) {
|
||||
+ const EC_GROUP *group;
|
||||
+ size_t len;
|
||||
+
|
||||
+ group = EC_KEY_get0_group(k);
|
||||
+ len = EC_POINT_point2oct(group, pub,
|
||||
+ POINT_CONVERSION_UNCOMPRESSED, NULL, 0, NULL);
|
||||
+ if ((pub_ser = malloc(len)) == NULL) {
|
||||
+ ret = SSH_ERR_ALLOC_FAIL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ EC_POINT_point2oct(group,
|
||||
+ pub,
|
||||
+ POINT_CONVERSION_UNCOMPRESSED,
|
||||
+ pub_ser,
|
||||
+ len,
|
||||
+ bn_ctx);
|
||||
+ if (OSSL_PARAM_BLD_push_octet_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_PUB_KEY,
|
||||
+ pub_ser,
|
||||
+ len) != 1) {
|
||||
+ ret = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+ if ((priv = EC_KEY_get0_private_key(k)) != NULL &&
|
||||
+ OSSL_PARAM_BLD_push_BN(param_bld,
|
||||
+ OSSL_PKEY_PARAM_PRIV_KEY, priv) != 1) {
|
||||
+ ret = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if ((*pkey = sshkey_create_evp(param_bld, ctx)) == NULL) {
|
||||
+ ret = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ OSSL_PARAM_BLD_free(param_bld);
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ BN_CTX_free(bn_ctx);
|
||||
+ free(pub_ser);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+kex_create_evp_dh(EVP_PKEY **pkey, const BIGNUM *p, const BIGNUM *q,
|
||||
+ const BIGNUM *g, const BIGNUM *pub, const BIGNUM *priv)
|
||||
|
|
@ -281,12 +376,220 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x
|
|||
# ifdef OPENSSL_HAS_ECC
|
||||
# include <openssl/ec.h>
|
||||
# else /* OPENSSL_HAS_ECC */
|
||||
@@ -283,6 +286,8 @@
|
||||
@@ -283,6 +286,9@@
|
||||
const u_char pub[CURVE25519_SIZE], struct sshbuf *out, int)
|
||||
__attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
|
||||
__attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
|
||||
+int kex_create_evp_dh(EVP_PKEY **, const BIGNUM *, const BIGNUM *,
|
||||
+ const BIGNUM *, const BIGNUM *, const BIGNUM *);
|
||||
+int kex_create_evp_ec(EC_KEY *k, int ecdsa_nid, EVP_PKEY **pkey);
|
||||
|
||||
#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH)
|
||||
void dump_digest(const char *, const u_char *, int);
|
||||
diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac ../openssh-8.7p1/kexecdh.c ./kexecdh.c
|
||||
--- ../openssh-8.7p1/kexecdh.c 2021-08-20 06:03:49.000000000 +0200
|
||||
+++ ./kexecdh.c 2023-04-13 14:30:14.882449593 +0200
|
||||
@@ -35,17 +35,57 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include <openssl/ecdh.h>
|
||||
+#include <openssl/evp.h>
|
||||
+#include <openssl/core_names.h>
|
||||
+#include <openssl/param_build.h>
|
||||
+#include <openssl/err.h>
|
||||
|
||||
#include "sshkey.h"
|
||||
#include "kex.h"
|
||||
#include "sshbuf.h"
|
||||
#include "digest.h"
|
||||
#include "ssherr.h"
|
||||
+#include "log.h"
|
||||
|
||||
static int
|
||||
kex_ecdh_dec_key_group(struct kex *, const struct sshbuf *, EC_KEY *key,
|
||||
const EC_GROUP *, struct sshbuf **);
|
||||
|
||||
+static EC_KEY *
|
||||
+generate_ec_keys(int ec_nid)
|
||||
+{
|
||||
+ EC_KEY *client_key = NULL;
|
||||
+ EVP_PKEY *pkey = NULL;
|
||||
+ EVP_PKEY_CTX *ctx = NULL;
|
||||
+ OSSL_PARAM_BLD *param_bld = NULL;
|
||||
+ OSSL_PARAM *params = NULL;
|
||||
+ const char *group_name;
|
||||
+
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL)) == NULL ||
|
||||
+ (param_bld = OSSL_PARAM_BLD_new()) == NULL)
|
||||
+ goto out;
|
||||
+ if ((group_name = OSSL_EC_curve_nid2name(ec_nid)) == NULL ||
|
||||
+ OSSL_PARAM_BLD_push_utf8_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_GROUP_NAME, group_name, 0) != 1 ||
|
||||
+ (params = OSSL_PARAM_BLD_to_param(param_bld)) == NULL) {
|
||||
+ error_f("Could not create OSSL_PARAM");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (EVP_PKEY_keygen_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_CTX_set_params(ctx, params) != 1 ||
|
||||
+ EVP_PKEY_generate(ctx, &pkey) != 1 ||
|
||||
+ (client_key = EVP_PKEY_get1_EC_KEY(pkey)) == NULL) {
|
||||
+ error_f("Could not generate ec keys");
|
||||
+ goto out;
|
||||
+ }
|
||||
+out:
|
||||
+ EVP_PKEY_free(pkey);
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ OSSL_PARAM_BLD_free(param_bld);
|
||||
+ OSSL_PARAM_free(params);
|
||||
+ return client_key;
|
||||
+}
|
||||
+
|
||||
int
|
||||
kex_ecdh_keypair(struct kex *kex)
|
||||
{
|
||||
@@ -55,11 +95,7 @@
|
||||
struct sshbuf *buf = NULL;
|
||||
int r;
|
||||
|
||||
- if ((client_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) {
|
||||
- r = SSH_ERR_ALLOC_FAIL;
|
||||
- goto out;
|
||||
- }
|
||||
- if (EC_KEY_generate_key(client_key) != 1) {
|
||||
+ if ((client_key = generate_ec_keys(kex->ec_nid)) == NULL) {
|
||||
r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@@ -101,11 +137,7 @@
|
||||
*server_blobp = NULL;
|
||||
*shared_secretp = NULL;
|
||||
|
||||
- if ((server_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) {
|
||||
- r = SSH_ERR_ALLOC_FAIL;
|
||||
- goto out;
|
||||
- }
|
||||
- if (EC_KEY_generate_key(server_key) != 1) {
|
||||
+ if ((server_key = generate_ec_keys(kex->ec_nid)) == NULL) {
|
||||
r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@@ -140,11 +172,21 @@
|
||||
{
|
||||
struct sshbuf *buf = NULL;
|
||||
BIGNUM *shared_secret = NULL;
|
||||
- EC_POINT *dh_pub = NULL;
|
||||
- u_char *kbuf = NULL;
|
||||
- size_t klen = 0;
|
||||
+ EVP_PKEY_CTX *ctx = NULL;
|
||||
+ EVP_PKEY *pkey = NULL, *dh_pkey = NULL;
|
||||
+ OSSL_PARAM_BLD *param_bld = NULL;
|
||||
+ OSSL_PARAM *params = NULL;
|
||||
+ u_char *kbuf = NULL, *pub = NULL;
|
||||
+ size_t klen = 0, publen;
|
||||
+ const char *group_name;
|
||||
int r;
|
||||
|
||||
+ /* import EC_KEY to EVP_PKEY */
|
||||
+ if ((r = kex_create_evp_ec(key, kex->ec_nid, &pkey)) != 0) {
|
||||
+ error_f("Could not create EVP_PKEY");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
*shared_secretp = NULL;
|
||||
|
||||
if ((buf = sshbuf_new()) == NULL) {
|
||||
@@ -153,45 +195,82 @@
|
||||
}
|
||||
if ((r = sshbuf_put_stringb(buf, ec_blob)) != 0)
|
||||
goto out;
|
||||
- if ((dh_pub = EC_POINT_new(group)) == NULL) {
|
||||
+
|
||||
+ /* the public key is in the buffer in octet string UNCOMPRESSED
|
||||
+ * format. See sshbuf_put_ec */
|
||||
+ if ((r = sshbuf_get_string(buf, &pub, &publen)) != 0)
|
||||
+ goto out;
|
||||
+ sshbuf_reset(buf);
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL)) == NULL ||
|
||||
+ (param_bld = OSSL_PARAM_BLD_new()) == NULL) {
|
||||
r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
- if ((r = sshbuf_get_ec(buf, dh_pub, group)) != 0) {
|
||||
+ if ((group_name = OSSL_EC_curve_nid2name(kex->ec_nid)) == NULL) {
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (OSSL_PARAM_BLD_push_octet_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_PUB_KEY, pub, publen) != 1 ||
|
||||
+ OSSL_PARAM_BLD_push_utf8_string(param_bld,
|
||||
+ OSSL_PKEY_PARAM_GROUP_NAME, group_name, 0) != 1 ||
|
||||
+ (params = OSSL_PARAM_BLD_to_param(param_bld)) == NULL) {
|
||||
+ error_f("Failed to set params for dh_pkey");
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (EVP_PKEY_fromdata_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_fromdata(ctx, &dh_pkey,
|
||||
+ EVP_PKEY_PUBLIC_KEY, params) != 1 ||
|
||||
+ EVP_PKEY_public_check(ctx) != 1) {
|
||||
+ error_f("Peer public key import failed");
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
- sshbuf_reset(buf);
|
||||
|
||||
#ifdef DEBUG_KEXECDH
|
||||
fputs("public key:\n", stderr);
|
||||
- sshkey_dump_ec_point(group, dh_pub);
|
||||
+ EVP_PKEY_print_public_fp(stderr, dh_pkey, 0, NULL);
|
||||
#endif
|
||||
- if (sshkey_ec_validate_public(group, dh_pub) != 0) {
|
||||
- r = SSH_ERR_MESSAGE_INCOMPLETE;
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ ctx = NULL;
|
||||
+ if ((ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL)) == NULL ||
|
||||
+ EVP_PKEY_derive_init(ctx) != 1 ||
|
||||
+ EVP_PKEY_derive_set_peer(ctx, dh_pkey) != 1 ||
|
||||
+ EVP_PKEY_derive(ctx, NULL, &klen) != 1) {
|
||||
+ error_f("Failed to get derive information");
|
||||
+ r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
- klen = (EC_GROUP_get_degree(group) + 7) / 8;
|
||||
- if ((kbuf = malloc(klen)) == NULL ||
|
||||
- (shared_secret = BN_new()) == NULL) {
|
||||
+ if ((kbuf = malloc(klen)) == NULL) {
|
||||
r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
- if (ECDH_compute_key(kbuf, klen, dh_pub, key, NULL) != (int)klen ||
|
||||
- BN_bin2bn(kbuf, klen, shared_secret) == NULL) {
|
||||
+ if (EVP_PKEY_derive(ctx, kbuf, &klen) != 1) {
|
||||
r = SSH_ERR_LIBCRYPTO_ERROR;
|
||||
goto out;
|
||||
}
|
||||
#ifdef DEBUG_KEXECDH
|
||||
dump_digest("shared secret", kbuf, klen);
|
||||
#endif
|
||||
+ if ((shared_secret = BN_new()) == NULL ||
|
||||
+ (BN_bin2bn(kbuf, klen, shared_secret) == NULL)) {
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
+ goto out;
|
||||
+ }
|
||||
if ((r = sshbuf_put_bignum2(buf, shared_secret)) != 0)
|
||||
goto out;
|
||||
*shared_secretp = buf;
|
||||
buf = NULL;
|
||||
out:
|
||||
- EC_POINT_clear_free(dh_pub);
|
||||
+ EVP_PKEY_CTX_free(ctx);
|
||||
+ EVP_PKEY_free(pkey);
|
||||
+ EVP_PKEY_free(dh_pkey);
|
||||
+ OSSL_PARAM_BLD_free(param_bld);
|
||||
+ OSSL_PARAM_free(params);
|
||||
BN_clear_free(shared_secret);
|
||||
freezero(kbuf, klen);
|
||||
+ freezero(pub, publen);
|
||||
sshbuf_free(buf);
|
||||
return r;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,40 +0,0 @@
|
|||
--- openssh-9.3p1/openbsd-compat/openssl-compat.c 2023-03-15 22:28:19.000000000 +0100
|
||||
+++ /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat/openssl-compat.c 2023-05-25 14:19:42.870841944 +0200
|
||||
@@ -33,10 +33,10 @@
|
||||
|
||||
/*
|
||||
* OpenSSL version numbers: MNNFFPPS: major minor fix patch status
|
||||
- * We match major, minor, fix and status (not patch) for <1.0.0.
|
||||
- * After that, we acceptable compatible fix versions (so we
|
||||
- * allow 1.0.1 to work with 1.0.0). Going backwards is only allowed
|
||||
- * within a patch series.
|
||||
+ * Versions >=3 require only major versions to match.
|
||||
+ * For versions <3, we accept compatible fix versions (so we allow 1.0.1
|
||||
+ * to work with 1.0.0). Going backwards is only allowed within a patch series.
|
||||
+ * See https://www.openssl.org/policies/releasestrat.html
|
||||
*/
|
||||
|
||||
int
|
||||
@@ -48,15 +48,17 @@
|
||||
if (headerver == libver)
|
||||
return 1;
|
||||
|
||||
- /* for versions < 1.0.0, major,minor,fix,status must match */
|
||||
- if (headerver < 0x1000000f) {
|
||||
- mask = 0xfffff00fL; /* major,minor,fix,status */
|
||||
+ /*
|
||||
+ * For versions >= 3.0, only the major and status must match.
|
||||
+ */
|
||||
+ if (headerver >= 0x3000000f) {
|
||||
+ mask = 0xf000000fL; /* major,status */
|
||||
return (headerver & mask) == (libver & mask);
|
||||
}
|
||||
|
||||
/*
|
||||
- * For versions >= 1.0.0, major,minor,status must match and library
|
||||
- * fix version must be equal to or newer than the header.
|
||||
+ * For versions >= 1.0.0, but <3, major,minor,status must match and
|
||||
+ * library fix version must be equal to or newer than the header.
|
||||
*/
|
||||
mask = 0xfff0000fL; /* major,minor,status */
|
||||
hfix = (headerver & 0x000ff000) >> 12;
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
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 */
|
||||
--- a/ssh-agent.1 2023-03-15 22:28:19.000000000 +0100
|
||||
+++ b/ssh-agent.1 2023-07-19 21:39:17.981406432 +0200
|
||||
@@ -107,9 +107,27 @@
|
||||
.It Fl O Ar option
|
||||
Specify an option when starting
|
||||
.Nm .
|
||||
-Currently only one option is supported:
|
||||
+Currently two options are supported:
|
||||
+.Cm allow-remote-pkcs11
|
||||
+and
|
||||
.Cm no-restrict-websafe .
|
||||
-This instructs
|
||||
+.Pp
|
||||
+The
|
||||
+.Cm allow-remote-pkcs11
|
||||
+option allows clients of a forwarded
|
||||
+.Nm
|
||||
+to load PKCS#11 or FIDO provider libraries.
|
||||
+By default only local clients may perform this operation.
|
||||
+Note that signalling that a
|
||||
+.Nm
|
||||
+client remote is performed by
|
||||
+.Xr ssh 1 ,
|
||||
+and use of other tools to forward access to the agent socket may circumvent
|
||||
+this restriction.
|
||||
+.Pp
|
||||
+The
|
||||
+.Cm no-restrict-websafe ,
|
||||
+instructs
|
||||
.Nm
|
||||
to permit signatures using FIDO keys that might be web authentication
|
||||
requests.
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
22
openssh-9.9p1-disable-forwarding.patch
Normal file
22
openssh-9.9p1-disable-forwarding.patch
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
diff --color -ruNp a/session.c b/session.c
|
||||
--- a/session.c 2025-04-29 11:20:59.475107377 +0200
|
||||
+++ b/session.c 2025-04-29 11:23:16.638538968 +0200
|
||||
@@ -2284,7 +2284,8 @@ session_auth_agent_req(struct ssh *ssh,
|
||||
if ((r = sshpkt_get_end(ssh)) != 0)
|
||||
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
|
||||
if (!auth_opts->permit_agent_forwarding_flag ||
|
||||
- !options.allow_agent_forwarding) {
|
||||
+ !options.allow_agent_forwarding ||
|
||||
+ options.disable_forwarding) {
|
||||
debug_f("agent forwarding disabled");
|
||||
return 0;
|
||||
}
|
||||
@@ -2709,7 +2710,7 @@ session_setup_x11fwd(struct ssh *ssh, Se
|
||||
ssh_packet_send_debug(ssh, "X11 forwarding disabled by key options.");
|
||||
return 0;
|
||||
}
|
||||
- if (!options.x11_forwarding) {
|
||||
+ if (!options.x11_forwarding || options.disable_forwarding) {
|
||||
debug("X11 forwarding disabled in server configuration file.");
|
||||
return 0;
|
||||
}
|
||||
471
openssh-9.9p1-match-regression.patch
Normal file
471
openssh-9.9p1-match-regression.patch
Normal file
|
|
@ -0,0 +1,471 @@
|
|||
diff --git a/misc.c b/misc.c
|
||||
index afdf5142..1b4b55c5 100644
|
||||
--- a/misc.c
|
||||
+++ b/misc.c
|
||||
@@ -107,6 +107,27 @@ rtrim(char *s)
|
||||
}
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * returns pointer to character after 'prefix' in 's' or otherwise NULL
|
||||
+ * if the prefix is not present.
|
||||
+ */
|
||||
+const char *
|
||||
+strprefix(const char *s, const char *prefix, int ignorecase)
|
||||
+{
|
||||
+ size_t prefixlen;
|
||||
+
|
||||
+ if ((prefixlen = strlen(prefix)) == 0)
|
||||
+ return s;
|
||||
+ if (ignorecase) {
|
||||
+ if (strncasecmp(s, prefix, prefixlen) != 0)
|
||||
+ return NULL;
|
||||
+ } else {
|
||||
+ if (strncmp(s, prefix, prefixlen) != 0)
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ return s + prefixlen;
|
||||
+}
|
||||
+
|
||||
/* set/unset filedescriptor to non-blocking */
|
||||
int
|
||||
set_nonblock(int fd)
|
||||
diff --git a/misc.h b/misc.h
|
||||
index 11340389..efecdf1a 100644
|
||||
--- a/misc.h
|
||||
+++ b/misc.h
|
||||
@@ -56,6 +56,7 @@ struct ForwardOptions {
|
||||
char *chop(char *);
|
||||
void rtrim(char *);
|
||||
void skip_space(char **);
|
||||
+const char *strprefix(const char *, const char *, int);
|
||||
char *strdelim(char **);
|
||||
char *strdelimw(char **);
|
||||
int set_nonblock(int);
|
||||
diff --git a/readconf.c b/readconf.c
|
||||
index 3d9cc6db..9f559269 100644
|
||||
--- a/readconf.c
|
||||
+++ b/readconf.c
|
||||
@@ -710,7 +710,7 @@ match_cfg_line(Options *options, const char *full_line, int *acp, char ***avp,
|
||||
struct passwd *pw, const char *host_arg, const char *original_host,
|
||||
int final_pass, int *want_final_pass, const char *filename, int linenum)
|
||||
{
|
||||
- char *arg, *oattrib, *attrib, *cmd, *host, *criteria;
|
||||
+ char *arg, *oattrib = NULL, *attrib = NULL, *cmd, *host, *criteria;
|
||||
const char *ruser;
|
||||
int r, this_result, result = 1, attributes = 0, negate;
|
||||
|
||||
@@ -731,7 +731,8 @@ match_cfg_line(Options *options, const char *full_line, int *acp, char ***avp,
|
||||
|
||||
debug2("checking match for '%s' host %s originally %s",
|
||||
full_line, host, original_host);
|
||||
- while ((oattrib = attrib = argv_next(acp, avp)) != NULL) {
|
||||
+ while ((attrib = argv_next(acp, avp)) != NULL) {
|
||||
+ attrib = oattrib = xstrdup(attrib);
|
||||
/* Terminate on comment */
|
||||
if (*attrib == '#') {
|
||||
argv_consume(acp);
|
||||
@@ -777,9 +778,23 @@ match_cfg_line(Options *options, const char *full_line, int *acp, char ***avp,
|
||||
this_result ? "" : "not ", oattrib);
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+ /* Keep this list in sync with below */
|
||||
+ if (strprefix(attrib, "host=", 1) != NULL ||
|
||||
+ strprefix(attrib, "originalhost=", 1) != NULL ||
|
||||
+ strprefix(attrib, "user=", 1) != NULL ||
|
||||
+ strprefix(attrib, "localuser=", 1) != NULL ||
|
||||
+ strprefix(attrib, "localnetwork=", 1) != NULL ||
|
||||
+ strprefix(attrib, "tagged=", 1) != NULL ||
|
||||
+ strprefix(attrib, "exec=", 1) != NULL) {
|
||||
+ arg = strchr(attrib, '=');
|
||||
+ *(arg++) = '\0';
|
||||
+ } else {
|
||||
+ arg = argv_next(acp, avp);
|
||||
+ }
|
||||
+
|
||||
/* All other criteria require an argument */
|
||||
- if ((arg = argv_next(acp, avp)) == NULL ||
|
||||
- *arg == '\0' || *arg == '#') {
|
||||
+ if (arg == NULL || *arg == '\0' || *arg == '#') {
|
||||
error("Missing Match criteria for %s", attrib);
|
||||
result = -1;
|
||||
goto out;
|
||||
@@ -856,6 +871,8 @@ match_cfg_line(Options *options, const char *full_line, int *acp, char ***avp,
|
||||
criteria == NULL ? "" : criteria,
|
||||
criteria == NULL ? "" : "\"");
|
||||
free(criteria);
|
||||
+ free(oattrib);
|
||||
+ oattrib = attrib = NULL;
|
||||
}
|
||||
if (attributes == 0) {
|
||||
error("One or more attributes required for Match");
|
||||
@@ -865,6 +882,7 @@ match_cfg_line(Options *options, const char *full_line, int *acp, char ***avp,
|
||||
out:
|
||||
if (result != -1)
|
||||
debug2("match %sfound", result ? "" : "not ");
|
||||
+ free(oattrib);
|
||||
free(host);
|
||||
return result;
|
||||
}
|
||||
diff --git a/servconf.c b/servconf.c
|
||||
index 89b8413e..dd774f46 100644
|
||||
--- a/servconf.c
|
||||
+++ b/servconf.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* $OpenBSD: servconf.c,v 1.418 2024/09/15 03:09:44 djm Exp $ */
|
||||
+/* $OpenBSD: servconf.c,v 1.419 2024/09/25 01:24:04 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
* All rights reserved
|
||||
@@ -1033,7 +1033,7 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
int line, struct connection_info *ci)
|
||||
{
|
||||
int result = 1, attributes = 0, port;
|
||||
- char *arg, *attrib;
|
||||
+ char *arg, *attrib = NULL, *oattrib;
|
||||
|
||||
if (ci == NULL)
|
||||
debug3("checking syntax for 'Match %s'", full_line);
|
||||
@@ -1047,7 +1047,8 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
ci->laddress ? ci->laddress : "(null)", ci->lport);
|
||||
}
|
||||
|
||||
- while ((attrib = argv_next(acp, avp)) != NULL) {
|
||||
+ while ((oattrib = argv_next(acp, avp)) != NULL) {
|
||||
+ attrib = xstrdup(oattrib);
|
||||
/* Terminate on comment */
|
||||
if (*attrib == '#') {
|
||||
argv_consume(acp); /* mark all arguments consumed */
|
||||
@@ -1062,16 +1063,20 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
*arg != '\0' && *arg != '#')) {
|
||||
error("'all' cannot be combined with other "
|
||||
"Match attributes");
|
||||
- return -1;
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
}
|
||||
if (arg != NULL && *arg == '#')
|
||||
argv_consume(acp); /* consume remaining args */
|
||||
- return 1;
|
||||
+ result = 1;
|
||||
+ goto out;
|
||||
}
|
||||
/* Criterion "invalid-user" also has no argument */
|
||||
if (strcasecmp(attrib, "invalid-user") == 0) {
|
||||
- if (ci == NULL)
|
||||
+ if (ci == NULL) {
|
||||
+ result = 0;
|
||||
continue;
|
||||
+ }
|
||||
if (ci->user_invalid == 0)
|
||||
result = 0;
|
||||
else
|
||||
@@ -1078,11 +1081,26 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
debug("matched invalid-user at line %d", line);
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+ /* Keep this list in sync with below */
|
||||
+ if (strprefix(attrib, "user=", 1) != NULL ||
|
||||
+ strprefix(attrib, "group=", 1) != NULL ||
|
||||
+ strprefix(attrib, "host=", 1) != NULL ||
|
||||
+ strprefix(attrib, "address=", 1) != NULL ||
|
||||
+ strprefix(attrib, "localaddress=", 1) != NULL ||
|
||||
+ strprefix(attrib, "localport=", 1) != NULL ||
|
||||
+ strprefix(attrib, "rdomain=", 1) != NULL) {
|
||||
+ arg = strchr(attrib, '=');
|
||||
+ *(arg++) = '\0';
|
||||
+ } else {
|
||||
+ arg = argv_next(acp, avp);
|
||||
+ }
|
||||
+
|
||||
/* All other criteria require an argument */
|
||||
- if ((arg = argv_next(acp, avp)) == NULL ||
|
||||
- *arg == '\0' || *arg == '#') {
|
||||
+ if (arg == NULL || *arg == '\0' || *arg == '#') {
|
||||
error("Missing Match criteria for %s", attrib);
|
||||
- return -1;
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
}
|
||||
if (strcasecmp(attrib, "user") == 0) {
|
||||
if (ci == NULL || (ci->test && ci->user == NULL)) {
|
||||
@@ -1105,7 +1123,8 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
match_test_missing_fatal("Group", "user");
|
||||
switch (match_cfg_line_group(arg, line, ci->user)) {
|
||||
case -1:
|
||||
- return -1;
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
case 0:
|
||||
result = 0;
|
||||
}
|
||||
@@ -1141,7 +1160,8 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
result = 0;
|
||||
break;
|
||||
case -2:
|
||||
- return -1;
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
}
|
||||
} else if (strcasecmp(attrib, "localaddress") == 0){
|
||||
if (ci == NULL || (ci->test && ci->laddress == NULL)) {
|
||||
@@ -1166,13 +1186,15 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
result = 0;
|
||||
break;
|
||||
case -2:
|
||||
- return -1;
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
}
|
||||
} else if (strcasecmp(attrib, "localport") == 0) {
|
||||
if ((port = a2port(arg)) == -1) {
|
||||
error("Invalid LocalPort '%s' on Match line",
|
||||
arg);
|
||||
- return -1;
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
}
|
||||
if (ci == NULL || (ci->test && ci->lport == -1)) {
|
||||
result = 0;
|
||||
@@ -1200,16 +1222,21 @@ match_cfg_line(const char *full_line, int *acp, char ***avp,
|
||||
debug("user %.100s matched 'RDomain %.100s' at "
|
||||
"line %d", ci->rdomain, arg, line);
|
||||
} else {
|
||||
- error("Unsupported Match attribute %s", attrib);
|
||||
- return -1;
|
||||
+ error("Unsupported Match attribute %s", oattrib);
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
}
|
||||
+ free(attrib);
|
||||
+ attrib = NULL;
|
||||
}
|
||||
if (attributes == 0) {
|
||||
error("One or more attributes required for Match");
|
||||
return -1;
|
||||
}
|
||||
- if (ci != NULL)
|
||||
+ out:
|
||||
+ if (ci != NULL && result != -1)
|
||||
debug3("match %sfound", result ? "" : "not ");
|
||||
+ free(attrib);
|
||||
return result;
|
||||
}
|
||||
|
||||
diff --git a/regress/cfginclude.sh b/regress/cfginclude.sh
|
||||
index d442cdd6..97fd816f 100644
|
||||
--- a/regress/cfginclude.sh
|
||||
+++ b/regress/cfginclude.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-# $OpenBSD: cfginclude.sh,v 1.4 2024/09/03 05:58:56 djm Exp $
|
||||
+# $OpenBSD: cfginclude.sh,v 1.5 2024/09/27 01:05:54 djm Exp $
|
||||
# Placed in the Public Domain.
|
||||
|
||||
tid="config include"
|
||||
@@ -10,7 +10,7 @@ cat > $OBJ/ssh_config.i << _EOF
|
||||
Match host a
|
||||
Hostname aa
|
||||
|
||||
-Match host b # comment
|
||||
+Match host=b # comment
|
||||
Hostname bb
|
||||
Include $OBJ/ssh_config.i.*
|
||||
|
||||
@@ -18,7 +18,7 @@ Match host c
|
||||
Include $OBJ/ssh_config.i.*
|
||||
Hostname cc
|
||||
|
||||
-Match host m
|
||||
+Match host=m !user xxxyfake
|
||||
Include $OBJ/ssh_config.i.* # comment
|
||||
|
||||
Host d
|
||||
@@ -41,7 +41,7 @@ Match host xxxxxx
|
||||
_EOF
|
||||
|
||||
cat > $OBJ/ssh_config.i.1 << _EOF
|
||||
-Match host a
|
||||
+Match host=a
|
||||
Hostname aaa
|
||||
|
||||
Match host b
|
||||
@@ -64,10 +64,10 @@ cat > $OBJ/ssh_config.i.2 << _EOF
|
||||
Match host a
|
||||
Hostname aaaa
|
||||
|
||||
-Match host b
|
||||
+Match host=b !user blahblahfake
|
||||
Hostname bbbb
|
||||
|
||||
-Match host c
|
||||
+Match host=c
|
||||
Hostname cccc
|
||||
|
||||
Host d
|
||||
@@ -142,7 +142,7 @@ trial a aa
|
||||
|
||||
# cleanup
|
||||
rm -f $OBJ/ssh_config.i $OBJ/ssh_config.i.* $OBJ/ssh_config.out
|
||||
-# $OpenBSD: cfginclude.sh,v 1.4 2024/09/03 05:58:56 djm Exp $
|
||||
+# $OpenBSD: cfginclude.sh,v 1.5 2024/09/27 01:05:54 djm Exp $
|
||||
# Placed in the Public Domain.
|
||||
|
||||
tid="config include"
|
||||
diff --git a/regress/cfgmatch.sh b/regress/cfgmatch.sh
|
||||
index 05a66685..2737a5f9 100644
|
||||
--- a/regress/cfgmatch.sh
|
||||
+++ b/regress/cfgmatch.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-# $OpenBSD: cfgmatch.sh,v 1.13 2021/06/08 06:52:43 djm Exp $
|
||||
+# $OpenBSD: cfgmatch.sh,v 1.14 2024/09/27 01:05:54 djm Exp $
|
||||
# Placed in the Public Domain.
|
||||
|
||||
tid="sshd_config match"
|
||||
@@ -26,7 +26,7 @@ start_client()
|
||||
kill $client_pid
|
||||
fatal "timeout waiting for background ssh"
|
||||
fi
|
||||
- done
|
||||
+ done
|
||||
}
|
||||
|
||||
stop_client()
|
||||
@@ -119,40 +119,42 @@ stop_client
|
||||
# requires knowledge of actual group memberships user running the test).
|
||||
params="user:user:u1 host:host:h1 address:addr:1.2.3.4 \
|
||||
localaddress:laddr:5.6.7.8 rdomain:rdomain:rdom1"
|
||||
-cp $OBJ/sshd_proxy_bak $OBJ/sshd_config
|
||||
-echo 'Banner /nomatch' >>$OBJ/sshd_config
|
||||
-for i in $params; do
|
||||
- config=`echo $i | cut -f1 -d:`
|
||||
- criteria=`echo $i | cut -f2 -d:`
|
||||
- value=`echo $i | cut -f3 -d:`
|
||||
- cat >>$OBJ/sshd_config <<EOD
|
||||
- Match $config $value
|
||||
- Banner /$value
|
||||
+for separator in " " "=" ; do
|
||||
+ cp $OBJ/sshd_proxy_bak $OBJ/sshd_config
|
||||
+ echo 'Banner /nomatch' >>$OBJ/sshd_config
|
||||
+ for i in $params; do
|
||||
+ config=`echo $i | cut -f1 -d:`
|
||||
+ criteria=`echo $i | cut -f2 -d:`
|
||||
+ value=`echo $i | cut -f3 -d:`
|
||||
+ cat >>$OBJ/sshd_config <<EOD
|
||||
+ Match ${config}${separator}${value}
|
||||
+ Banner /$value
|
||||
EOD
|
||||
-done
|
||||
+ done
|
||||
|
||||
-${SUDO} ${SSHD} -f $OBJ/sshd_config -T >/dev/null || \
|
||||
- fail "validate config for w/out spec"
|
||||
-
|
||||
-# Test matching each criteria.
|
||||
-for i in $params; do
|
||||
- testcriteria=`echo $i | cut -f2 -d:`
|
||||
- expected=/`echo $i | cut -f3 -d:`
|
||||
- spec=""
|
||||
- for j in $params; do
|
||||
- config=`echo $j | cut -f1 -d:`
|
||||
- criteria=`echo $j | cut -f2 -d:`
|
||||
- value=`echo $j | cut -f3 -d:`
|
||||
- if [ "$criteria" = "$testcriteria" ]; then
|
||||
- spec="$criteria=$value,$spec"
|
||||
- else
|
||||
- spec="$criteria=1$value,$spec"
|
||||
+ ${SUDO} ${SSHD} -f $OBJ/sshd_config -T >/dev/null || \
|
||||
+ fail "validate config for w/out spec"
|
||||
+
|
||||
+ # Test matching each criteria.
|
||||
+ for i in $params; do
|
||||
+ testcriteria=`echo $i | cut -f2 -d:`
|
||||
+ expected=/`echo $i | cut -f3 -d:`
|
||||
+ spec=""
|
||||
+ for j in $params; do
|
||||
+ config=`echo $j | cut -f1 -d:`
|
||||
+ criteria=`echo $j | cut -f2 -d:`
|
||||
+ value=`echo $j | cut -f3 -d:`
|
||||
+ if [ "$criteria" = "$testcriteria" ]; then
|
||||
+ spec="$criteria=$value,$spec"
|
||||
+ else
|
||||
+ spec="$criteria=1$value,$spec"
|
||||
+ fi
|
||||
+ done
|
||||
+ trace "test spec $spec"
|
||||
+ result=`${SUDO} ${SSHD} -f $OBJ/sshd_config -T -C "$spec" | \
|
||||
+ awk '$1=="banner"{print $2}'`
|
||||
+ if [ "$result" != "$expected" ]; then
|
||||
+ fail "match $config expected $expected got $result"
|
||||
fi
|
||||
done
|
||||
- trace "test spec $spec"
|
||||
- result=`${SUDO} ${SSHD} -f $OBJ/sshd_config -T -C "$spec" | \
|
||||
- awk '$1=="banner"{print $2}'`
|
||||
- if [ "$result" != "$expected" ]; then
|
||||
- fail "match $config expected $expected got $result"
|
||||
- fi
|
||||
done
|
||||
diff --git a/regress/servcfginclude.sh b/regress/servcfginclude.sh
|
||||
index 518a703d..f67c3caa 100644
|
||||
--- a/regress/servcfginclude.sh
|
||||
+++ b/regress/servcfginclude.sh
|
||||
@@ -4,14 +4,14 @@ tid="server config include"
|
||||
|
||||
cat > $OBJ/sshd_config.i << _EOF
|
||||
HostKey $OBJ/host.ssh-ed25519
|
||||
-Match host a
|
||||
+Match host=a
|
||||
Banner /aa
|
||||
|
||||
Match host b
|
||||
Banner /bb
|
||||
Include $OBJ/sshd_config.i.* # comment
|
||||
|
||||
-Match host c
|
||||
+Match host=c
|
||||
Include $OBJ/sshd_config.i.* # comment
|
||||
Banner /cc
|
||||
|
||||
@@ -25,7 +25,7 @@ Match Host e
|
||||
Banner /ee
|
||||
Include $OBJ/sshd_config.i.*
|
||||
|
||||
-Match Host f
|
||||
+Match Host=f
|
||||
Include $OBJ/sshd_config.i.*
|
||||
Banner /ff
|
||||
|
||||
@@ -47,13 +47,13 @@ Match host b
|
||||
Match host c
|
||||
Banner /ccc
|
||||
|
||||
-Match Host d
|
||||
+Match Host=d
|
||||
Banner /ddd
|
||||
|
||||
Match Host e
|
||||
Banner /eee
|
||||
|
||||
-Match Host f
|
||||
+Match Host=f
|
||||
Banner /fff
|
||||
_EOF
|
||||
|
||||
@@ -61,13 +61,13 @@ cat > $OBJ/sshd_config.i.2 << _EOF
|
||||
Match host a
|
||||
Banner /aaaa
|
||||
|
||||
-Match host b
|
||||
+Match host=b
|
||||
Banner /bbbb
|
||||
|
||||
Match host c # comment
|
||||
Banner /cccc
|
||||
|
||||
-Match Host d
|
||||
+Match Host=d
|
||||
Banner /dddd
|
||||
|
||||
Match Host e
|
||||
98
openssh-9.9p1-mlkembe.patch
Normal file
98
openssh-9.9p1-mlkembe.patch
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
diff --git a/kexmlkem768x25519.c b/kexmlkem768x25519.c
|
||||
index 679446e9..2b5d3960 100644
|
||||
--- a/kexmlkem768x25519.c
|
||||
+++ b/kexmlkem768x25519.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* $OpenBSD: kexmlkem768x25519.c,v 1.1 2024/09/02 12:13:56 djm Exp $ */
|
||||
+/* $OpenBSD: kexmlkem768x25519.c,v 1.2 2024/10/27 02:06:59 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2023 Markus Friedl. All rights reserved.
|
||||
*
|
||||
@@ -34,6 +34,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
+#ifdef HAVE_ENDIAN_H
|
||||
+# include <endian.h>
|
||||
+#endif
|
||||
|
||||
#include "sshkey.h"
|
||||
#include "kex.h"
|
||||
diff --git a/libcrux_mlkem768_sha3.h b/libcrux_mlkem768_sha3.h
|
||||
index a82d60e8..b8ac1436 100644
|
||||
--- a/libcrux_mlkem768_sha3.h
|
||||
+++ b/libcrux_mlkem768_sha3.h
|
||||
@@ -1,4 +1,5 @@
|
||||
-/* $OpenBSD: libcrux_mlkem768_sha3.h,v 1.1 2024/09/02 12:13:56 djm Exp $ */
|
||||
+/* $OpenBSD: libcrux_mlkem768_sha3.h,v 1.2 2024/10/27 02:06:01 djm Exp $ */
|
||||
+
|
||||
/* Extracted from libcrux revision 84c5d87b3092c59294345aa269ceefe0eb97cc35 */
|
||||
|
||||
/*
|
||||
@@ -160,18 +161,19 @@ static inline void Eurydice_slice_to_array3(uint8_t *dst_tag, char *dst_ok,
|
||||
// CORE STUFF (conversions, endianness, ...)
|
||||
|
||||
static inline void core_num__u64_9__to_le_bytes(uint64_t v, uint8_t buf[8]) {
|
||||
+ v = htole64(v);
|
||||
memcpy(buf, &v, sizeof(v));
|
||||
}
|
||||
static inline uint64_t core_num__u64_9__from_le_bytes(uint8_t buf[8]) {
|
||||
uint64_t v;
|
||||
memcpy(&v, buf, sizeof(v));
|
||||
- return v;
|
||||
+ return le64toh(v);
|
||||
}
|
||||
|
||||
static inline uint32_t core_num__u32_8__from_le_bytes(uint8_t buf[4]) {
|
||||
uint32_t v;
|
||||
memcpy(&v, buf, sizeof(v));
|
||||
- return v;
|
||||
+ return le32toh(v);
|
||||
}
|
||||
|
||||
static inline uint32_t core_num__u8_6__count_ones(uint8_t x0) {
|
||||
diff --git a/mlkem768.sh b/mlkem768.sh
|
||||
index 2fdc2831..3d12b2ed 100644
|
||||
--- a/mlkem768.sh
|
||||
+++ b/mlkem768.sh
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
-# $OpenBSD: mlkem768.sh,v 1.2 2024/09/04 05:11:33 djm Exp $
|
||||
+# $OpenBSD: mlkem768.sh,v 1.3 2024/10/27 02:06:01 djm Exp $
|
||||
# Placed in the Public Domain.
|
||||
#
|
||||
|
||||
-WANT_LIBCRUX_REVISION="origin/main"
|
||||
+#WANT_LIBCRUX_REVISION="origin/main"
|
||||
+WANT_LIBCRUX_REVISION="84c5d87b3092c59294345aa269ceefe0eb97cc35"
|
||||
|
||||
FILES="
|
||||
libcrux/libcrux-ml-kem/cg/eurydice_glue.h
|
||||
@@ -47,6 +48,7 @@ echo '#define KRML_NOINLINE __attribute__((noinline, unused))'
|
||||
echo '#define KRML_HOST_EPRINTF(...)'
|
||||
echo '#define KRML_HOST_EXIT(x) fatal_f("internal error")'
|
||||
echo
|
||||
+
|
||||
for i in $FILES; do
|
||||
echo "/* from $i */"
|
||||
# Changes to all files:
|
||||
@@ -56,11 +58,16 @@ for i in $FILES; do
|
||||
-e 's/[ ]*$//' \
|
||||
$i | \
|
||||
case "$i" in
|
||||
- # XXX per-file handling goes here.
|
||||
+ */libcrux-ml-kem/cg/eurydice_glue.h)
|
||||
+ # Replace endian functions with versions that work.
|
||||
+ perl -0777 -pe 's/(static inline void core_num__u64_9__to_le_bytes.*\n)([^}]*\n)/\1 v = htole64(v);\n\2/' |
|
||||
+ perl -0777 -pe 's/(static inline uint64_t core_num__u64_9__from_le_bytes.*?)return v;/\1return le64toh(v);/s' |
|
||||
+ perl -0777 -pe 's/(static inline uint32_t core_num__u32_8__from_le_bytes.*?)return v;/\1return le32toh(v);/s'
|
||||
+ ;;
|
||||
# Default: pass through.
|
||||
*)
|
||||
- cat
|
||||
- ;;
|
||||
+ cat
|
||||
+ ;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
12
openssh-9.9p1-separate-keysign.patch
Normal file
12
openssh-9.9p1-separate-keysign.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
diff -up openssh-9.9p1/ssh_config.5.xxx openssh-9.9p1/ssh_config.5
|
||||
--- openssh-9.9p1/ssh_config.5.xxx 2024-10-11 12:01:14.260566303 +0200
|
||||
+++ openssh-9.9p1/ssh_config.5 2024-10-11 12:01:59.725654775 +0200
|
||||
@@ -759,7 +759,7 @@ or
|
||||
This option should be placed in the non-hostspecific section.
|
||||
See
|
||||
.Xr ssh-keysign 8
|
||||
-for more information.
|
||||
+for more information. ssh-keysign should be installed explicitly.
|
||||
.It Cm EscapeChar
|
||||
Sets the escape character (default:
|
||||
.Ql ~ ) .
|
||||
152
openssh-9.9p2-error_processing.patch
Normal file
152
openssh-9.9p2-error_processing.patch
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
diff --git a/krl.c b/krl.c
|
||||
index e2efdf06..0d0f6953 100644
|
||||
--- a/krl.c
|
||||
+++ b/krl.c
|
||||
@@ -674,6 +674,7 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
|
||||
break;
|
||||
case KRL_SECTION_CERT_SERIAL_BITMAP:
|
||||
if (rs->lo - bitmap_start > INT_MAX) {
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
error_f("insane bitmap gap");
|
||||
goto out;
|
||||
}
|
||||
@@ -1059,6 +1060,7 @@ ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp)
|
||||
}
|
||||
|
||||
if ((krl = ssh_krl_init()) == NULL) {
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
error_f("alloc failed");
|
||||
goto out;
|
||||
}
|
||||
diff --git a/packet.c b/packet.c
|
||||
index 486f8515..9dea2cfc 100644
|
||||
--- a/packet.c
|
||||
+++ b/packet.c
|
||||
@@ -1864,6 +1864,14 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
|
||||
if ((r = sshpkt_get_string_direct(ssh, &d, &len)) != 0)
|
||||
return r;
|
||||
DBG(debug("Received SSH2_MSG_PING len %zu", len));
|
||||
+ if (!ssh->state->after_authentication) {
|
||||
+ DBG(debug("Won't reply to PING in preauth"));
|
||||
+ break;
|
||||
+ }
|
||||
+ if (ssh_packet_is_rekeying(ssh)) {
|
||||
+ DBG(debug("Won't reply to PING during KEX"));
|
||||
+ break;
|
||||
+ }
|
||||
if ((r = sshpkt_start(ssh, SSH2_MSG_PONG)) != 0 ||
|
||||
(r = sshpkt_put_string(ssh, d, len)) != 0 ||
|
||||
(r = sshpkt_send(ssh)) != 0)
|
||||
diff --git a/ssh-agent.c b/ssh-agent.c
|
||||
index 48973b2c..c27c5a95 100644
|
||||
--- a/ssh-agent.c
|
||||
+++ b/ssh-agent.c
|
||||
@@ -1220,6 +1220,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
|
||||
"restrict-destination-v00@openssh.com") == 0) {
|
||||
if (*dcsp != NULL) {
|
||||
error_f("%s already set", ext_name);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto out;
|
||||
}
|
||||
if ((r = sshbuf_froms(m, &b)) != 0) {
|
||||
@@ -1229,6 +1230,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
|
||||
while (sshbuf_len(b) != 0) {
|
||||
if (*ndcsp >= AGENT_MAX_DEST_CONSTRAINTS) {
|
||||
error_f("too many %s constraints", ext_name);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto out;
|
||||
}
|
||||
*dcsp = xrecallocarray(*dcsp, *ndcsp, *ndcsp + 1,
|
||||
@@ -1246,6 +1248,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
|
||||
}
|
||||
if (*certs != NULL) {
|
||||
error_f("%s already set", ext_name);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto out;
|
||||
}
|
||||
if ((r = sshbuf_get_u8(m, &v)) != 0 ||
|
||||
@@ -1257,6 +1260,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
|
||||
while (sshbuf_len(b) != 0) {
|
||||
if (*ncerts >= AGENT_MAX_EXT_CERTS) {
|
||||
error_f("too many %s constraints", ext_name);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto out;
|
||||
}
|
||||
*certs = xrecallocarray(*certs, *ncerts, *ncerts + 1,
|
||||
@@ -1757,6 +1761,7 @@ process_ext_session_bind(SocketEntry *e)
|
||||
/* record new key/sid */
|
||||
if (e->nsession_ids >= AGENT_MAX_SESSION_IDS) {
|
||||
error_f("too many session IDs recorded");
|
||||
+ r = -1;
|
||||
goto out;
|
||||
}
|
||||
e->session_ids = xrecallocarray(e->session_ids, e->nsession_ids,
|
||||
diff --git a/ssh-sk-client.c b/ssh-sk-client.c
|
||||
index 321fe53a..06fad221 100644
|
||||
--- a/ssh-sk-client.c
|
||||
+++ b/ssh-sk-client.c
|
||||
@@ -439,6 +439,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
|
||||
}
|
||||
if ((srk = calloc(1, sizeof(*srk))) == NULL) {
|
||||
error_f("calloc failed");
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
srk->key = key;
|
||||
@@ -450,6 +451,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
|
||||
if ((tmp = recallocarray(srks, nsrks, nsrks + 1,
|
||||
sizeof(*srks))) == NULL) {
|
||||
error_f("recallocarray keys failed");
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
debug_f("srks[%zu]: %s %s uidlen %zu", nsrks,
|
||||
diff --git a/sshconnect2.c b/sshconnect2.c
|
||||
index a69c4da1..1ee6000a 100644
|
||||
--- a/sshconnect2.c
|
||||
+++ b/sshconnect2.c
|
||||
@@ -99,7 +99,7 @@ verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)
|
||||
options.required_rsa_size)) != 0)
|
||||
fatal_r(r, "Bad server host key");
|
||||
if (verify_host_key(xxx_host, xxx_hostaddr, hostkey,
|
||||
- xxx_conn_info) == -1)
|
||||
+ xxx_conn_info) != 0)
|
||||
fatal("Host key verification failed.");
|
||||
return 0;
|
||||
}
|
||||
@@ -699,6 +699,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
|
||||
|
||||
if ((pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC) {
|
||||
debug_f("server sent unknown pkalg %s", pkalg);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto done;
|
||||
}
|
||||
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
|
||||
@@ -709,6 +710,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
|
||||
error("input_userauth_pk_ok: type mismatch "
|
||||
"for decoded key (received %d, expected %d)",
|
||||
key->type, pktype);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -728,6 +730,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
|
||||
SSH_FP_DEFAULT);
|
||||
error_f("server replied with unknown key: %s %s",
|
||||
sshkey_type(key), fp == NULL ? "<ERROR>" : fp);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto done;
|
||||
}
|
||||
ident = format_identity(id);
|
||||
diff --git a/sshsig.c b/sshsig.c
|
||||
index 6e03c0b0..3da005d6 100644
|
||||
--- a/sshsig.c
|
||||
+++ b/sshsig.c
|
||||
@@ -879,6 +879,7 @@ cert_filter_principals(const char *path, u_long linenum,
|
||||
}
|
||||
if ((principals = sshbuf_dup_string(nprincipals)) == NULL) {
|
||||
error_f("buffer error");
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
/* success */
|
||||
78
openssh.spec
78
openssh.spec
|
|
@ -46,10 +46,10 @@
|
|||
%{?static_openssl:%global static_libcrypto 1}
|
||||
|
||||
# Do not forget to bump pam_ssh_agent_auth release if you rewind the main package release to 1
|
||||
%global openssh_ver 9.8p1
|
||||
%global openssh_rel 3
|
||||
%global openssh_ver 9.9p1
|
||||
%global openssh_rel 4
|
||||
%global pam_ssh_agent_ver 0.10.4
|
||||
%global pam_ssh_agent_rel 10
|
||||
%global pam_ssh_agent_rel 13
|
||||
|
||||
Summary: An open source implementation of SSH protocol version 2
|
||||
Name: openssh
|
||||
|
|
@ -90,8 +90,6 @@ Patch200: openssh-7.6p1-audit.patch
|
|||
Patch201: openssh-7.1p2-audit-race-condition.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2049947
|
||||
Patch202: openssh-9.0p1-audit-log.patch
|
||||
# Correctly audit hostname and IP address
|
||||
Patch203: openssh-8.7p1-audit-hostname.patch
|
||||
|
||||
# --- pam_ssh-agent ---
|
||||
# make it build reusing the openssh sources
|
||||
|
|
@ -145,7 +143,7 @@ Patch711: openssh-7.8p1-UsePAM-warning.patch
|
|||
# Reenable MONITOR_REQ_GSSCHECKMIC after gssapi-with-mic failures
|
||||
# upstream MR:
|
||||
# https://github.com/openssh-gsskex/openssh-gsskex/pull/21
|
||||
Patch800: openssh-8.0p1-gssapi-keyex.patch
|
||||
Patch800: openssh-9.6p1-gssapi-keyex.patch
|
||||
#http://www.mail-archive.com/kerberos@mit.edu/msg17591.html
|
||||
Patch801: openssh-6.6p1-force_krb.patch
|
||||
# add new option GSSAPIEnablek5users and disable using ~/.k5users by default (#1169843)
|
||||
|
|
@ -156,8 +154,6 @@ Patch802: openssh-6.6p1-GSSAPIEnablek5users.patch
|
|||
Patch804: openssh-7.7p1-gssapi-new-unique.patch
|
||||
# Respect k5login_directory option in krk5.conf (#1328243)
|
||||
Patch805: openssh-7.2p2-k5login_directory.patch
|
||||
# Rewriting OpenSSH GSS KEX to use new packet API
|
||||
Patch806: openssh-9.6p1-gsskex-new-api.patch
|
||||
|
||||
#https://bugzilla.mindrot.org/show_bug.cgi?id=1780
|
||||
Patch901: openssh-6.6p1-kuserok.patch
|
||||
|
|
@ -190,9 +186,6 @@ Patch953: openssh-7.8p1-scp-ipv6.patch
|
|||
# Mention crypto-policies in manual pages (#1668325)
|
||||
# clarify rhbz#2068423 on the man page of ssh_config
|
||||
Patch962: openssh-8.0p1-crypto-policies.patch
|
||||
# Use OpenSSL high-level API to produce and verify signatures (#1707485)
|
||||
# TODO fix the comment above ^
|
||||
Patch963: openssh-9.3p1-merged-openssl-evp.patch
|
||||
# Use OpenSSL KDF (#1631761)
|
||||
Patch964: openssh-8.0p1-openssl-kdf.patch
|
||||
# sk-dummy.so built with -fvisibility=hidden does not work
|
||||
|
|
@ -228,11 +221,22 @@ Patch1002: openssh-8.7p1-ssh-manpage.patch
|
|||
# https://github.com/openssh/openssh-portable/pull/323
|
||||
Patch1006: openssh-8.7p1-negotiate-supported-algs.patch
|
||||
|
||||
Patch1012: openssh-9.0p1-evp-fips-dh.patch
|
||||
Patch1013: openssh-9.0p1-evp-fips-ecdh.patch
|
||||
Patch1012: openssh-9.0p1-evp-fips-kex.patch
|
||||
Patch1014: openssh-8.7p1-nohostsha1proof.patch
|
||||
|
||||
Patch1015: openssh-9.6p1-pam-rhost.patch
|
||||
Patch1016: openssh-9.9p1-separate-keysign.patch
|
||||
# upstream cf3e48ee8ba1beeccddd2f203b558fa102be67a2
|
||||
# upstream 0c3927c45f8a57b511c874c4d51a8c89414f74ef
|
||||
Patch1017: openssh-9.9p1-mlkembe.patch
|
||||
# upstream 3f02368e8e9121847727c46b280efc280e5eb615
|
||||
# upstream 67a115e7a56dbdc3f5a58c64b29231151f3670f5
|
||||
Patch1020: openssh-9.9p1-match-regression.patch
|
||||
# upstream 6ce00f0c2ecbb9f75023dbe627ee6460bcec78c2
|
||||
# upstream 0832aac79517611dd4de93ad0a83577994d9c907
|
||||
Patch1021: openssh-9.9p2-error_processing.patch
|
||||
# upstream fc86875e6acb36401dfc1dfb6b628a9d1460f367
|
||||
Patch1022: openssh-9.9p1-disable-forwarding.patch
|
||||
|
||||
License: BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND sprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
|
||||
Requires: /sbin/nologin
|
||||
|
|
@ -285,6 +289,10 @@ Summary: An open source SSH client applications
|
|||
Requires: openssh = %{version}-%{release}
|
||||
Requires: crypto-policies >= 20220824-1
|
||||
|
||||
%package keysign
|
||||
Summary: A helper program used for host-based authentication
|
||||
Requires: openssh = %{version}-%{release}
|
||||
|
||||
%package server
|
||||
Summary: An open source SSH server daemon
|
||||
Requires: openssh = %{version}-%{release}
|
||||
|
|
@ -330,6 +338,11 @@ OpenSSH is a free version of SSH (Secure SHell), a program for logging
|
|||
into and executing commands on a remote machine. This package includes
|
||||
the clients necessary to make encrypted connections to SSH servers.
|
||||
|
||||
%description keysign
|
||||
OpenSSH is a free version of SSH (Secure SHell), a program for logging
|
||||
into and executing commands on a remote machine. ssh-keysign is a
|
||||
helper program used for host-based authentication disabled by default.
|
||||
|
||||
%description server
|
||||
OpenSSH is a free version of SSH (Secure SHell), a program for logging
|
||||
into and executing commands on a remote machine. This package contains
|
||||
|
|
@ -393,7 +406,6 @@ popd
|
|||
%patch -P 801 -p1 -b .force_krb
|
||||
%patch -P 804 -p1 -b .ccache_name
|
||||
%patch -P 805 -p1 -b .k5login
|
||||
%patch -P 806 -p1 -b .gsskex-new-api
|
||||
#
|
||||
%patch -P 901 -p1 -b .kuserok
|
||||
%patch -P 906 -p1 -b .fromto-remote
|
||||
|
|
@ -410,7 +422,6 @@ popd
|
|||
%patch -P 951 -p1 -b .pkcs11-uri
|
||||
%patch -P 953 -p1 -b .scp-ipv6
|
||||
%patch -P 962 -p1 -b .crypto-policies
|
||||
%patch -P 963 -p1 -b .openssl-evp
|
||||
%patch -P 964 -p1 -b .openssl-kdf
|
||||
%patch -P 965 -p1 -b .visibility
|
||||
%patch -P 966 -p1 -b .x11-ipv6
|
||||
|
|
@ -426,7 +437,6 @@ popd
|
|||
%patch -P 200 -p1 -b .audit
|
||||
%patch -P 201 -p1 -b .audit-race
|
||||
%patch -P 202 -p1 -b .audit-log
|
||||
%patch -P 203 -p1 -b .audit-hostname
|
||||
%patch -P 700 -p1 -b .fips
|
||||
|
||||
%patch -P 1002 -p1 -b .ssh-manpage
|
||||
|
|
@ -434,9 +444,13 @@ popd
|
|||
%patch -P 1006 -p1 -b .negotiate-supported-algs
|
||||
|
||||
%patch -P 1012 -p1 -b .evp-fips-dh
|
||||
%patch -P 1013 -p1 -b .evp-fips-ecdh
|
||||
%patch -P 1014 -p1 -b .nosha1hostproof
|
||||
%patch -P 1015 -p1 -b .pam-rhost
|
||||
%patch -P 1016 -p1 -b .sep-keysign
|
||||
%patch -P 1017 -p1 -b .mlkembe
|
||||
%patch -P 1020 -p1 -b .match
|
||||
%patch -P 1021 -p1 -b .errcode_set
|
||||
%patch -P 1022 -p1 -b .disable-forwarding
|
||||
|
||||
%patch -P 100 -p1 -b .coverity
|
||||
|
||||
|
|
@ -552,7 +566,7 @@ popd
|
|||
%endif
|
||||
|
||||
%check
|
||||
%{SOURCE22} %{SOURCE23} # ./parallel_tests.sh parallel_tests.Makefile
|
||||
OPENSSL_CONF=/dev/null %{SOURCE22} %{SOURCE23} # ./parallel_tests.sh parallel_tests.Makefile
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
|
@ -666,8 +680,6 @@ test -f %{sysconfig_anaconda} && \
|
|||
%attr(0755,root,root) %{_bindir}/ssh-keygen
|
||||
%attr(0644,root,root) %{_mandir}/man1/ssh-keygen.1*
|
||||
%attr(0755,root,root) %dir %{_libexecdir}/openssh
|
||||
%attr(4555,root,root) %{_libexecdir}/openssh/ssh-keysign
|
||||
%attr(0644,root,root) %{_mandir}/man8/ssh-keysign.8*
|
||||
|
||||
%files clients
|
||||
%attr(0755,root,root) %{_bindir}/ssh
|
||||
|
|
@ -695,6 +707,10 @@ test -f %{sysconfig_anaconda} && \
|
|||
%attr(0644,root,root) %{_userunitdir}/ssh-agent.service
|
||||
%attr(0644,root,root) %{_userunitdir}/ssh-agent.socket
|
||||
|
||||
%files keysign
|
||||
%attr(4555,root,root) %{_libexecdir}/openssh/ssh-keysign
|
||||
%attr(0644,root,root) %{_mandir}/man8/ssh-keysign.8*
|
||||
|
||||
%files server
|
||||
%dir %attr(0711,root,root) %{_datadir}/empty.sshd
|
||||
%attr(0755,root,root) %{_sbindir}/sshd
|
||||
|
|
@ -744,6 +760,28 @@ test -f %{sysconfig_anaconda} && \
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon May 19 2025 Zoltan Fridrich <zfridric@redhat.com> - 9.9p1-4
|
||||
- CVE-2025-32728: Fix logic error in DisableForwarding option
|
||||
Resolves: rhbz#2358778
|
||||
|
||||
* Tue Feb 18 2025 Dmitry Belyavskiy <dbelyavs@redhat.com> - 9.9p1-3
|
||||
- Fix regression of Match directive processing
|
||||
- Fix missing error codes set and invalid error code checks in OpenSSH. It
|
||||
prevents memory exhaustion attack and a MITM attack when VerifyHostKeyDNS
|
||||
is on (CVE-2025-26465, CVE-2025-26466).
|
||||
|
||||
* Mon Jan 27 2025 Dmitry Belyavskiy <dbelyavs@redhat.com> - 9.9p1-2
|
||||
- Fix regression of Match directive processing
|
||||
Resolves: rhbz#2341769
|
||||
|
||||
* Fri Jan 17 2025 Dmitry Belyavskiy <dbelyavs@redhat.com> - 9.9p1-1
|
||||
- Backport rebase to OpenSSH 9.9p1 from rawhide
|
||||
- Fix MLKEM for BE platforms
|
||||
- Separate ssh-keysign to a dedicated package
|
||||
|
||||
* Tue Sep 03 2024 Dmitry Belyavskiy <dbelyavs@redhat.com> - 9.8p1-3.1
|
||||
- Synchronize patches from Red Hat
|
||||
|
||||
* Mon Aug 05 2024 Dmitry Belyavskiy <dbelyavs@redhat.com> - 9.8p1-3
|
||||
- Sshd now proposes to enter password again when a non-existing user is specified
|
||||
|
||||
|
|
|
|||
4
sources
4
sources
|
|
@ -1,4 +1,4 @@
|
|||
SHA512 (openssh-9.8p1.tar.gz) = 95dec2f18e58eb47994f3de4430253e0665e185564b65088ca5f4108870e05feddef8cda8d3c0a4b75f18b98cc2c024df0e27de53b48c1a16da8da483cb8292a
|
||||
SHA512 (openssh-9.8p1.tar.gz.asc) = 4df1f1be2c6ab7f3aebaedd0a773b0e8c8929abb30cd3415873ad55d012cfa113f792e888e5e772dd468c394aeb7e35d62893a514dbc0ab1a03acd79918657f7
|
||||
SHA512 (openssh-9.9p1.tar.gz) = 3cc0ed97f3e29ecbd882eca79239f02eb5a1606fce4f3119ddc3c5e86128aa3ff12dc85000879fccc87b60e7d651cfe37376607ac66075fede2118deaa685d6d
|
||||
SHA512 (openssh-9.9p1.tar.gz.asc) = 916e975c54eb68c0b2f0b0006522b241cbe54c4caa88d31537a6278490c93d9d732c2ab3a080ac084bf75cbdd5402901ec68583cbe7c7cde4a8e40e7a8b78c28
|
||||
SHA512 (pam_ssh_agent_auth-0.10.4.tar.gz) = caccf72174d15e43f4c86a459ac6448682e62116557cf1e1e828955f3d1731595b238df42adec57860e7f341e92daf5d8285020bcb5018f3b8a5145aa32ee1c2
|
||||
SHA512 (gpgkey-736060BA.gpg) = df44f3fdbcd1d596705348c7f5aed3f738c5f626a55955e0642f7c6c082995cf36a1b1891bb41b8715cb2aff34fef1c877e0eff0d3507dd00a055ba695757a21
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ ConditionFileNotEmpty=|!/etc/ssh/ssh_host_%i_key
|
|||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
# Set option as empty variable to suppress warnings upon expanding the command line
|
||||
# when the config file under /etc does not exist or is empty.
|
||||
Environment=OPTIONS=
|
||||
EnvironmentFile=-/etc/sysconfig/sshd
|
||||
ExecStart=/usr/libexec/openssh/sshd-keygen %i
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ Wants=ssh-host-keys-migration.service
|
|||
|
||||
[Service]
|
||||
Type=notify
|
||||
# Set option as empty variable to suppress warnings upon expanding the command line
|
||||
# when the config file under /etc does not exist or is empty.
|
||||
Environment=OPTIONS=
|
||||
EnvironmentFile=-/etc/sysconfig/sshd
|
||||
ExecStart=/usr/sbin/sshd -D $OPTIONS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ After=sshd-keygen.target
|
|||
Wants=ssh-host-keys-migration.service
|
||||
|
||||
[Service]
|
||||
# Set option as empty variable to avoid warnings upon expanding the command line
|
||||
# when the config file under /etc does not exist or is empty.
|
||||
Environment=OPTIONS=
|
||||
EnvironmentFile=-/etc/sysconfig/sshd
|
||||
ExecStart=-/usr/sbin/sshd -i $OPTIONS
|
||||
StandardInput=socket
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue