All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Justin P. Mattock" <justinmattock@gmail.com>
To: imsand@puzzle.ch
Cc: selinux@tycho.nsa.gov
Subject: Re: Context settings after ssh login
Date: Mon, 04 Oct 2010 10:13:19 -0700	[thread overview]
Message-ID: <4CAA0B2F.7020204@gmail.com> (raw)
In-Reply-To: <30011.193.5.216.100.1286179426.squirrel@mail.puzzle.ch>

On 10/04/2010 01:03 AM, imsand@puzzle.ch wrote:
> Hello
>
> I'm working on SUSE SLES11SP1 and encounter the following problem.
> Setting the context of the User after ssh login doesn't work if the
> SELinux Username and the Linux Username aren't identical.
>
> --------------
> Here is an example (SElinux User=mat_u, Linux User=mat_u):
> Oct  4 09:41:54 testsrv.example sshd[15829]: Accepted
> keyboard-interactive/pam for mat_u from 131.102.233.125 port 54714 ssh2
> Oct  4 09:41:54 testsrv.example sshd[15829]: pam_selinux(sshd:session):
> Open Session
> Oct  4 09:41:54 testsrv.example sshd[15829]: pam_selinux(sshd:session):
> Open Session
> Oct  4 09:41:54 testsrv.example sshd[15829]: pam_selinux(sshd:session):
> Username= mat_u SELinux User = user_u Level= (null)
> Oct  4 09:41:54 testsrv.example sshd[15829]: pam_selinux(sshd:session):
> set mat_u security context to user_u:user_r:user_t
> Oct  4 09:41:54 testsrv.example sshd[15829]: pam_selinux(sshd:session):
> set mat_u key creation context to user_u:user_r:user_t
> ---
> mat_u@testsrv.example:~>  id
> uid=6575(mat_u) gid=100(users) groups=16(dialout),33(video),100(users)
> context=mat_u:staff_r:staff_t
> mat_u@testsrv.example:~>  newrole -r sysadm_r
> mat_u@testsrv.example:~>  id
> uid=6575(mat_u) gid=100(users) groups=16(dialout),33(video),100(users)
> context=mat_u:sysadm_r:sysadm_t
> --------------------
>
> So, this is okey. The user's context after login is "mat_u:staff_r:staff_t"
>
> But, if the Linux User is different from the SELinux User, the default
> user's will be chosen instead.
>
> Here is the example (SELinux User=mat_u, Linux User=mat):
> ---------------------
> Oct  4 09:46:22 testsrv.example sshd[16185]: Accepted
> keyboard-interactive/pam for mat from 131.102.233.125 port 54726 ssh2
> Oct  4 09:46:22 testsrv.example sshd[16185]: pam_selinux(sshd:session):
> Open Session
> Oct  4 09:46:22 testsrv.example sshd[16185]: pam_selinux(sshd:session):
> Open Session
> Oct  4 09:46:22 testsrv.example sshd[16185]: pam_selinux(sshd:session):
> Username= mat SELinux User = mat_u Level= (null)
> Oct  4 09:46:22 testsrv.example sshd[16185]: pam_selinux(sshd:session):
> set mat security context to mat_u:staff_r:staff_t
> Oct  4 09:46:22 testsrv.example sshd[16185]: pam_selinux(sshd:session):
> set mat key creation context to mat_u:staff_r:staff_t
> ---
> mat_u@testsrv.example:~>  id
> uid=6575(mat) gid=100(users) groups=16(dialout),33(video),100(users)
> context=user_u:user_r:user_t
>
> mat_u@testsrv.example:~>  newrole -r sysadm_r
> user_u:sysadm_r:sysadm_t is not a valid context
> ---------------------
>
> As you can see, the pam_selinux module recognizes that the new context
> should be "mat_u:staff_r:staff_t", but for some reason the real context is
> user_u:user_r:user_t. Changing the context with newrole doesn't work
> either...
>
> The user mappings should be okey:
> ------
> semanage user -l | grep mat
> mat_u           staff_r sysadm_r
> testsrv.example:~ # semanage login -l | grep mat
> mat
> -------
>
> Any idea out there? Do I miss something?
> kind regards
> Matthias
>
>
> --
> This message was distributed to subscribers of the selinux mailing list.
> If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> the words "unsubscribe selinux" without quotes as the message.
>

you can specify the context in 
/etc/selinux/policy/contexts/users/whatroleyouused
(under sshd) I normally set user_r:user_t:s0


Justin P. Mattock

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2010-10-04 17:13 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04  8:03 Context settings after ssh login imsand
2010-10-04 17:13 ` Justin P. Mattock [this message]
2010-10-05  6:30   ` imsand
2010-10-05 13:29     ` Justin P. Mattock
2010-10-05 13:38       ` imsand
2010-10-05 14:29         ` Justin P. Mattock
2010-10-06  6:43           ` imsand
2010-10-06  7:06             ` Justin P. Mattock
2010-10-06  7:29               ` imsand
2010-10-06 13:50                 ` Justin P. Mattock
2010-10-06 13:50                   ` [refpolicy] " Justin P. Mattock
2010-10-07 14:40                 ` Chad Sellers
2010-10-07 16:11                   ` Daniel J Walsh
2010-10-07 17:24                     ` Justin P. Mattock
2010-10-19 14:42                       ` imsand
2010-10-19 14:55                         ` Justin P. Mattock
2010-10-19 15:47                           ` imsand
2010-10-19 16:38                             ` Justin P. Mattock
2010-10-20  8:42                               ` imsand
2010-10-20 12:27                                 ` Daniel J Walsh
2010-10-20 13:46                                 ` Justin P. Mattock
2010-10-20 14:25                                   ` imsand
2010-10-20 14:52                                     ` Justin P. Mattock
2010-10-21 12:09                                       ` imsand
2010-10-21 13:33                                         ` Justin P. Mattock
2010-10-24 23:43                                         ` Russell Coker
2010-10-23  6:28                                     ` Justin P. Mattock
2010-10-23 20:05                                     ` Justin P. Mattock
2010-10-25  7:09                                       ` imsand
2010-10-25  7:57                                         ` Justin P. Mattock
2010-10-25  8:22                                           ` Justin P. Mattock
2010-10-26  8:27                                             ` imsand
2010-10-26 14:26                                               ` Justin P. Mattock
2010-10-28 13:23                                               ` Justin P. Mattock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CAA0B2F.7020204@gmail.com \
    --to=justinmattock@gmail.com \
    --cc=imsand@puzzle.ch \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.