-/* $OpenBSD: readconf.c,v 1.396 2025/02/15 01:50:47 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.397 2025/02/15 01:52:07 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include "uidswap.h"
#include "myproposal.h"
#include "digest.h"
+#include "version.h"
/* Format of the configuration file:
strprefix(attrib, "user=", 1) != NULL ||
strprefix(attrib, "localuser=", 1) != NULL ||
strprefix(attrib, "localnetwork=", 1) != NULL ||
+ strprefix(attrib, "version=", 1) != NULL ||
strprefix(attrib, "tagged=", 1) != NULL ||
strprefix(attrib, "command=", 1) != NULL ||
strprefix(attrib, "exec=", 1) != NULL) {
r = check_match_ifaddrs(arg) == 1;
if (r == (negate ? 1 : 0))
this_result = result = 0;
+ } else if (strcasecmp(attrib, "version") == 0) {
+ criteria = xstrdup(SSH_RELEASE);
+ r = match_pattern_list(SSH_RELEASE, arg, 0) == 1;
+ if (r == (negate ? 1 : 0))
+ this_result = result = 0;
} else if (strcasecmp(attrib, "tagged") == 0) {
criteria = xstrdup(options->tag == NULL ? "" :
options->tag);
-/* $OpenBSD: servconf.c,v 1.423 2025/02/10 23:16:51 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.424 2025/02/15 01:52:07 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
#include "auth.h"
#include "myproposal.h"
#include "digest.h"
+#include "version.h"
#if !defined(SSHD_PAM_SERVICE)
# define SSHD_PAM_SERVICE "sshd"
strprefix(attrib, "address=", 1) != NULL ||
strprefix(attrib, "localaddress=", 1) != NULL ||
strprefix(attrib, "localport=", 1) != NULL ||
- strprefix(attrib, "rdomain=", 1) != NULL) {
+ strprefix(attrib, "rdomain=", 1) != NULL ||
+ strprefix(attrib, "version=", 1) != NULL) {
arg = strchr(attrib, '=');
*(arg++) = '\0';
} else {
if (match_pattern_list(ci->rdomain, arg, 0) != 1)
result = 0;
else
- debug("user %.100s matched 'RDomain %.100s' at "
- "line %d", ci->rdomain, arg, line);
+ debug("connection RDomain %.100s matched "
+ "'RDomain %.100s' at line %d",
+ ci->rdomain, arg, line);
+ } else if (strcasecmp(attrib, "version") == 0) {
+ if (match_pattern_list(SSH_RELEASE, arg, 0) != 1)
+ result = 0;
+ else
+ debug("version %.100s matched "
+ "'version %.100s' at line %d",
+ SSH_RELEASE, arg, line);
} else {
error("Unsupported Match attribute %s", oattrib);
result = -1;
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: ssh_config.5,v 1.409 2025/02/15 01:50:47 djm Exp $
+.\" $OpenBSD: ssh_config.5,v 1.410 2025/02/15 01:52:07 djm Exp $
.Dd $Mdocdate: February 15 2025 $
.Dt SSH_CONFIG 5
.Os
.Cm tagged ,
.Cm command ,
.Cm user ,
+.Cm localuser ,
and
-.Cm localuser .
+.Cm version .
The
.Cm all
criteria must appear alone or immediately after
The empty string will match the case where a command or tag has not been
specified, i.e.
.Sq Match tag \&"\&"
+The
+.Cm version
+keyword matches against the version string of
+.Xr ssh 1 ,
+for example
+.Dq OpenSSH_10.0 .
.Pp
The
.Cm user
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: sshd_config.5,v 1.380 2024/12/06 16:24:27 djm Exp $
-.Dd $Mdocdate: December 6 2024 $
+.\" $OpenBSD: sshd_config.5,v 1.381 2025/02/15 01:52:07 djm Exp $
+.Dd $Mdocdate: February 15 2025 $
.Dt SSHD_CONFIG 5
.Os
.Sh NAME
.Cm Host ,
.Cm LocalAddress ,
.Cm LocalPort ,
+.Cm Version ,
.Cm RDomain ,
and
.Cm Address
or one with bits set in this host portion of the address.
For example, 192.0.2.0/33 and 192.0.2.0/8, respectively.
.Pp
+The
+.Cm Version
+keyword matches against the version string of
+.Xr sshd 8 ,
+for example
+.Dq OpenSSH_10.0 .
+.Pp
Only a subset of keywords may be used on the lines following a
.Cm Match
keyword.
-/* $OpenBSD: version.h,v 1.103 2024/09/19 22:17:44 djm Exp $ */
+/* $OpenBSD: version.h,v 1.104 2025/02/15 01:52:07 djm Exp $ */
#define SSH_VERSION "OpenSSH_9.9"
+#define SSH_RELEASE SSH_VERSION
#define SSH_PORTABLE "p1"
#define SSH_RELEASE SSH_VERSION SSH_PORTABLE