summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--servconf.c14
-rw-r--r--servconf.h3
-rw-r--r--session.c5
-rw-r--r--sshd.89
-rw-r--r--sshd_config.511
6 files changed, 37 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index f430bfe8a..2a29c2ee0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,11 @@
15 allow explicit ::1 and 127.0.0.1 forwarding bind addresses when 15 allow explicit ::1 and 127.0.0.1 forwarding bind addresses when
16 GatewayPorts=no; allows client to choose address family; 16 GatewayPorts=no; allows client to choose address family;
17 bz#2222 ok markus@ 17 bz#2222 ok markus@
18 - djm@cvs.openbsd.org 2014/07/03 22:40:43
19 [servconf.c servconf.h session.c sshd.8 sshd_config.5]
20 Add a sshd_config PermitUserRC option to control whether ~/.ssh/rc is
21 executed, mirroring the no-user-rc authorized_keys option;
22 bz#2160; ok markus@
18 23
1920140703 2420140703
20 - (djm) [digest-openssl.c configure.ac] Disable RIPEMD160 if libcrypto 25 - (djm) [digest-openssl.c configure.ac] Disable RIPEMD160 if libcrypto
diff --git a/servconf.c b/servconf.c
index 7ba65d51d..331716c8f 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
1 1
2/* $OpenBSD: servconf.c,v 1.249 2014/01/29 06:18:35 djm Exp $ */ 2/* $OpenBSD: servconf.c,v 1.250 2014/07/03 22:40:43 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
@@ -93,6 +93,7 @@ initialize_server_options(ServerOptions *options)
93 options->x11_display_offset = -1; 93 options->x11_display_offset = -1;
94 options->x11_use_localhost = -1; 94 options->x11_use_localhost = -1;
95 options->permit_tty = -1; 95 options->permit_tty = -1;
96 options->permit_user_rc = -1;
96 options->xauth_location = NULL; 97 options->xauth_location = NULL;
97 options->strict_modes = -1; 98 options->strict_modes = -1;
98 options->tcp_keep_alive = -1; 99 options->tcp_keep_alive = -1;
@@ -216,6 +217,8 @@ fill_default_server_options(ServerOptions *options)
216 options->xauth_location = _PATH_XAUTH; 217 options->xauth_location = _PATH_XAUTH;
217 if (options->permit_tty == -1) 218 if (options->permit_tty == -1)
218 options->permit_tty = 1; 219 options->permit_tty = 1;
220 if (options->permit_user_rc == -1)
221 options->permit_user_rc = 1;
219 if (options->strict_modes == -1) 222 if (options->strict_modes == -1)
220 options->strict_modes = 1; 223 options->strict_modes = 1;
221 if (options->tcp_keep_alive == -1) 224 if (options->tcp_keep_alive == -1)
@@ -347,7 +350,7 @@ typedef enum {
347 sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile, 350 sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
348 sKexAlgorithms, sIPQoS, sVersionAddendum, 351 sKexAlgorithms, sIPQoS, sVersionAddendum,
349 sAuthorizedKeysCommand, sAuthorizedKeysCommandUser, 352 sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
350 sAuthenticationMethods, sHostKeyAgent, 353 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
351 sDeprecated, sUnsupported 354 sDeprecated, sUnsupported
352} ServerOpCodes; 355} ServerOpCodes;
353 356
@@ -460,6 +463,7 @@ static struct {
460 { "acceptenv", sAcceptEnv, SSHCFG_ALL }, 463 { "acceptenv", sAcceptEnv, SSHCFG_ALL },
461 { "permittunnel", sPermitTunnel, SSHCFG_ALL }, 464 { "permittunnel", sPermitTunnel, SSHCFG_ALL },
462 { "permittty", sPermitTTY, SSHCFG_ALL }, 465 { "permittty", sPermitTTY, SSHCFG_ALL },
466 { "permituserrc", sPermitUserRC, SSHCFG_ALL },
463 { "match", sMatch, SSHCFG_ALL }, 467 { "match", sMatch, SSHCFG_ALL },
464 { "permitopen", sPermitOpen, SSHCFG_ALL }, 468 { "permitopen", sPermitOpen, SSHCFG_ALL },
465 { "forcecommand", sForceCommand, SSHCFG_ALL }, 469 { "forcecommand", sForceCommand, SSHCFG_ALL },
@@ -1130,6 +1134,10 @@ process_server_config_line(ServerOptions *options, char *line,
1130 intptr = &options->permit_tty; 1134 intptr = &options->permit_tty;
1131 goto parse_flag; 1135 goto parse_flag;
1132 1136
1137 case sPermitUserRC:
1138 intptr = &options->permit_user_rc;
1139 goto parse_flag;
1140
1133 case sStrictModes: 1141 case sStrictModes:
1134 intptr = &options->strict_modes; 1142 intptr = &options->strict_modes;
1135 goto parse_flag; 1143 goto parse_flag;
@@ -1766,6 +1774,7 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
1766 M_CP_INTOPT(x11_forwarding); 1774 M_CP_INTOPT(x11_forwarding);
1767 M_CP_INTOPT(x11_use_localhost); 1775 M_CP_INTOPT(x11_use_localhost);
1768 M_CP_INTOPT(permit_tty); 1776 M_CP_INTOPT(permit_tty);
1777 M_CP_INTOPT(permit_user_rc);
1769 M_CP_INTOPT(max_sessions); 1778 M_CP_INTOPT(max_sessions);
1770 M_CP_INTOPT(max_authtries); 1779 M_CP_INTOPT(max_authtries);
1771 M_CP_INTOPT(ip_qos_interactive); 1780 M_CP_INTOPT(ip_qos_interactive);
@@ -2007,6 +2016,7 @@ dump_config(ServerOptions *o)
2007 dump_cfg_fmtint(sX11Forwarding, o->x11_forwarding); 2016 dump_cfg_fmtint(sX11Forwarding, o->x11_forwarding);
2008 dump_cfg_fmtint(sX11UseLocalhost, o->x11_use_localhost); 2017 dump_cfg_fmtint(sX11UseLocalhost, o->x11_use_localhost);
2009 dump_cfg_fmtint(sPermitTTY, o->permit_tty); 2018 dump_cfg_fmtint(sPermitTTY, o->permit_tty);
2019 dump_cfg_fmtint(sPermitUserRC, o->permit_user_rc);
2010 dump_cfg_fmtint(sStrictModes, o->strict_modes); 2020 dump_cfg_fmtint(sStrictModes, o->strict_modes);
2011 dump_cfg_fmtint(sTCPKeepAlive, o->tcp_keep_alive); 2021 dump_cfg_fmtint(sTCPKeepAlive, o->tcp_keep_alive);
2012 dump_cfg_fmtint(sEmptyPasswd, o->permit_empty_passwd); 2022 dump_cfg_fmtint(sEmptyPasswd, o->permit_empty_passwd);
diff --git a/servconf.h b/servconf.h
index 752d1c5ae..f2a177649 100644
--- a/servconf.h
+++ b/servconf.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.h,v 1.112 2014/01/29 06:18:35 djm Exp $ */ 1/* $OpenBSD: servconf.h,v 1.113 2014/07/03 22:40:43 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -83,6 +83,7 @@ typedef struct {
83 int x11_use_localhost; /* If true, use localhost for fake X11 server. */ 83 int x11_use_localhost; /* If true, use localhost for fake X11 server. */
84 char *xauth_location; /* Location of xauth program */ 84 char *xauth_location; /* Location of xauth program */
85 int permit_tty; /* If false, deny pty allocation */ 85 int permit_tty; /* If false, deny pty allocation */
86 int permit_user_rc; /* If false, deny ~/.ssh/rc execution */
86 int strict_modes; /* If true, require string home dir modes. */ 87 int strict_modes; /* If true, require string home dir modes. */
87 int tcp_keep_alive; /* If true, set SO_KEEPALIVE. */ 88 int tcp_keep_alive; /* If true, set SO_KEEPALIVE. */
88 int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */ 89 int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */
diff --git a/session.c b/session.c
index 821867d59..b5979dd91 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.c,v 1.272 2014/07/03 03:34:09 djm Exp $ */ 1/* $OpenBSD: session.c,v 1.273 2014/07/03 22:40:43 djm 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
@@ -1359,7 +1359,8 @@ do_rc_files(Session *s, const char *shell)
1359 1359
1360 /* ignore _PATH_SSH_USER_RC for subsystems and admin forced commands */ 1360 /* ignore _PATH_SSH_USER_RC for subsystems and admin forced commands */
1361 if (!s->is_subsystem && options.adm_forced_command == NULL && 1361 if (!s->is_subsystem && options.adm_forced_command == NULL &&
1362 !no_user_rc && stat(_PATH_SSH_USER_RC, &st) >= 0) { 1362 !no_user_rc && options.permit_user_rc &&
1363 stat(_PATH_SSH_USER_RC, &st) >= 0) {
1363 snprintf(cmd, sizeof cmd, "%s -c '%s %s'", 1364 snprintf(cmd, sizeof cmd, "%s -c '%s %s'",
1364 shell, _PATH_BSHELL, _PATH_SSH_USER_RC); 1365 shell, _PATH_BSHELL, _PATH_SSH_USER_RC);
1365 if (debug_flag) 1366 if (debug_flag)
diff --git a/sshd.8 b/sshd.8
index 3f27521d9..01459d637 100644
--- a/sshd.8
+++ b/sshd.8
@@ -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.275 2014/04/19 18:15:16 tedu Exp $ 36.\" $OpenBSD: sshd.8,v 1.276 2014/07/03 22:40:43 djm Exp $
37.Dd $Mdocdate: April 19 2014 $ 37.Dd $Mdocdate: July 3 2014 $
38.Dt SSHD 8 38.Dt SSHD 8
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -408,7 +408,10 @@ Changes to user's home directory.
408.It 408.It
409If 409If
410.Pa ~/.ssh/rc 410.Pa ~/.ssh/rc
411exists, runs it; else if 411exists and the
412.Xr sshd_config 5
413.Cm PermitUserRC
414option is set, runs it; else if
412.Pa /etc/ssh/sshrc 415.Pa /etc/ssh/sshrc
413exists, runs 416exists, runs
414it; otherwise runs xauth. 417it; otherwise runs xauth.
diff --git a/sshd_config.5 b/sshd_config.5
index 88be8d984..06fd62de7 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -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_config.5,v 1.173 2014/03/28 05:17:11 naddy Exp $ 36.\" $OpenBSD: sshd_config.5,v 1.174 2014/07/03 22:40:43 djm Exp $
37.Dd $Mdocdate: March 28 2014 $ 37.Dd $Mdocdate: July 3 2014 $
38.Dt SSHD_CONFIG 5 38.Dt SSHD_CONFIG 5
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -912,6 +912,7 @@ Available keywords are
912.Cm PermitRootLogin , 912.Cm PermitRootLogin ,
913.Cm PermitTTY , 913.Cm PermitTTY ,
914.Cm PermitTunnel , 914.Cm PermitTunnel ,
915.Cm PermitUserRC ,
915.Cm PubkeyAuthentication , 916.Cm PubkeyAuthentication ,
916.Cm RekeyLimit , 917.Cm RekeyLimit ,
917.Cm RhostsRSAAuthentication , 918.Cm RhostsRSAAuthentication ,
@@ -1060,6 +1061,12 @@ The default is
1060Enabling environment processing may enable users to bypass access 1061Enabling environment processing may enable users to bypass access
1061restrictions in some configurations using mechanisms such as 1062restrictions in some configurations using mechanisms such as
1062.Ev LD_PRELOAD . 1063.Ev LD_PRELOAD .
1064.It Cm PermitUserRC
1065Specifies whether any
1066.Pa ~/.ssh/rc
1067file is executed.
1068The default is
1069.Dq yes .
1063.It Cm PidFile 1070.It Cm PidFile
1064Specifies the file that contains the process ID of the 1071Specifies the file that contains the process ID of the
1065SSH daemon. 1072SSH daemon.