diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-02-09 16:09:49 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2019-10-09 23:06:25 +0100 |
commit | 3131e3bb3c56a6c6ee8cb9d68f542af04cd9e8ff (patch) | |
tree | fb2bdf39ed7ad6111f501712d2d9346a55528214 /session.c | |
parent | 57c1dd662f9259f58a47801e2d4b0f84e973441d (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: 2019-06-05
Patch-Name: selinux-role.patch
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1356,7 +1356,7 @@ safely_chroot(const char *path, uid_t uid) | |||
1356 | 1356 | ||
1357 | /* Set login name, uid, gid, and groups. */ | 1357 | /* Set login name, uid, gid, and groups. */ |
1358 | void | 1358 | void |
1359 | do_setusercontext(struct passwd *pw) | 1359 | do_setusercontext(struct passwd *pw, const char *role) |
1360 | { | 1360 | { |
1361 | char uidstr[32], *chroot_path, *tmp; | 1361 | char uidstr[32], *chroot_path, *tmp; |
1362 | 1362 | ||
@@ -1384,7 +1384,7 @@ do_setusercontext(struct passwd *pw) | |||
1384 | endgrent(); | 1384 | endgrent(); |
1385 | #endif | 1385 | #endif |
1386 | 1386 | ||
1387 | platform_setusercontext_post_groups(pw); | 1387 | platform_setusercontext_post_groups(pw, role); |
1388 | 1388 | ||
1389 | if (!in_chroot && options.chroot_directory != NULL && | 1389 | if (!in_chroot && options.chroot_directory != NULL && |
1390 | strcasecmp(options.chroot_directory, "none") != 0) { | 1390 | strcasecmp(options.chroot_directory, "none") != 0) { |
@@ -1525,7 +1525,7 @@ do_child(struct ssh *ssh, Session *s, const char *command) | |||
1525 | 1525 | ||
1526 | /* Force a password change */ | 1526 | /* Force a password change */ |
1527 | if (s->authctxt->force_pwchange) { | 1527 | if (s->authctxt->force_pwchange) { |
1528 | do_setusercontext(pw); | 1528 | do_setusercontext(pw, s->authctxt->role); |
1529 | child_close_fds(ssh); | 1529 | child_close_fds(ssh); |
1530 | do_pwchange(s); | 1530 | do_pwchange(s); |
1531 | exit(1); | 1531 | exit(1); |
@@ -1543,7 +1543,7 @@ do_child(struct ssh *ssh, Session *s, const char *command) | |||
1543 | /* When PAM is enabled we rely on it to do the nologin check */ | 1543 | /* When PAM is enabled we rely on it to do the nologin check */ |
1544 | if (!options.use_pam) | 1544 | if (!options.use_pam) |
1545 | do_nologin(pw); | 1545 | do_nologin(pw); |
1546 | do_setusercontext(pw); | 1546 | do_setusercontext(pw, s->authctxt->role); |
1547 | /* | 1547 | /* |
1548 | * PAM session modules in do_setusercontext may have | 1548 | * PAM session modules in do_setusercontext may have |
1549 | * generated messages, so if this in an interactive | 1549 | * generated messages, so if this in an interactive |
@@ -1942,7 +1942,7 @@ session_pty_req(struct ssh *ssh, Session *s) | |||
1942 | sshpkt_fatal(ssh, r, "%s: parse packet", __func__); | 1942 | sshpkt_fatal(ssh, r, "%s: parse packet", __func__); |
1943 | 1943 | ||
1944 | if (!use_privsep) | 1944 | if (!use_privsep) |
1945 | pty_setowner(s->pw, s->tty); | 1945 | pty_setowner(s->pw, s->tty, s->authctxt->role); |
1946 | 1946 | ||
1947 | /* Set window size from the packet. */ | 1947 | /* Set window size from the packet. */ |
1948 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); | 1948 | pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); |