diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-02-09 16:09:49 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:17:20 +0000 |
commit | 07f2a771c490bd68cd5c5ea9c535705e93bd94f3 (patch) | |
tree | 3e2ead17b4c91699c13b0417d46bfd750a04e0b8 /session.c | |
parent | 950be7e1b1a01ee9b25e2a72726a6370b8acacb6 (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
@@ -1474,7 +1474,7 @@ safely_chroot(const char *path, uid_t uid) | |||
1474 | 1474 | ||
1475 | /* Set login name, uid, gid, and groups. */ | 1475 | /* Set login name, uid, gid, and groups. */ |
1476 | void | 1476 | void |
1477 | do_setusercontext(struct passwd *pw) | 1477 | do_setusercontext(struct passwd *pw, const char *role) |
1478 | { | 1478 | { |
1479 | char *chroot_path, *tmp; | 1479 | char *chroot_path, *tmp; |
1480 | 1480 | ||
@@ -1502,7 +1502,7 @@ do_setusercontext(struct passwd *pw) | |||
1502 | endgrent(); | 1502 | endgrent(); |
1503 | #endif | 1503 | #endif |
1504 | 1504 | ||
1505 | platform_setusercontext_post_groups(pw); | 1505 | platform_setusercontext_post_groups(pw, role); |
1506 | 1506 | ||
1507 | if (options.chroot_directory != NULL && | 1507 | if (options.chroot_directory != NULL && |
1508 | strcasecmp(options.chroot_directory, "none") != 0) { | 1508 | strcasecmp(options.chroot_directory, "none") != 0) { |
@@ -1646,7 +1646,7 @@ do_child(Session *s, const char *command) | |||
1646 | 1646 | ||
1647 | /* Force a password change */ | 1647 | /* Force a password change */ |
1648 | if (s->authctxt->force_pwchange) { | 1648 | if (s->authctxt->force_pwchange) { |
1649 | do_setusercontext(pw); | 1649 | do_setusercontext(pw, s->authctxt->role); |
1650 | child_close_fds(); | 1650 | child_close_fds(); |
1651 | do_pwchange(s); | 1651 | do_pwchange(s); |
1652 | exit(1); | 1652 | exit(1); |
@@ -1673,7 +1673,7 @@ do_child(Session *s, const char *command) | |||
1673 | /* When PAM is enabled we rely on it to do the nologin check */ | 1673 | /* When PAM is enabled we rely on it to do the nologin check */ |
1674 | if (!options.use_pam) | 1674 | if (!options.use_pam) |
1675 | do_nologin(pw); | 1675 | do_nologin(pw); |
1676 | do_setusercontext(pw); | 1676 | do_setusercontext(pw, s->authctxt->role); |
1677 | /* | 1677 | /* |
1678 | * PAM session modules in do_setusercontext may have | 1678 | * PAM session modules in do_setusercontext may have |
1679 | * generated messages, so if this in an interactive | 1679 | * generated messages, so if this in an interactive |
@@ -2084,7 +2084,7 @@ session_pty_req(Session *s) | |||
2084 | tty_parse_modes(s->ttyfd, &n_bytes); | 2084 | tty_parse_modes(s->ttyfd, &n_bytes); |
2085 | 2085 | ||
2086 | if (!use_privsep) | 2086 | if (!use_privsep) |
2087 | pty_setowner(s->pw, s->tty); | 2087 | pty_setowner(s->pw, s->tty, s->authctxt->role); |
2088 | 2088 | ||
2089 | /* Set window size from the packet. */ | 2089 | /* Set window size from the packet. */ |
2090 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); | 2090 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); |