mirror of
https://github.com/opnsense/src.git
synced 2026-06-04 06:15:33 -04:00
Highlights from the release notes are reproduced below. Some security and bug fixes were previously merged into FreeBSD and have been elided. See the upstream release notes for full details (https://www.openssh.com/releasenotes.html). --- Future deprecation notice ========================= OpenSSH plans to remove support for the DSA signature algorithm in early 2025. Potentially-incompatible changes -------------------------------- * sshd(8): the server will now block client addresses that repeatedly fail authentication, repeatedly connect without ever completing authentication or that crash the server. See the discussion of PerSourcePenalties below for more information. Operators of servers that accept connections from many users, or servers that accept connections from addresses behind NAT or proxies may need to consider these settings. * sshd(8): the server has been split into a listener binary, sshd(8), and a per-session binary "sshd-session". This allows for a much smaller listener binary, as it no longer needs to support the SSH protocol. As part of this work, support for disabling privilege separation (which previously required code changes to disable) and disabling re-execution of sshd(8) has been removed. Further separation of sshd-session into additional, minimal binaries is planned for the future. * sshd(8): several log messages have changed. In particular, some log messages will be tagged with as originating from a process named "sshd-session" rather than "sshd". * ssh-keyscan(1): this tool previously emitted comment lines containing the hostname and SSH protocol banner to standard error. This release now emits them to standard output, but adds a new "-q" flag to silence them altogether. * sshd(8): (portable OpenSSH only) sshd will no longer use argv[0] as the PAM service name. A new "PAMServiceName" sshd_config(5) directive allows selecting the service name at runtime. This defaults to "sshd". bz2101 New features ------------ * sshd(8): sshd(8) will now penalise client addresses that, for various reasons, do not successfully complete authentication. This feature is controlled by a new sshd_config(5) PerSourcePenalties option and is on by default. * ssh(8): allow the HostkeyAlgorithms directive to disable the implicit fallback from certificate host key to plain host keys. Portability ----------- * sshd(8): expose SSH_AUTH_INFO_0 always to PAM auth modules unconditionally. The previous behaviour was to expose it only when particular authentication methods were in use. * ssh(1), ssh-agent(8): allow the presence of the WAYLAND_DISPLAY environment variable to enable SSH_ASKPASS, similarly to the X11 DISPLAY environment variable. GHPR479 --- Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48914 (cherry picked from commit0fdf8fae8b) (cherry picked from commitb4bb480ae9) (cherry picked from commite95979047a) (cherry picked from commitdcb4ae528d) Approved by: re (accelerated MFC)
134 lines
3.3 KiB
C
134 lines
3.3 KiB
C
/*
|
|
* Copyright (c) 2012,2023 Damien Miller <djm@mindrot.org>
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#include "includes.h"
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "log.h"
|
|
#include "misc.h"
|
|
#include "servconf.h"
|
|
#include "xmalloc.h"
|
|
#include "hostfile.h"
|
|
#include "auth.h"
|
|
|
|
extern ServerOptions options;
|
|
|
|
/*
|
|
* Configuration of enabled authentication methods. Separate from the rest of
|
|
* auth2-*.c because we want to query it during server configuration validity
|
|
* checking in the sshd listener process without pulling all the auth code in
|
|
* too.
|
|
*/
|
|
|
|
/* "none" is allowed only one time and it is cleared by userauth_none() later */
|
|
int none_enabled = 1;
|
|
struct authmethod_cfg methodcfg_none = {
|
|
"none",
|
|
NULL,
|
|
&none_enabled
|
|
};
|
|
struct authmethod_cfg methodcfg_pubkey = {
|
|
"publickey",
|
|
"publickey-hostbound-v00@openssh.com",
|
|
&options.pubkey_authentication
|
|
};
|
|
#ifdef GSSAPI
|
|
struct authmethod_cfg methodcfg_gssapi = {
|
|
"gssapi-with-mic",
|
|
NULL,
|
|
&options.gss_authentication
|
|
};
|
|
#endif
|
|
struct authmethod_cfg methodcfg_passwd = {
|
|
"password",
|
|
NULL,
|
|
&options.password_authentication
|
|
};
|
|
struct authmethod_cfg methodcfg_kbdint = {
|
|
"keyboard-interactive",
|
|
NULL,
|
|
&options.kbd_interactive_authentication
|
|
};
|
|
struct authmethod_cfg methodcfg_hostbased = {
|
|
"hostbased",
|
|
NULL,
|
|
&options.hostbased_authentication
|
|
};
|
|
|
|
static struct authmethod_cfg *authmethod_cfgs[] = {
|
|
&methodcfg_none,
|
|
&methodcfg_pubkey,
|
|
#ifdef GSSAPI
|
|
&methodcfg_gssapi,
|
|
#endif
|
|
&methodcfg_passwd,
|
|
&methodcfg_kbdint,
|
|
&methodcfg_hostbased,
|
|
NULL
|
|
};
|
|
|
|
/*
|
|
* Check a comma-separated list of methods for validity. If need_enable is
|
|
* non-zero, then also require that the methods are enabled.
|
|
* Returns 0 on success or -1 if the methods list is invalid.
|
|
*/
|
|
int
|
|
auth2_methods_valid(const char *_methods, int need_enable)
|
|
{
|
|
char *methods, *omethods, *method, *p;
|
|
u_int i, found;
|
|
int ret = -1;
|
|
const struct authmethod_cfg *cfg;
|
|
|
|
if (*_methods == '\0') {
|
|
error("empty authentication method list");
|
|
return -1;
|
|
}
|
|
omethods = methods = xstrdup(_methods);
|
|
while ((method = strsep(&methods, ",")) != NULL) {
|
|
for (found = i = 0; !found && authmethod_cfgs[i] != NULL; i++) {
|
|
cfg = authmethod_cfgs[i];
|
|
if ((p = strchr(method, ':')) != NULL)
|
|
*p = '\0';
|
|
if (strcmp(method, cfg->name) != 0)
|
|
continue;
|
|
if (need_enable) {
|
|
if (cfg->enabled == NULL ||
|
|
*(cfg->enabled) == 0) {
|
|
error("Disabled method \"%s\" in "
|
|
"AuthenticationMethods list \"%s\"",
|
|
method, _methods);
|
|
goto out;
|
|
}
|
|
}
|
|
found = 1;
|
|
break;
|
|
}
|
|
if (!found) {
|
|
error("Unknown authentication method \"%s\" in list",
|
|
method);
|
|
goto out;
|
|
}
|
|
}
|
|
ret = 0;
|
|
out:
|
|
free(omethods);
|
|
return ret;
|
|
}
|