View | Details | Raw Unified | Return to bug 2062 | Differences between
and this patch

Collapse All | Expand All

(-)auth.c (-2 / +3 lines)
Lines 156-163 Link Here
156
	 * Deny if shell does not exist or is not executable unless we
156
	 * Deny if shell does not exist or is not executable unless we
157
	 * are chrooting.
157
	 * are chrooting.
158
	 */
158
	 */
159
	if (options.chroot_directory == NULL ||
159
	if (options.adm_forced_shell == NULL &&
160
	    strcasecmp(options.chroot_directory, "none") == 0) {
160
	    (options.chroot_directory == NULL ||
161
	    strcasecmp(options.chroot_directory, "none") == 0)) {
161
		char *shell = xstrdup((pw->pw_shell[0] == '\0') ?
162
		char *shell = xstrdup((pw->pw_shell[0] == '\0') ?
162
		    _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */
163
		    _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */
163
164
(-)servconf.c (-1 / +14 lines)
Lines 146-151 Link Here
146
	options->ip_qos_interactive = -1;
146
	options->ip_qos_interactive = -1;
147
	options->ip_qos_bulk = -1;
147
	options->ip_qos_bulk = -1;
148
	options->version_addendum = NULL;
148
	options->version_addendum = NULL;
149
	options->adm_forced_shell = NULL;
149
}
150
}
150
151
151
void
152
void
Lines 334-340 Link Here
334
	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
335
	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
335
	sKexAlgorithms, sIPQoS, sVersionAddendum,
336
	sKexAlgorithms, sIPQoS, sVersionAddendum,
336
	sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
337
	sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
337
	sAuthenticationMethods,
338
	sAuthenticationMethods, sForceShell,
338
	sDeprecated, sUnsupported
339
	sDeprecated, sUnsupported
339
} ServerOpCodes;
340
} ServerOpCodes;
340
341
Lines 463-468 Link Here
463
	{ "authorizedkeyscommanduser", sAuthorizedKeysCommandUser, SSHCFG_ALL },
464
	{ "authorizedkeyscommanduser", sAuthorizedKeysCommandUser, SSHCFG_ALL },
464
	{ "versionaddendum", sVersionAddendum, SSHCFG_GLOBAL },
465
	{ "versionaddendum", sVersionAddendum, SSHCFG_GLOBAL },
465
	{ "authenticationmethods", sAuthenticationMethods, SSHCFG_ALL },
466
	{ "authenticationmethods", sAuthenticationMethods, SSHCFG_ALL },
467
	{ "forceshell", sForceShell, SSHCFG_ALL },
466
	{ NULL, sBadOption, 0 }
468
	{ NULL, sBadOption, 0 }
467
};
469
};
468
470
Lines 1552-1557 Link Here
1552
		}
1554
		}
1553
		return 0;
1555
		return 0;
1554
1556
1557
	case sForceShell:
1558
		if (cp == NULL)
1559
			fatal("%.200s line %d: Missing argument.", filename,
1560
			    linenum);
1561
		len = strspn(cp, WHITESPACE);
1562
		if (*activep && options->adm_forced_shell == NULL)
1563
			options->adm_forced_shell = xstrdup(cp + len);
1564
		return 0;
1565
1555
	case sDeprecated:
1566
	case sDeprecated:
1556
		logit("%s line %d: Deprecated option %s",
1567
		logit("%s line %d: Deprecated option %s",
1557
		    filename, linenum, arg);
1568
		    filename, linenum, arg);
Lines 1731-1736 Link Here
1731
1742
1732
	M_CP_STROPT(adm_forced_command);
1743
	M_CP_STROPT(adm_forced_command);
1733
	M_CP_STROPT(chroot_directory);
1744
	M_CP_STROPT(chroot_directory);
1745
	M_CP_STROPT(adm_forced_shell);
1734
}
1746
}
1735
1747
1736
#undef M_CP_INTOPT
1748
#undef M_CP_INTOPT
Lines 1968-1973 Link Here
1968
	dump_cfg_string(sVersionAddendum, o->version_addendum);
1980
	dump_cfg_string(sVersionAddendum, o->version_addendum);
1969
	dump_cfg_string(sAuthorizedKeysCommand, o->authorized_keys_command);
1981
	dump_cfg_string(sAuthorizedKeysCommand, o->authorized_keys_command);
1970
	dump_cfg_string(sAuthorizedKeysCommandUser, o->authorized_keys_command_user);
1982
	dump_cfg_string(sAuthorizedKeysCommandUser, o->authorized_keys_command_user);
1983
	dump_cfg_string(sForceShell, o->adm_forced_shell);
1971
1984
1972
	/* string arguments requiring a lookup */
1985
	/* string arguments requiring a lookup */
1973
	dump_cfg_string(sLogLevel, log_level_name(o->log_level));
1986
	dump_cfg_string(sLogLevel, log_level_name(o->log_level));
(-)servconf.h (+1 lines)
Lines 180-185 Link Here
180
180
181
	u_int	num_auth_methods;
181
	u_int	num_auth_methods;
182
	char   *auth_methods[MAX_AUTH_METHODS];
182
	char   *auth_methods[MAX_AUTH_METHODS];
183
	char   *adm_forced_shell;
183
}       ServerOptions;
184
}       ServerOptions;
184
185
185
/* Information about the incoming connection as used by Match */
186
/* Information about the incoming connection as used by Match */
(-)session.c (-1 / +5 lines)
Lines 821-827 Link Here
821
	else if (s->ttyfd == -1) {
821
	else if (s->ttyfd == -1) {
822
		char *shell = s->pw->pw_shell;
822
		char *shell = s->pw->pw_shell;
823
823
824
		if (shell[0] == '\0')	/* empty shell means /bin/sh */
824
		if (options.adm_forced_shell)
825
			shell = options.adm_forced_shell;
826
		else if (shell[0] == '\0')	/* empty shell means /bin/sh */
825
			shell =_PATH_BSHELL;
827
			shell =_PATH_BSHELL;
826
		PRIVSEP(audit_run_command(shell));
828
		PRIVSEP(audit_run_command(shell));
827
	}
829
	}
Lines 1679-1684 Link Here
1679
	 * legal, and means /bin/sh.
1681
	 * legal, and means /bin/sh.
1680
	 */
1682
	 */
1681
	shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell;
1683
	shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell;
1684
	if (options.adm_forced_shell)
1685
		shell = options.adm_forced_shell;
1682
1686
1683
	/*
1687
	/*
1684
	 * Make sure $SHELL points to the shell from the password file,
1688
	 * Make sure $SHELL points to the shell from the password file,
(-)sshd_config.5 (+9 lines)
Lines 456-461 Link Here
456
will force the use of an in-process sftp server that requires no support
456
will force the use of an in-process sftp server that requires no support
457
files when used with
457
files when used with
458
.Cm ChrootDirectory .
458
.Cm ChrootDirectory .
459
.It Cm ForceShell
460
Executes the command specified by
461
.Cm ForceShell
462
in place of the user's normal login shell.
463
This applies to shell, command, or subsystem execution.
464
It is most useful inside a
465
.Cm Match
466
block.
459
.It Cm GatewayPorts
467
.It Cm GatewayPorts
460
Specifies whether remote hosts are allowed to connect to ports
468
Specifies whether remote hosts are allowed to connect to ports
461
forwarded for the client.
469
forwarded for the client.
Lines 785-790 Link Here
785
.Cm DenyGroups ,
793
.Cm DenyGroups ,
786
.Cm DenyUsers ,
794
.Cm DenyUsers ,
787
.Cm ForceCommand ,
795
.Cm ForceCommand ,
796
.Cm ForceShell ,
788
.Cm GatewayPorts ,
797
.Cm GatewayPorts ,
789
.Cm GSSAPIAuthentication ,
798
.Cm GSSAPIAuthentication ,
790
.Cm HostbasedAuthentication ,
799
.Cm HostbasedAuthentication ,

Return to bug 2062