diff options
-rw-r--r-- | servconf.c | 15 | ||||
-rw-r--r-- | servconf.h | 3 | ||||
-rw-r--r-- | sshd.8 | 5 | ||||
-rw-r--r-- | sshd.c | 12 | ||||
-rw-r--r-- | sshd_config.5 | 11 |
5 files changed, 36 insertions, 10 deletions
diff --git a/servconf.c b/servconf.c index 51139c31c..64a865180 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | /* $OpenBSD: servconf.c,v 1.316 2017/10/25 00:17:08 djm Exp $ */ | 2 | /* $OpenBSD: servconf.c,v 1.317 2017/10/25 00:19:47 djm Exp $ */ |
3 | /* | 3 | /* |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
5 | * All rights reserved | 5 | * All rights reserved |
@@ -855,6 +855,7 @@ get_connection_info(int populate, int use_dns) | |||
855 | ci.address = ssh_remote_ipaddr(ssh); | 855 | ci.address = ssh_remote_ipaddr(ssh); |
856 | ci.laddress = ssh_local_ipaddr(ssh); | 856 | ci.laddress = ssh_local_ipaddr(ssh); |
857 | ci.lport = ssh_local_port(ssh); | 857 | ci.lport = ssh_local_port(ssh); |
858 | ci.rdomain = ssh_packet_rdomain_in(ssh); | ||
858 | return &ci; | 859 | return &ci; |
859 | } | 860 | } |
860 | 861 | ||
@@ -1038,6 +1039,16 @@ match_cfg_line(char **condition, int line, struct connection_info *ci) | |||
1038 | ci->laddress, port, line); | 1039 | ci->laddress, port, line); |
1039 | else | 1040 | else |
1040 | result = 0; | 1041 | result = 0; |
1042 | } else if (strcasecmp(attrib, "rdomain") == 0) { | ||
1043 | if (ci == NULL || ci->rdomain == NULL) { | ||
1044 | result = 0; | ||
1045 | continue; | ||
1046 | } | ||
1047 | if (match_pattern_list(ci->rdomain, arg, 0) != 1) | ||
1048 | result = 0; | ||
1049 | else | ||
1050 | debug("user %.100s matched 'RDomain %.100s' at " | ||
1051 | "line %d", ci->rdomain, arg, line); | ||
1041 | } else { | 1052 | } else { |
1042 | error("Unsupported Match attribute %s", attrib); | 1053 | error("Unsupported Match attribute %s", attrib); |
1043 | return -1; | 1054 | return -1; |
@@ -2080,6 +2091,8 @@ int parse_server_match_testspec(struct connection_info *ci, char *spec) | |||
2080 | ci->user = xstrdup(p + 5); | 2091 | ci->user = xstrdup(p + 5); |
2081 | } else if (strncmp(p, "laddr=", 6) == 0) { | 2092 | } else if (strncmp(p, "laddr=", 6) == 0) { |
2082 | ci->laddress = xstrdup(p + 6); | 2093 | ci->laddress = xstrdup(p + 6); |
2094 | } else if (strncmp(p, "rdomain=", 8) == 0) { | ||
2095 | ci->rdomain = xstrdup(p + 8); | ||
2083 | } else if (strncmp(p, "lport=", 6) == 0) { | 2096 | } else if (strncmp(p, "lport=", 6) == 0) { |
2084 | ci->lport = a2port(p + 6); | 2097 | ci->lport = a2port(p + 6); |
2085 | if (ci->lport == -1) { | 2098 | if (ci->lport == -1) { |
diff --git a/servconf.h b/servconf.h index 1f042e872..37a0fb1a3 100644 --- a/servconf.h +++ b/servconf.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: servconf.h,v 1.129 2017/10/25 00:17:08 djm Exp $ */ | 1 | /* $OpenBSD: servconf.h,v 1.130 2017/10/25 00:19:47 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -218,6 +218,7 @@ struct connection_info { | |||
218 | const char *address; /* remote address */ | 218 | const char *address; /* remote address */ |
219 | const char *laddress; /* local address */ | 219 | const char *laddress; /* local address */ |
220 | int lport; /* local port */ | 220 | int lport; /* local port */ |
221 | const char *rdomain; /* routing domain if available */ | ||
221 | }; | 222 | }; |
222 | 223 | ||
223 | 224 | ||
@@ -33,8 +33,8 @@ | |||
33 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 33 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
34 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: sshd.8,v 1.291 2017/06/24 06:28:50 jmc Exp $ | 36 | .\" $OpenBSD: sshd.8,v 1.292 2017/10/25 00:19:47 djm Exp $ |
37 | .Dd $Mdocdate: June 24 2017 $ | 37 | .Dd $Mdocdate: October 25 2017 $ |
38 | .Dt SSHD 8 | 38 | .Dt SSHD 8 |
39 | .Os | 39 | .Os |
40 | .Sh NAME | 40 | .Sh NAME |
@@ -109,6 +109,7 @@ The keywords are | |||
109 | .Dq host , | 109 | .Dq host , |
110 | .Dq laddr , | 110 | .Dq laddr , |
111 | .Dq lport , | 111 | .Dq lport , |
112 | .Dq rdomain | ||
112 | and | 113 | and |
113 | .Dq addr . | 114 | .Dq addr . |
114 | All are required and may be supplied in any order, either with multiple | 115 | All are required and may be supplied in any order, either with multiple |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.495 2017/10/25 00:17:08 djm Exp $ */ | 1 | /* $OpenBSD: sshd.c,v 1.496 2017/10/25 00:19:47 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1404,7 +1404,7 @@ main(int ac, char **av) | |||
1404 | extern int optind; | 1404 | extern int optind; |
1405 | int r, opt, on = 1, already_daemon, remote_port; | 1405 | int r, opt, on = 1, already_daemon, remote_port; |
1406 | int sock_in = -1, sock_out = -1, newsock = -1; | 1406 | int sock_in = -1, sock_out = -1, newsock = -1; |
1407 | const char *remote_ip; | 1407 | const char *remote_ip, *rdomain; |
1408 | char *fp, *line, *laddr, *logfile = NULL; | 1408 | char *fp, *line, *laddr, *logfile = NULL; |
1409 | int config_s[2] = { -1 , -1 }; | 1409 | int config_s[2] = { -1 , -1 }; |
1410 | u_int i, j; | 1410 | u_int i, j; |
@@ -2022,10 +2022,14 @@ main(int ac, char **av) | |||
2022 | audit_connection_from(remote_ip, remote_port); | 2022 | audit_connection_from(remote_ip, remote_port); |
2023 | #endif | 2023 | #endif |
2024 | 2024 | ||
2025 | rdomain = ssh_packet_rdomain_in(ssh); | ||
2026 | |||
2025 | /* Log the connection. */ | 2027 | /* Log the connection. */ |
2026 | laddr = get_local_ipaddr(sock_in); | 2028 | laddr = get_local_ipaddr(sock_in); |
2027 | verbose("Connection from %s port %d on %s port %d", | 2029 | verbose("Connection from %s port %d on %s port %d%s%s", |
2028 | remote_ip, remote_port, laddr, ssh_local_port(ssh)); | 2030 | remote_ip, remote_port, laddr, ssh_local_port(ssh), |
2031 | rdomain == NULL ? "" : " rdomain ", | ||
2032 | rdomain == NULL ? "" : rdomain); | ||
2029 | free(laddr); | 2033 | free(laddr); |
2030 | 2034 | ||
2031 | /* | 2035 | /* |
diff --git a/sshd_config.5 b/sshd_config.5 index c216fb75b..0b91f9f74 100644 --- a/sshd_config.5 +++ b/sshd_config.5 | |||
@@ -33,7 +33,7 @@ | |||
33 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 33 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
34 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: sshd_config.5,v 1.257 2017/10/25 00:17:08 djm Exp $ | 36 | .\" $OpenBSD: sshd_config.5,v 1.258 2017/10/25 00:19:47 djm Exp $ |
37 | .Dd $Mdocdate: October 25 2017 $ | 37 | .Dd $Mdocdate: October 25 2017 $ |
38 | .Dt SSHD_CONFIG 5 | 38 | .Dt SSHD_CONFIG 5 |
39 | .Os | 39 | .Os |
@@ -1054,8 +1054,15 @@ The available criteria are | |||
1054 | .Cm Host , | 1054 | .Cm Host , |
1055 | .Cm LocalAddress , | 1055 | .Cm LocalAddress , |
1056 | .Cm LocalPort , | 1056 | .Cm LocalPort , |
1057 | .Cm RDomain , | ||
1057 | and | 1058 | and |
1058 | .Cm Address . | 1059 | .Cm Address |
1060 | (with | ||
1061 | .Cm RDomain | ||
1062 | representing the | ||
1063 | .Xr rdomain 4 | ||
1064 | on which the connection was received.) | ||
1065 | .Pp | ||
1059 | The match patterns may consist of single entries or comma-separated | 1066 | The match patterns may consist of single entries or comma-separated |
1060 | lists and may use the wildcard and negation operators described in the | 1067 | lists and may use the wildcard and negation operators described in the |
1061 | .Sx PATTERNS | 1068 | .Sx PATTERNS |