diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-02-09 16:09:49 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-03-19 16:40:05 +0000 |
commit | 7afb9ad9307191397a3ccf3d7cc90dfe474b09e8 (patch) | |
tree | 967f2f81e8a07f299e132b82f949a3c5d202125a /session.c | |
parent | 429c595dbaff7f7c2b3a53fe4235211f6d788025 (diff) |
Handle SELinux authorisation roles
Rejected upstream due to discomfort with magic usernames; a better approach
will need an SSH protocol change. In the meantime, this came from Debian's
SELinux maintainer, so we'll keep it until we have something better.
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1641
Bug-Debian: http://bugs.debian.org/394795
Last-Update: 2013-09-14
Patch-Name: selinux-role.patch
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1497,7 +1497,7 @@ safely_chroot(const char *path, uid_t uid) | |||
1497 | 1497 | ||
1498 | /* Set login name, uid, gid, and groups. */ | 1498 | /* Set login name, uid, gid, and groups. */ |
1499 | void | 1499 | void |
1500 | do_setusercontext(struct passwd *pw) | 1500 | do_setusercontext(struct passwd *pw, const char *role) |
1501 | { | 1501 | { |
1502 | char *chroot_path, *tmp; | 1502 | char *chroot_path, *tmp; |
1503 | 1503 | ||
@@ -1525,7 +1525,7 @@ do_setusercontext(struct passwd *pw) | |||
1525 | endgrent(); | 1525 | endgrent(); |
1526 | #endif | 1526 | #endif |
1527 | 1527 | ||
1528 | platform_setusercontext_post_groups(pw); | 1528 | platform_setusercontext_post_groups(pw, role); |
1529 | 1529 | ||
1530 | if (options.chroot_directory != NULL && | 1530 | if (options.chroot_directory != NULL && |
1531 | strcasecmp(options.chroot_directory, "none") != 0) { | 1531 | strcasecmp(options.chroot_directory, "none") != 0) { |
@@ -1674,7 +1674,7 @@ do_child(Session *s, const char *command) | |||
1674 | 1674 | ||
1675 | /* Force a password change */ | 1675 | /* Force a password change */ |
1676 | if (s->authctxt->force_pwchange) { | 1676 | if (s->authctxt->force_pwchange) { |
1677 | do_setusercontext(pw); | 1677 | do_setusercontext(pw, s->authctxt->role); |
1678 | child_close_fds(); | 1678 | child_close_fds(); |
1679 | do_pwchange(s); | 1679 | do_pwchange(s); |
1680 | exit(1); | 1680 | exit(1); |
@@ -1701,7 +1701,7 @@ do_child(Session *s, const char *command) | |||
1701 | /* When PAM is enabled we rely on it to do the nologin check */ | 1701 | /* When PAM is enabled we rely on it to do the nologin check */ |
1702 | if (!options.use_pam) | 1702 | if (!options.use_pam) |
1703 | do_nologin(pw); | 1703 | do_nologin(pw); |
1704 | do_setusercontext(pw); | 1704 | do_setusercontext(pw, s->authctxt->role); |
1705 | /* | 1705 | /* |
1706 | * PAM session modules in do_setusercontext may have | 1706 | * PAM session modules in do_setusercontext may have |
1707 | * generated messages, so if this in an interactive | 1707 | * generated messages, so if this in an interactive |
@@ -2112,7 +2112,7 @@ session_pty_req(Session *s) | |||
2112 | tty_parse_modes(s->ttyfd, &n_bytes); | 2112 | tty_parse_modes(s->ttyfd, &n_bytes); |
2113 | 2113 | ||
2114 | if (!use_privsep) | 2114 | if (!use_privsep) |
2115 | pty_setowner(s->pw, s->tty); | 2115 | pty_setowner(s->pw, s->tty, s->authctxt->role); |
2116 | 2116 | ||
2117 | /* Set window size from the packet. */ | 2117 | /* Set window size from the packet. */ |
2118 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); | 2118 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); |