summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2016-07-19 11:38:54 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2016-07-19 11:38:54 +0000
commitbeffda4bca42b34ebcfe38e7a6592368255c2107 (patch)
tree2b90d492f2bcbc9fce2cfcae077c55bdeb47b90c /usr.bin
parent9d01050a9d284710865a66007d5a7eef59f8ac37 (diff)
Allow wildcard for PermitOpen hosts as well as ports. bz#2582, patch from
openssh at mzpqnxow.com and jjelen at redhat.com. ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/channels.c8
-rw-r--r--usr.bin/ssh/sshd_config.57
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index 3bef1b1d32b..16d59f418ad 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.350 2016/03/07 19:02:43 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.351 2016/07/19 11:38:53 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -132,6 +132,9 @@ static int num_adm_permitted_opens = 0;
/* special-case port number meaning allow any port */
#define FWD_PERMIT_ANY_PORT 0
+/* special-case wildcard meaning allow any host */
+#define FWD_PERMIT_ANY_HOST "*"
+
/*
* If this is true, all opens are permitted. This is the case on the server
* on which we have to trust the client anyway, and the user could do
@@ -3265,7 +3268,8 @@ open_match(ForwardPermission *allowed_open, const char *requestedhost,
if (allowed_open->port_to_connect != FWD_PERMIT_ANY_PORT &&
allowed_open->port_to_connect != requestedport)
return 0;
- if (strcmp(allowed_open->host_to_connect, requestedhost) != 0)
+ if (strcmp(allowed_open->host_to_connect, FWD_PERMIT_ANY_HOST) != 0 &&
+ strcmp(allowed_open->host_to_connect, requestedhost) != 0)
return 0;
return 1;
}
diff --git a/usr.bin/ssh/sshd_config.5 b/usr.bin/ssh/sshd_config.5
index 8625f6ceae7..90d41717a99 100644
--- a/usr.bin/ssh/sshd_config.5
+++ b/usr.bin/ssh/sshd_config.5
@@ -33,8 +33,8 @@
.\" (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.225 2016/06/17 06:33:30 jmc Exp $
-.Dd $Mdocdate: June 17 2016 $
+.\" $OpenBSD: sshd_config.5,v 1.226 2016/07/19 11:38:53 dtucker Exp $
+.Dd $Mdocdate: July 19 2016 $
.Dt SSHD_CONFIG 5
.Os
.Sh NAME
@@ -1216,6 +1216,9 @@ can be used to remove all restrictions and permit any forwarding requests.
An argument of
.Dq none
can be used to prohibit all forwarding requests.
+Wildcard
+.Dq *
+can be used for host or port to allow all hosts or port respectively.
By default all port forwarding requests are permitted.
.It Cm PermitRootLogin
Specifies whether root can log in using