diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-02-09 16:09:49 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-02-29 12:32:23 +0000 |
commit | a00cba810338ce920de432e7797a45794bf280ba (patch) | |
tree | 2e9b6cc4f62364ecfdd99aa8b409e84ad6637a8c /session.c | |
parent | 9496f70a8203592158275489519996476b2356af (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: 2015-08-19
Patch-Name: selinux-role.patch
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1489,7 +1489,7 @@ safely_chroot(const char *path, uid_t uid) | |||
1489 | 1489 | ||
1490 | /* Set login name, uid, gid, and groups. */ | 1490 | /* Set login name, uid, gid, and groups. */ |
1491 | void | 1491 | void |
1492 | do_setusercontext(struct passwd *pw) | 1492 | do_setusercontext(struct passwd *pw, const char *role) |
1493 | { | 1493 | { |
1494 | char *chroot_path, *tmp; | 1494 | char *chroot_path, *tmp; |
1495 | 1495 | ||
@@ -1517,7 +1517,7 @@ do_setusercontext(struct passwd *pw) | |||
1517 | endgrent(); | 1517 | endgrent(); |
1518 | #endif | 1518 | #endif |
1519 | 1519 | ||
1520 | platform_setusercontext_post_groups(pw); | 1520 | platform_setusercontext_post_groups(pw, role); |
1521 | 1521 | ||
1522 | if (!in_chroot && options.chroot_directory != NULL && | 1522 | if (!in_chroot && options.chroot_directory != NULL && |
1523 | strcasecmp(options.chroot_directory, "none") != 0) { | 1523 | 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); |