summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-07-24 14:04:00 +1000
committerDamien Miller <djm@mindrot.org>2006-07-24 14:04:00 +1000
commit9b439df18a9d56683584811ce38dcf72acd4cb20 (patch)
treedc7d64d4ae9ce7c47d52804671e8b5d2aedddae3 /servconf.c
parent98299261eb970688a7bad346491cffdf2a7f6072 (diff)
- dtucker@cvs.openbsd.org 2006/07/17 12:06:00
[channels.c channels.h servconf.c sshd_config.5] Add PermitOpen directive to sshd_config which is equivalent to the "permitopen" key option. Allows server admin to allow TCP port forwarding only two specific host/port pairs. Useful when combined with Match. If permitopen is used in both sshd_config and a key option, both must allow a given connection before it will be permitted. Note that users can still use external forwarders such as netcat, so to be those must be controlled too for the limits to be effective. Feedback & ok djm@, man page corrections & ok jmc@.
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/servconf.c b/servconf.c
index 330e79143..4f5cb19db 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.c,v 1.155 2006/07/17 01:31:09 stevesk Exp $ */ 1/* $OpenBSD: servconf.c,v 1.156 2006/07/17 12:06:00 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -31,6 +31,7 @@
31#include "kex.h" 31#include "kex.h"
32#include "mac.h" 32#include "mac.h"
33#include "match.h" 33#include "match.h"
34#include "channels.h"
34 35
35static void add_listen_addr(ServerOptions *, char *, u_short); 36static void add_listen_addr(ServerOptions *, char *, u_short);
36static void add_one_listen_addr(ServerOptions *, char *, u_short); 37static void add_one_listen_addr(ServerOptions *, char *, u_short);
@@ -281,7 +282,7 @@ typedef enum {
281 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, 282 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
282 sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2, 283 sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
283 sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel, 284 sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
284 sMatch, 285 sMatch, sPermitOpen,
285 sUsePrivilegeSeparation, 286 sUsePrivilegeSeparation,
286 sDeprecated, sUnsupported 287 sDeprecated, sUnsupported
287} ServerOpCodes; 288} ServerOpCodes;
@@ -390,6 +391,8 @@ static struct {
390 { "useprivilegeseparation", sUsePrivilegeSeparation, SSHCFG_GLOBAL }, 391 { "useprivilegeseparation", sUsePrivilegeSeparation, SSHCFG_GLOBAL },
391 { "acceptenv", sAcceptEnv, SSHCFG_GLOBAL }, 392 { "acceptenv", sAcceptEnv, SSHCFG_GLOBAL },
392 { "permittunnel", sPermitTunnel, SSHCFG_GLOBAL }, 393 { "permittunnel", sPermitTunnel, SSHCFG_GLOBAL },
394 { "match", sMatch, SSHCFG_ALL },
395 { "permitopen", sPermitOpen, SSHCFG_ALL },
393 { NULL, sBadOption, 0 } 396 { NULL, sBadOption, 0 }
394}; 397};
395 398
@@ -1148,6 +1151,28 @@ parse_flag:
1148 *activep = value; 1151 *activep = value;
1149 break; 1152 break;
1150 1153
1154 case sPermitOpen:
1155 arg = strdelim(&cp);
1156 if (!arg || *arg == '\0')
1157 fatal("%s line %d: missing PermitOpen specification",
1158 filename, linenum);
1159 if (strcmp(arg, "any") == 0) {
1160 if (*activep)
1161 channel_clear_adm_permitted_opens();
1162 break;
1163 }
1164 p = hpdelim(&arg);
1165 if (p == NULL)
1166 fatal("%s line %d: missing host in PermitOpen",
1167 filename, linenum);
1168 p = cleanhostname(p);
1169 if (arg == NULL || (port = a2port(arg)) == 0)
1170 fatal("%s line %d: bad port number in PermitOpen",
1171 filename, linenum);
1172 if (*activep)
1173 channel_add_adm_permitted_opens(p, port);
1174 break;
1175
1151 case sDeprecated: 1176 case sDeprecated:
1152 logit("%s line %d: Deprecated option %s", 1177 logit("%s line %d: Deprecated option %s",
1153 filename, linenum, arg); 1178 filename, linenum, arg);