diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-02-09 16:09:49 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-03-20 00:24:48 +0000 |
commit | ae32d626ed3d15cfd7f432358b63c005961921df (patch) | |
tree | 1c46579409f5f692ec7db009bc716d980451095f /session.c | |
parent | 9dfcd1a0e691c1cad34b168e27b3ed31ab6986cd (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
@@ -1502,7 +1502,7 @@ safely_chroot(const char *path, uid_t uid) | |||
1502 | 1502 | ||
1503 | /* Set login name, uid, gid, and groups. */ | 1503 | /* Set login name, uid, gid, and groups. */ |
1504 | void | 1504 | void |
1505 | do_setusercontext(struct passwd *pw) | 1505 | do_setusercontext(struct passwd *pw, const char *role) |
1506 | { | 1506 | { |
1507 | char *chroot_path, *tmp; | 1507 | char *chroot_path, *tmp; |
1508 | 1508 | ||
@@ -1530,7 +1530,7 @@ do_setusercontext(struct passwd *pw) | |||
1530 | endgrent(); | 1530 | endgrent(); |
1531 | #endif | 1531 | #endif |
1532 | 1532 | ||
1533 | platform_setusercontext_post_groups(pw); | 1533 | platform_setusercontext_post_groups(pw, role); |
1534 | 1534 | ||
1535 | if (options.chroot_directory != NULL && | 1535 | if (options.chroot_directory != NULL && |
1536 | strcasecmp(options.chroot_directory, "none") != 0) { | 1536 | strcasecmp(options.chroot_directory, "none") != 0) { |
@@ -1679,7 +1679,7 @@ do_child(Session *s, const char *command) | |||
1679 | 1679 | ||
1680 | /* Force a password change */ | 1680 | /* Force a password change */ |
1681 | if (s->authctxt->force_pwchange) { | 1681 | if (s->authctxt->force_pwchange) { |
1682 | do_setusercontext(pw); | 1682 | do_setusercontext(pw, s->authctxt->role); |
1683 | child_close_fds(); | 1683 | child_close_fds(); |
1684 | do_pwchange(s); | 1684 | do_pwchange(s); |
1685 | exit(1); | 1685 | exit(1); |
@@ -1706,7 +1706,7 @@ do_child(Session *s, const char *command) | |||
1706 | /* When PAM is enabled we rely on it to do the nologin check */ | 1706 | /* When PAM is enabled we rely on it to do the nologin check */ |
1707 | if (!options.use_pam) | 1707 | if (!options.use_pam) |
1708 | do_nologin(pw); | 1708 | do_nologin(pw); |
1709 | do_setusercontext(pw); | 1709 | do_setusercontext(pw, s->authctxt->role); |
1710 | /* | 1710 | /* |
1711 | * PAM session modules in do_setusercontext may have | 1711 | * PAM session modules in do_setusercontext may have |
1712 | * generated messages, so if this in an interactive | 1712 | * generated messages, so if this in an interactive |
@@ -2117,7 +2117,7 @@ session_pty_req(Session *s) | |||
2117 | tty_parse_modes(s->ttyfd, &n_bytes); | 2117 | tty_parse_modes(s->ttyfd, &n_bytes); |
2118 | 2118 | ||
2119 | if (!use_privsep) | 2119 | if (!use_privsep) |
2120 | pty_setowner(s->pw, s->tty); | 2120 | pty_setowner(s->pw, s->tty, s->authctxt->role); |
2121 | 2121 | ||
2122 | /* Set window size from the packet. */ | 2122 | /* Set window size from the packet. */ |
2123 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); | 2123 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); |