Skip to contentSkip to conversation

"Error! Unable to set executable context."

DISCUSSION Larry Ross 4 participants 11 messages Jul 25, 2009 – Jul 27, 2009 4 messages not in the archive SELinux security module

lore
Share & tools
lore

Larry Ross

author
#0 lore raw

I am trying to create a custom selinux user for the strict policy on RHEL5.3 I want logins that are mapped to this user to be able to login via gdm, but when they do I get an error "Error! Unable to set executable context."

What does this error message mean?

I am able to login via gdm with logins that are mapped to user_u. I have run the AVCs generated when I login in permissive mode (which succeeds) through audit2allow and gotten to the point where it doesn't seem that I am getting any killer AVCs. What am I missing that is needed for a custom user to use X-Windows? Is there some place I can look to determine what is causing the error?

Thank you,
Larry

/var/log/messages:

 Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm login: unable to obtain

default security context for appuser.

/var/log/audit/audit.log:
type=USER_AUTH msg=audit(1248550033.507:1432): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="?" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=failed)'
type=USER_LOGIN msg=audit(1248550033.507:1433): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='acct=dbapp:
exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=failed)'
type=USER_AUTH msg=audit(1248550043.787:1434): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_ACCT msg=audit(1248550043.789:1435): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM: accounting acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_ACQ msg=audit(1248550043.790:1436): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM: setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)' type=LOGIN msg=audit(1248550043.796:1437): login pid=3003 uid=0 old auid=14022 new auid=14020 old ses=35 new ses=36
type=USER_START msg=audit(1248550043.804:1438): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM: session open acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_LOGIN msg=audit(1248550043.804:1439): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='uid=14020:
exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=success)'
type=USER_END msg=audit(1248550092.461:1440): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM: session close acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_DISP msg=audit(1248550092.461:1441): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM: setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'

#1 lore raw
Quoted 55 lines · Larry Ross

I am trying to create a custom selinux user for the strict policy on RHEL5.3
I want logins that are mapped to this user to be able to login via gdm, but when they do I get an error "Error! Unable to set executable context."

What does this error message mean?

I am able to login via gdm with logins that are mapped to user_u. I have run the AVCs generated when I login in permissive mode (which succeeds) through audit2allow and gotten to the point where it doesn't seem that I am getting any killer AVCs. What am I missing that is needed for a custom user to use X-Windows? Is there some place I can look to determine what is causing the error?

Thank you,
Larry

/var/log/messages:

 Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm login: unable to

obtain default security context for appuser.

/var/log/audit/audit.log:
type=USER_AUTH msg=audit(1248550033.507:1432): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="?" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=failed)'
type=USER_LOGIN msg=audit(1248550033.507:1433): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='acct=dbapp: exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=failed)'
type=USER_AUTH msg=audit(1248550043.787:1434): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="appuser" :
exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_ACCT msg=audit(1248550043.789:1435): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
accounting acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_ACQ msg=audit(1248550043.790:1436): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=LOGIN msg=audit(1248550043.796:1437): login pid=3003 uid=0 old auid=14022 new auid=14020 old ses=35 new ses=36 type=USER_START msg=audit(1248550043.804:1438): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
session open acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_LOGIN msg=audit(1248550043.804:1439): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='uid=14020:
exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=success)'

Quoted 9 lines

type=USER_END msg=audit(1248550092.461:1440): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
session close acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_DISP msg=audit(1248550092.461:1441): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'

probably means you have no default contexts defined for "appuser"

can you show us the output of 'semanage user -l | grep appuser'?

If this user is based of off user_u you could simply:

cp /etc/selinux/contexts/users/user_u /etc/selinux/contexts/users/appuser

but it depends on how your appuser selinux-user is configured ( whats his default domain )

author
#2 lore raw

On Sat, Jul 25, 2009 at 1:16 PM, Dominick Grift <[email protected]> wrote:

Quoted 55 lines · Larry Ross

I am trying to create a custom selinux user for the strict policy on RHEL5.3
I want logins that are mapped to this user to be able to login via gdm, but when they do I get an error "Error! Unable to set executable context."

What does this error message mean?

I am able to login via gdm with logins that are mapped to user_u. I have run the AVCs generated when I login in permissive mode (which succeeds) through audit2allow and gotten to the point where it doesn't seem that I am getting any killer AVCs. What am I missing that is needed for a custom user to use X-Windows? Is there some place I can look to determine what is causing the error?

Thank you,
Larry

/var/log/messages:

 Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm login: unable to

obtain default security context for appuser.

/var/log/audit/audit.log:
type=USER_AUTH msg=audit(1248550033.507:1432): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="?" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=failed)'
type=USER_LOGIN msg=audit(1248550033.507:1433): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='acct=dbapp: exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=failed)'
type=USER_AUTH msg=audit(1248550043.787:1434): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="appuser" :
exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_ACCT msg=audit(1248550043.789:1435): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
accounting acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_ACQ msg=audit(1248550043.790:1436): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=LOGIN msg=audit(1248550043.796:1437): login pid=3003 uid=0 old auid=14022 new auid=14020 old ses=35 new ses=36 type=USER_START msg=audit(1248550043.804:1438): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
session open acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_LOGIN msg=audit(1248550043.804:1439): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='uid=14020:
exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=success)'

Quoted 9 lines

type=USER_END msg=audit(1248550092.461:1440): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
session close acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_DISP msg=audit(1248550092.461:1441): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'

Dominick,
Thank you for your reply.

Quoted 1 line

probably means you have no default contexts defined for "appuser"

How do I define a default context for an selinux user?

Quoted 2 lines

can you show us the output of 'semanage user -l | grep appuser'?

[root@newhost ~]# semanage user -l | grep appuser
returns no results, as I would expect, appuser is a linux login id, not an selinux user.

[root@newhost ~]# semanage login -l | grep appuser
appuser app_user_u s0

Quoted 6 lines

If this user is based of off user_u you could simply:

cp /etc/selinux/contexts/users/user_u /etc/selinux/contexts/users/appuser

but it depends on how your appuser selinux-user is configured ( whats his default domain )

The only thing in /etc/selinux/strict/contexts/users/ is "root", there is no file there for user_u.

-- Larry

#3 lore raw
Quoted 74 lines · Larry Ross

On Sat, Jul 25, 2009 at 1:16 PM, Dominick Grift <[email protected]> wrote:

Quoted 4 lines · Larry Ross

I am trying to create a custom selinux user for the strict policy on RHEL5.3
I want logins that are mapped to this user to be able to login via gdm, but when they do I get an error "Error! Unable to set

executable

Quoted 7 lines

context."

What does this error message mean?

I am able to login via gdm with logins that are mapped to user_u. I have run the AVCs generated when I login in permissive mode (which succeeds) through audit2allow and gotten to the point where it

doesn't

Quoted 2 lines

seem that I am getting any killer AVCs. What am I missing that is needed for a custom user to use X-Windows? Is there some place I

can

Quoted 29 lines

look to determine what is causing the error?

Thank you,
Larry

/var/log/messages:

 Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm login: unable to

obtain default security context for appuser.

/var/log/audit/audit.log:
type=USER_AUTH msg=audit(1248550033.507:1432): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="?" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=failed)'
type=USER_LOGIN msg=audit(1248550033.507:1433): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='acct=dbapp: exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=failed)'
type=USER_AUTH msg=audit(1248550043.787:1434): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
authentication acct="appuser" :
exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=USER_ACCT msg=audit(1248550043.789:1435): user pid=3003 uid=0 auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
accounting acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=CRED_ACQ msg=audit(1248550043.790:1436): user pid=3003 uid=0

Quoted 8 lines

auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'
type=LOGIN msg=audit(1248550043.796:1437): login pid=3003 uid=0 old auid=14022 new auid=14020 old ses=35 new ses=36 type=USER_START msg=audit(1248550043.804:1438): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
session open acct="appuser" :

exe="/usr/sbin/gdm-binary" (hostname=?,

Quoted 3 lines

addr=?, terminal=:0 res=success)'
type=USER_LOGIN msg=audit(1248550043.804:1439): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023

msg='uid=14020:

Quoted 5 lines

exe="/usr/sbin/gdm-binary" (hostname=newhost, addr=127.0.0.1, terminal=:0 res=success)'
type=USER_END msg=audit(1248550092.461:1440): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
session close acct="appuser" :

exe="/usr/sbin/gdm-binary" (hostname=?,

Quoted 6 lines

addr=?, terminal=:0 res=success)'
type=CRED_DISP msg=audit(1248550092.461:1441): user pid=3003 uid=0 auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='PAM:
setcred acct="appuser" : exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, terminal=:0 res=success)'

Quoted 7 lines

Dominick,
Thank you for your reply.

probably means you have no default contexts defined for "appuser"

How do I define a default context for an selinux user?

Well this is how a default contexts file looks for the user_u selinux user in fedora (targeted policy):

[root@notebook2 ~]# cat /etc/selinux/targeted/contexts/users/user_u

system_r:local_login_t:s0       user_r:user_t:s0
system_r:remote_login_t:s0      user_r:user_t:s0
system_r:sshd_t:s0              user_r:user_t:s0
system_r:crond_t:s0             user_r:user_t:s0
system_r:xdm_t:s0               user_r:user_t:s0
user_r:user_su_t:s0             user_r:user_t:s0
user_r:user_sudo_t:s0           user_r:user_t:s0
system_r:initrc_su_t:s0         user_r:user_t:s0
user_r:user_t:s0                user_r:user_t:s0
Quoted 10 lines

can you show us the output of 'semanage user -l | grep appuser'?

[root@newhost ~]# semanage user -l | grep appuser

returns no results, as I would expect, appuser is a linux login id, not an selinux user.

[root@newhost ~]# semanage login -l | grep appuser
appuser app_user_u s0

semanage user -l | grep app_user_u

Quoted 4 lines

If this user is based of off user_u you could simply:

Quoted 8 lines

cp /etc/selinux/contexts/users/user_u /etc/selinux/contexts/users/appuser

but it depends on how your appuser selinux-user is configured ( whats
his default domain )

The only thing in /etc/selinux/strict/contexts/users/ is "root", there is no file there for user_u.

That's weird, i would expect default contexts be defined since you stated that your user_u login works. Maybe it is stored in a different location in el5.

See if you can locate a file called user_u or any other file that may have similar entries as i pasted above in
you /etc/selinux/strict/contexts (and /users).

Quoted 3 lines

-- Larry

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw
Quoted 245 lines · Dominick Grift
Quoted 235 lines · Larry Ross

On Sat, Jul 25, 2009 at 2:46 PM, Dominick Grift <[email protected]> wrote:

        On Sat, 2009-07-25 at 14:31 -0700, Larry Ross wrote:
        > On Sat, Jul 25, 2009 at 2:11 PM, Dominick Grift
        <[email protected]>
        > wrote:
        >
        >         On Sat, 2009-07-25 at 13:59 -0700, Larry Ross wrote:
        >         > On Sat, Jul 25, 2009 at 1:16 PM, Dominick Grift
        >         <[email protected]>
        >         > wrote:
        >         > On Sat, 2009-07-25 at 12:41 -0700, Larry Ross
        wrote:
        >         > > I am trying to create a custom selinux user for
        the strict
        >         policy on
        >         > > RHEL5.3
        >         > > I want logins that are mapped to this user to be
        able to
        >         login via
        >         > > gdm, but when they do I get an error "Error!
        Unable to set
        >         > executable
        >         > > context."
        >         > >
        >         > > What does this error message mean?
        >         > >
        >         > > I am able to login via gdm with logins that are
        mapped to
        >         user_u.  I
        >         > > have run the AVCs generated when I login in
        permissive
        >         mode (which
        >         > > succeeds) through audit2allow and gotten to the
        point
        >         where it
        >         > doesn't
        >         > > seem that I am getting any killer AVCs.  What am
        I missing
        >         that is
        >         > > needed for a custom user to use X-Windows?  Is
        there some
        >         place I
        >         > can
        >         > > look to determine what is causing the error?
        >         > >
        >         > >    Thank you,
        >         > >    Larry
        >         > >
        >         > > /var/log/messages:
        >         > >  Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm
        login:
        >         unable to
        >         > > obtain default security context for appuser.
        >         > >
        >         > >
        >         > >  /var/log/audit/audit.log:
        >         > > type=USER_AUTH msg=audit(1248550033.507:1432):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > authentication acct="?" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=failed)'
        >         > > type=USER_LOGIN msg=audit(1248550033.507:1433):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         > > msg='acct=dbapp:
        >         exe="/usr/sbin/gdm-binary" (hostname=newhost,
        >         > > addr=127.0.0.1, terminal=:0 res=failed)'
        >         > > type=USER_AUTH msg=audit(1248550043.787:1434):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > authentication acct="appuser" :
        >         > > exe="/usr/sbin/gdm-binary" (hostname=?, addr=?,
        >         terminal=:0
        >         > > res=success)'
        >         > > type=USER_ACCT msg=audit(1248550043.789:1435):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > accounting acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=CRED_ACQ msg=audit(1248550043.790:1436):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > setcred acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=LOGIN msg=audit(1248550043.796:1437): login
        pid=3003
        >         uid=0 old
        >         > > auid=14022 new auid=14020 old ses=35 new ses=36
        >         > > type=USER_START msg=audit(1248550043.804:1438):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > session open acct="appuser" :
        >         > exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=USER_LOGIN msg=audit(1248550043.804:1439):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         > msg='uid=14020:
        >         > > exe="/usr/sbin/gdm-binary" (hostname=newhost,
        >         addr=127.0.0.1,
        >         > > terminal=:0 res=success)'
        >         > > type=USER_END msg=audit(1248550092.461:1440):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > session close acct="appuser" :
        >         > exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=CRED_DISP msg=audit(1248550092.461:1441):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > setcred acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > >
        >         >
        >         > Dominick,
        >         >   Thank you for your reply.
        >         >
        >         >         probably means you have no default
        contexts defined
        >         for
        >         >         "appuser"
        >         >
        >         > How do I define a default context for an selinux
        user?
        >
        >
        >         Well this is how a default contexts file looks for
        the user_u
        >         selinux
        >         user in fedora (targeted policy):
        >
        >         [root@notebook2 ~]#
        >         cat /etc/selinux/targeted/contexts/users/user_u
        >         system_r:local_login_t:s0       user_r:user_t:s0
        >         system_r:remote_login_t:s0      user_r:user_t:s0
        >         system_r:sshd_t:s0              user_r:user_t:s0
        >         system_r:crond_t:s0             user_r:user_t:s0
        >         system_r:xdm_t:s0               user_r:user_t:s0
        >         user_r:user_su_t:s0             user_r:user_t:s0
        >         user_r:user_sudo_t:s0           user_r:user_t:s0
        >         system_r:initrc_su_t:s0         user_r:user_t:s0
        >         user_r:user_t:s0                user_r:user_t:s0
        >
        > That looks like the information that is
        > in /etc/selinux/strict/contexts/default_contexts:
        > system_r:sulogin_t:s0   sysadm_r:sysadm_t:s0
        > system_r:local_login_t:s0       staff_r:staff_t:s0
        user_r:user_t:s0
        > sysadm_r:sysadm_t:s0 app_user_r:app_user_t:s0
        > system_r:remote_login_t:s0      user_r:user_t:s0
        staff_r:staff_t:s0
        > system_r:sshd_t:s0              user_r:user_t:s0
        staff_r:staff_t:s0
        > sysadm_r:sysadm_t:s0
        > system_r:crond_t:s0     user_r:user_crond_t:s0
        > staff_r:staff_crond_t:s0 sysadm_r:sysadm_crond_t:s0
        > system_r:system_crond_t:s0 mailman_r:user_crond_t:s0
        > system_r:xdm_t:s0               staff_r:staff_t:s0
        user_r:user_t:s0
        > sysadm_r:sysadm_t:s0 app_user_r:app_user_t:s0
        > staff_r:staff_su_t:s0   staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0
        > sysadm_r:sysadm_su_t:s0 staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0
        > user_r:user_su_t:s0     staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0
        > sysadm_r:sysadm_sudo_t:s0       sysadm_r:sysadm_t:s0
        > staff_r:staff_sudo_t:s0 sysadm_r:sysadm_t:s0
        staff_r:staff_t:s0
        > user_r:user_sudo_t:s0   sysadm_r:sysadm_t:s0
        user_r:user_t:s0
        >
        >
        > I added app_user contexts into that file.  It isn't well
        documented,
        > so I may have done it wrong.


        i would try to add something like this:

        system_r:local_login_t:s0       app_user_r:app_user_t:s0
        system_r:remote_login_t:s0      app_user_r:app_user_t:s0
        system_r:sshd_t:s0              app_user_r:app_user_t:s0
        system_r:crond_t:s0     app_user_r:app_user_crond_t:s0
        system_r:xdm_t:s0               app_user_r:app_user_t:s0
        app_user_r:app_user_su_t:s0     app_user_r:app_user_t:s0
        app_user_r:app_user_sudo_t:s0   app_user_r:app_user_t:s0

        maybe also:

        app_user_r:app_user_t:s0
         app_user_r:app_user_t:s0

        or maybe just append the second column on the rows that also
        have user_t
        above.

        like for example:

        system_r:local_login_t:s0       staff_r:staff_t:s0
        user_r:user_t:s0

        app_user_r:app_user_t:s0
Quoted 4 lines

I thought I had done that, but I see now I missed a few. I appended the app_user contexts to the rows in default_contexts and tried it without success. Is there something I have to do to make the new default_contexts active? Do I have to reboot the machine?

No you should not have to do anything else afaik. Unfortunately my experience with el5 is very limited. I kind of ran out of suggestions.

Quoted 7 lines

You might also check
the /etc/pam.d/gdm, /etc/pam.d/sshd, /etc/pam.d/login to see if they have pam_selinux entries, but i do not think this is related since your user_u and other logins work

Have a good look at /etc/selinux/strict, see if you can find some clues. It may also be that your app_user_t policy has errors.

That is true. That it why I asked the original question about what this error means. What is an "executable context" that the error is referring to? It looks like it is scanning through the default_contexts looking for one that it can transition to. Could it be that there is no rule that allows it to transition from its current context (which I think is xdm_t) to app_user_t? Or am I misunderstanding it?

Quoted 2 lines

Hopefully others can add more suggestions. Although its weekend now so may be a while.

I realize that and thank you for your time.

Just realized that I have been replying to you directly, I meant to leave the whole discussion on the group. Hopefully it hasn't been too mangled.

Quoted 81 lines
Quoted 35 lines

>
>

> > can you show us the output of 'semanage
user -l |
> grep
> > appuser'?
> >
> > [root@newhost ~]# semanage user -l | grep appuser
> >
> > returns no results, as I would expect, appuser is
a linux
> login id,
> > not an selinux user.
> >
> > [root@newhost ~]# semanage login -l | grep appuser
> > appuser app_user_u
s0
>
>
> semanage user -l | grep app_user_u
>
> [root@newhost ~]# semanage user -l | grep app_user_u
> app_user_u app_user s0 s0
> app_user_r
>
>
>
>
> >

Quoted 8 lines

> >
> > If this user is based of off user_u you
could
> simply:
> >
> >
>
cp /etc/selinux/contexts/users/user_u

/etc/selinux/contexts/users/appuser

Quoted 36 lines

> >
> > but it depends on how your appuser
selinux-user is
> configured
> > ( whats
> > his default domain )
> >
> > The only thing
in /etc/selinux/strict/contexts/users/
> > is "root", there is no file there for user_u.
>
>
> That's weird, i would expect default contexts be
defined since
> you
> stated that your user_u login works. Maybe it is
stored in a
> different
> location in el5.
>
> See if you can locate a file called user_u or any
other file
> that may
> have similar entries as i pasted above in
> you /etc/selinux/strict/contexts (and /users).
>
> see above.
>
>
>
> >
> > -- Larry
> >
>

author
#9 lore raw
Quoted 258 lines · Larry Ross
Quoted 245 lines · Dominick Grift
Quoted 235 lines · Larry Ross

On Sat, Jul 25, 2009 at 2:46 PM, Dominick Grift <[email protected]> wrote:

        On Sat, 2009-07-25 at 14:31 -0700, Larry Ross wrote:
        > On Sat, Jul 25, 2009 at 2:11 PM, Dominick Grift
        <[email protected]>
        > wrote:
        >
        >         On Sat, 2009-07-25 at 13:59 -0700, Larry Ross wrote:
        >         > On Sat, Jul 25, 2009 at 1:16 PM, Dominick Grift
        >         <[email protected]>
        >         > wrote:
        >         > On Sat, 2009-07-25 at 12:41 -0700, Larry Ross
        wrote:
        >         > > I am trying to create a custom selinux user for
        the strict
        >         policy on
        >         > > RHEL5.3
        >         > > I want logins that are mapped to this user to be
        able to
        >         login via
        >         > > gdm, but when they do I get an error "Error!
        Unable to set
        >         > executable
        >         > > context."
        >         > >
        >         > > What does this error message mean?
        >         > >
        >         > > I am able to login via gdm with logins that are
        mapped to
        >         user_u.  I
        >         > > have run the AVCs generated when I login in
        permissive
        >         mode (which
        >         > > succeeds) through audit2allow and gotten to the
        point
        >         where it
        >         > doesn't
        >         > > seem that I am getting any killer AVCs.  What am
        I missing
        >         that is
        >         > > needed for a custom user to use X-Windows?  Is
        there some
        >         place I
        >         > can
        >         > > look to determine what is causing the error?
        >         > >
        >         > >    Thank you,
        >         > >    Larry
        >         > >
        >         > > /var/log/messages:
        >         > >  Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm
        login:
        >         unable to
        >         > > obtain default security context for appuser.
        >         > >
        >         > >
        >         > >  /var/log/audit/audit.log:
        >         > > type=USER_AUTH msg=audit(1248550033.507:1432):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > authentication acct="?" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=failed)'
        >         > > type=USER_LOGIN msg=audit(1248550033.507:1433):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         > > msg='acct=dbapp:
        >         exe="/usr/sbin/gdm-binary" (hostname=newhost,
        >         > > addr=127.0.0.1, terminal=:0 res=failed)'
        >         > > type=USER_AUTH msg=audit(1248550043.787:1434):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > authentication acct="appuser" :
        >         > > exe="/usr/sbin/gdm-binary" (hostname=?, addr=?,
        >         terminal=:0
        >         > > res=success)'
        >         > > type=USER_ACCT msg=audit(1248550043.789:1435):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > accounting acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=CRED_ACQ msg=audit(1248550043.790:1436):
        user
        >         pid=3003 uid=0
        >         > > auid=14022
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > setcred acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=LOGIN msg=audit(1248550043.796:1437): login
        pid=3003
        >         uid=0 old
        >         > > auid=14022 new auid=14020 old ses=35 new ses=36
        >         > > type=USER_START msg=audit(1248550043.804:1438):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > session open acct="appuser" :
        >         > exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=USER_LOGIN msg=audit(1248550043.804:1439):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         > msg='uid=14020:
        >         > > exe="/usr/sbin/gdm-binary" (hostname=newhost,
        >         addr=127.0.0.1,
        >         > > terminal=:0 res=success)'
        >         > > type=USER_END msg=audit(1248550092.461:1440):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > session close acct="appuser" :
        >         > exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=CRED_DISP msg=audit(1248550092.461:1441):
        user
        >         pid=3003 uid=0
        >         > > auid=14020
        subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > setcred acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > >
        >         >
        >         > Dominick,
        >         >   Thank you for your reply.
        >         >
        >         >         probably means you have no default
        contexts defined
        >         for
        >         >         "appuser"
        >         >
        >         > How do I define a default context for an selinux
        user?
        >
        >
        >         Well this is how a default contexts file looks for
        the user_u
        >         selinux
        >         user in fedora (targeted policy):
        >
        >         [root@notebook2 ~]#
        >         cat /etc/selinux/targeted/contexts/users/user_u
        >         system_r:local_login_t:s0       user_r:user_t:s0
        >         system_r:remote_login_t:s0      user_r:user_t:s0
        >         system_r:sshd_t:s0              user_r:user_t:s0
        >         system_r:crond_t:s0             user_r:user_t:s0
        >         system_r:xdm_t:s0               user_r:user_t:s0
        >         user_r:user_su_t:s0             user_r:user_t:s0
        >         user_r:user_sudo_t:s0           user_r:user_t:s0
        >         system_r:initrc_su_t:s0         user_r:user_t:s0
        >         user_r:user_t:s0                user_r:user_t:s0
        >
        > That looks like the information that is
        > in /etc/selinux/strict/contexts/default_contexts:
        > system_r:sulogin_t:s0   sysadm_r:sysadm_t:s0
        > system_r:local_login_t:s0       staff_r:staff_t:s0
        user_r:user_t:s0
        > sysadm_r:sysadm_t:s0 app_user_r:app_user_t:s0
        > system_r:remote_login_t:s0      user_r:user_t:s0
        staff_r:staff_t:s0
        > system_r:sshd_t:s0              user_r:user_t:s0
        staff_r:staff_t:s0
        > sysadm_r:sysadm_t:s0
        > system_r:crond_t:s0     user_r:user_crond_t:s0
        > staff_r:staff_crond_t:s0 sysadm_r:sysadm_crond_t:s0
        > system_r:system_crond_t:s0 mailman_r:user_crond_t:s0
        > system_r:xdm_t:s0               staff_r:staff_t:s0
        user_r:user_t:s0
        > sysadm_r:sysadm_t:s0 app_user_r:app_user_t:s0
        > staff_r:staff_su_t:s0   staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0
        > sysadm_r:sysadm_su_t:s0 staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0
        > user_r:user_su_t:s0     staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0
        > sysadm_r:sysadm_sudo_t:s0       sysadm_r:sysadm_t:s0
        > staff_r:staff_sudo_t:s0 sysadm_r:sysadm_t:s0
        staff_r:staff_t:s0
        > user_r:user_sudo_t:s0   sysadm_r:sysadm_t:s0
        user_r:user_t:s0
        >
        >
        > I added app_user contexts into that file.  It isn't well
        documented,
        > so I may have done it wrong.


        i would try to add something like this:

        system_r:local_login_t:s0       app_user_r:app_user_t:s0
        system_r:remote_login_t:s0      app_user_r:app_user_t:s0
        system_r:sshd_t:s0              app_user_r:app_user_t:s0
        system_r:crond_t:s0     app_user_r:app_user_crond_t:s0
        system_r:xdm_t:s0               app_user_r:app_user_t:s0
        app_user_r:app_user_su_t:s0     app_user_r:app_user_t:s0
        app_user_r:app_user_sudo_t:s0   app_user_r:app_user_t:s0

        maybe also:

        app_user_r:app_user_t:s0
         app_user_r:app_user_t:s0

        or maybe just append the second column on the rows that also
        have user_t
        above.

        like for example:

        system_r:local_login_t:s0       staff_r:staff_t:s0
        user_r:user_t:s0

        app_user_r:app_user_t:s0
Quoted 4 lines

I thought I had done that, but I see now I missed a few. I appended the app_user contexts to the rows in default_contexts and tried it without success. Is there something I have to do to make the new default_contexts active? Do I have to reboot the machine?

No you should not have to do anything else afaik. Unfortunately my experience with el5 is very limited. I kind of ran out of suggestions.

Quoted 7 lines

You might also check
the /etc/pam.d/gdm, /etc/pam.d/sshd, /etc/pam.d/login to see if they have pam_selinux entries, but i do not think this is related since your user_u and other logins work

Have a good look at /etc/selinux/strict, see if you can find some clues. It may also be that your app_user_t policy has errors.

Quoted 7 lines

That is true. That it why I asked the original question about what this error means. What is an "executable context" that the error is referring to? It looks like it is scanning through the default_contexts looking for one that it can transition to. Could it be that there is no rule that allows it to transition from its current context (which I think is xdm_t) to app_user_t? Or am I misunderstanding it?

What is the best way to determine what needs to be allowed?

If I run permissive and login as appuser, id in a console window returns:
uid=14020(appuser) gid=14012(nm_user_g) groups=100(users),14012(app_user_g) context=system_u:system_r:xdm_t:SystemLow-SystemHigh
If I run enforcing, I get the message "Error! Unable to set executable context." when I try to log in.

Once I have determined what context is needed, how do I add it to the policy? I don't see any rules in the existing policy for user_u that seem good candidates.

Quoted 97 lines
Quoted 5 lines

Hopefully others can add more suggestions. Although its weekend now so may be a while.

I realize that and thank you for your time.

Just realized that I have been replying to you directly, I meant to leave the whole discussion on the group. Hopefully it hasn't been too mangled.

Quoted 81 lines
Quoted 35 lines

>
>

> > can you show us the output of 'semanage
user -l |
> grep
> > appuser'?
> >
> > [root@newhost ~]# semanage user -l | grep appuser
> >
> > returns no results, as I would expect, appuser is
a linux
> login id,
> > not an selinux user.
> >
> > [root@newhost ~]# semanage login -l | grep appuser
> > appuser app_user_u
s0
>
>
> semanage user -l | grep app_user_u
>
> [root@newhost ~]# semanage user -l | grep app_user_u
> app_user_u app_user s0 s0
> app_user_r
>
>
>
>
> >

Quoted 8 lines

> >
> > If this user is based of off user_u you
could
> simply:
> >
> >
>
cp /etc/selinux/contexts/users/user_u

/etc/selinux/contexts/users/appuser

Quoted 36 lines

> >
> > but it depends on how your appuser
selinux-user is
> configured
> > ( whats
> > his default domain )
> >
> > The only thing
in /etc/selinux/strict/contexts/users/
> > is "root", there is no file there for user_u.
>
>
> That's weird, i would expect default contexts be
defined since
> you
> stated that your user_u login works. Maybe it is
stored in a
> different
> location in el5.
>
> See if you can locate a file called user_u or any
other file
> that may
> have similar entries as i pasted above in
> you /etc/selinux/strict/contexts (and /users).
>
> see above.
>
>
>
> >
> > -- Larry
> >
>

#10 lore raw

I managed to get it working. Thanks to Dominick for the help.

-- Larry

Quoted 275 lines · Larry Ross
Quoted 258 lines · Larry Ross
Quoted 246 lines · Dominick Grift
Quoted 233 lines · Larry Ross

On Sat, Jul 25, 2009 at 2:46 PM, Dominick Grift <[email protected]> wrote:

        On Sat, 2009-07-25 at 14:31 -0700, Larry Ross wrote:
        > On Sat, Jul 25, 2009 at 2:11 PM, Dominick Grift <[email protected]>
        > wrote:
        >
        >         On Sat, 2009-07-25 at 13:59 -0700, Larry Ross wrote:
        >         > On Sat, Jul 25, 2009 at 1:16 PM, Dominick Grift >         <[email protected]>
        >         > wrote:
        >         > On Sat, 2009-07-25 at 12:41 -0700, Larry Ross wrote:
        >         > > I am trying to create a custom selinux user for the strict
        >         policy on
        >         > > RHEL5.3
        >         > > I want logins that are mapped to this user to be able to
        >         login via
        >         > > gdm, but when they do I get an error "Error! Unable to set
        >         > executable
        >         > > context."
        >         > >
        >         > > What does this error message mean?
        >         > >
        >         > > I am able to login via gdm with logins that are mapped to
        >         user_u.  I
        >         > > have run the AVCs generated when I login in permissive
        >         mode (which
        >         > > succeeds) through audit2allow and gotten to the point
        >         where it
        >         > doesn't
        >         > > seem that I am getting any killer AVCs.  What am I missing
        >         that is
        >         > > needed for a custom user to use X-Windows?  Is there some
        >         place I
        >         > can
        >         > > look to determine what is causing the error? >         > >
        >         > >    Thank you,
        >         > >    Larry
        >         > >
        >         > > /var/log/messages:
        >         > >  Jul 25 11:51:21 newhost gdm[4673]: SELinux gdm login:
        >         unable to
        >         > > obtain default security context for appuser. >         > >
        >         > >
        >         > >  /var/log/audit/audit.log:
        >         > > type=USER_AUTH msg=audit(1248550033.507:1432):
        user
        >         pid=3003 uid=0
        >         > > auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > authentication acct="?" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=failed)'
        >         > > type=USER_LOGIN msg=audit(1248550033.507:1433):
        user
        >         pid=3003 uid=0
        >         > > auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         > > msg='acct=dbapp:
        >         exe="/usr/sbin/gdm-binary" (hostname=newhost, >         > > addr=127.0.0.1, terminal=:0 res=failed)' >         > > type=USER_AUTH msg=audit(1248550043.787:1434):
        user
        >         pid=3003 uid=0
        >         > > auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > authentication acct="appuser" :
        >         > > exe="/usr/sbin/gdm-binary" (hostname=?, addr=?, >         terminal=:0
        >         > > res=success)'
        >         > > type=USER_ACCT msg=audit(1248550043.789:1435):
        user
        >         pid=3003 uid=0
        >         > > auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > accounting acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=CRED_ACQ msg=audit(1248550043.790:1436):
        user
        >         pid=3003 uid=0
        >         > > auid=14022 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > setcred acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > > type=LOGIN msg=audit(1248550043.796:1437): login pid=3003
        >         uid=0 old
        >         > > auid=14022 new auid=14020 old ses=35 new ses=36 >         > > type=USER_START msg=audit(1248550043.804:1438):
        user
        >         pid=3003 uid=0
        >         > > auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > session open acct="appuser" :
        >         > exe="/usr/sbin/gdm-binary" (hostname=?, >         > > addr=?, terminal=:0 res=success)'
        >         > > type=USER_LOGIN msg=audit(1248550043.804:1439):
        user
        >         pid=3003 uid=0
        >         > > auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         > msg='uid=14020:
        >         > > exe="/usr/sbin/gdm-binary" (hostname=newhost, >         addr=127.0.0.1,
        >         > > terminal=:0 res=success)'
        >         > > type=USER_END msg=audit(1248550092.461:1440):
        user
        >         pid=3003 uid=0
        >         > > auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > session close acct="appuser" :
        >         > exe="/usr/sbin/gdm-binary" (hostname=?, >         > > addr=?, terminal=:0 res=success)'
        >         > > type=CRED_DISP msg=audit(1248550092.461:1441):
        user
        >         pid=3003 uid=0
        >         > > auid=14020 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023
        >         msg='PAM:
        >         > > setcred acct="appuser" :
        >         exe="/usr/sbin/gdm-binary" (hostname=?,
        >         > > addr=?, terminal=:0 res=success)'
        >         > >
        >         >
        >         > Dominick,
        >         >   Thank you for your reply.
        >         >
        >         >         probably means you have no default contexts defined
        >         for
        >         >         "appuser"
        >         >
        >         > How do I define a default context for an selinux user?
        >
        >
        >         Well this is how a default contexts file looks for the user_u
        >         selinux
        >         user in fedora (targeted policy):
        >
        >         [root@notebook2 ~]#
        >         cat /etc/selinux/targeted/contexts/users/user_u >         system_r:local_login_t:s0       user_r:user_t:s0 >         system_r:remote_login_t:s0      user_r:user_t:s0 >         system_r:sshd_t:s0              user_r:user_t:s0 >         system_r:crond_t:s0             user_r:user_t:s0 >         system_r:xdm_t:s0               user_r:user_t:s0 >         user_r:user_su_t:s0             user_r:user_t:s0 >         user_r:user_sudo_t:s0           user_r:user_t:s0 >         system_r:initrc_su_t:s0         user_r:user_t:s0 >         user_r:user_t:s0                user_r:user_t:s0 >
        > That looks like the information that is
        > in /etc/selinux/strict/contexts/default_contexts:
        > system_r:sulogin_t:s0   sysadm_r:sysadm_t:s0
        > system_r:local_login_t:s0       staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0 app_user_r:app_user_t:s0
        > system_r:remote_login_t:s0      user_r:user_t:s0 staff_r:staff_t:s0
        > system_r:sshd_t:s0              user_r:user_t:s0 staff_r:staff_t:s0
        > sysadm_r:sysadm_t:s0
        > system_r:crond_t:s0     user_r:user_crond_t:s0
        > staff_r:staff_crond_t:s0 sysadm_r:sysadm_crond_t:s0 > system_r:system_crond_t:s0 mailman_r:user_crond_t:s0 > system_r:xdm_t:s0               staff_r:staff_t:s0 user_r:user_t:s0
        > sysadm_r:sysadm_t:s0 app_user_r:app_user_t:s0
        > staff_r:staff_su_t:s0   staff_r:staff_t:s0 user_r:user_t:s0 > sysadm_r:sysadm_t:s0
        > sysadm_r:sysadm_su_t:s0 staff_r:staff_t:s0 user_r:user_t:s0 > sysadm_r:sysadm_t:s0
        > user_r:user_su_t:s0     staff_r:staff_t:s0 user_r:user_t:s0 > sysadm_r:sysadm_t:s0
        > sysadm_r:sysadm_sudo_t:s0       sysadm_r:sysadm_t:s0 > staff_r:staff_sudo_t:s0 sysadm_r:sysadm_t:s0 staff_r:staff_t:s0
        > user_r:user_sudo_t:s0   sysadm_r:sysadm_t:s0 user_r:user_t:s0
        >
        >
        > I added app_user contexts into that file.  It isn't well documented,
        > so I may have done it wrong.

        i would try to add something like this:

        system_r:local_login_t:s0       app_user_r:app_user_t:s0 system_r:remote_login_t:s0      app_user_r:app_user_t:s0 system_r:sshd_t:s0              app_user_r:app_user_t:s0 system_r:crond_t:s0     app_user_r:app_user_crond_t:s0 system_r:xdm_t:s0               app_user_r:app_user_t:s0 app_user_r:app_user_su_t:s0     app_user_r:app_user_t:s0 app_user_r:app_user_sudo_t:s0   app_user_r:app_user_t:s0

        maybe also:

        app_user_r:app_user_t:s0
         app_user_r:app_user_t:s0

        or maybe just append the second column on the rows that also have user_t
        above.

        like for example:

        system_r:local_login_t:s0       staff_r:staff_t:s0 user_r:user_t:s0

Quoted 6 lines

        app_user_r:app_user_t:s0

I thought I had done that, but I see now I missed a few.  I appended the app_user contexts to the rows in default_contexts and tried it without success.  Is there something I have to do to make the new default_contexts active?  Do I have to reboot the machine?

No you should not have to do anything else afaik. Unfortunately my experience with el5 is very limited. I kind of ran out of suggestions.

Quoted 7 lines

You might also check
the /etc/pam.d/gdm, /etc/pam.d/sshd, /etc/pam.d/login to see if they have pam_selinux entries, but i do not think this is related since your user_u and other logins work

Have a good look at /etc/selinux/strict, see if you can find some clues. It may also be that your app_user_t policy has errors.

Quoted 6 lines

That is true.  That it why I asked the original question about what this error means.  What is an "executable context" that the error is referring to?  It looks like it is scanning through the default_contexts looking for one that it can transition to.  Could it be that there is no rule that allows it to transition from its current context (which I think is xdm_t) to app_user_t?  Or am I misunderstanding it?

What is the best way to determine what needs to be allowed?

If I run permissive and login as appuser, id in a console window returns:
uid=14020(appuser) gid=14012(nm_user_g) groups=100(users),14012(app_user_g) context=system_u:system_r:xdm_t:SystemLow-SystemHigh
If I run enforcing, I get the message "Error! Unable to set executable context." when I try to log in.

Quoted 101 lines

Once I have determined what context is needed, how do I add it to the policy? I don't see any rules in the existing policy for user_u that seem good candidates.

Quoted 95 lines
Quoted 6 lines

Hopefully others can add more suggestions. Although its weekend now so may be a while.

 I realize that and thank you for your time.

Just realized that I have been replying to you directly, I meant to leave the whole discussion on the group.  Hopefully it hasn't been too mangled.

Quoted 80 lines
Quoted 80 lines

        >
        >

        >         >         can you show us the output of 'semanage user -l |
        >         grep
        >         >         appuser'?
        >         >
        >         > [root@newhost ~]# semanage user -l | grep appuser >         >
        >         > returns no results, as I would expect, appuser is a linux
        >         login id,
        >         > not an selinux user.
        >         >
        >         > [root@newhost ~]# semanage login -l | grep appuser >         > appuser                   app_user_u
        s0
        >
        >
        >         semanage user -l | grep app_user_u
        >
        > [root@newhost ~]# semanage user -l | grep app_user_u > app_user_u       app_user    s0         s0
        > app_user_r
        >
        >
        >
        >
        >         >
        >         >
        >         >         If this user is based of off user_u you could
        >         simply:
        >         >
        >         >
        >
        cp /etc/selinux/contexts/users/user_u /etc/selinux/contexts/users/appuser
        >         >
        >         >         but it depends on how your appuser selinux-user is
        >         configured
        >         >         ( whats
        >         >         his default domain )
        >         >
        >         > The only thing
        in /etc/selinux/strict/contexts/users/
        >         > is "root", there is no file there for user_u. >
        >
        >         That's weird, i would expect default contexts be defined since
        >         you
        >         stated that your user_u login works. Maybe it is stored in a
        >         different
        >         location in el5.
        >
        >         See if you can locate a file called user_u or any other file
        >         that may
        >         have similar entries as i pasted above in >         you /etc/selinux/strict/contexts (and /users). >
        > see above.
        >
        >
        >
        >         >
        >         >   -- Larry
        >         >
        >

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#11 lore raw
In reply to Larry Ross
Quoted 6 lines · Larry Ross

I am trying to create a custom selinux user for the strict policy on RHEL5.3
I want logins that are mapped to this user to be able to login via gdm, but when they do I get an error "Error! Unable to set executable context."

Quoted 8 lines

What does this error message mean?

I am able to login via gdm with logins that are mapped to user_u. I have run the AVCs generated when I login in permissive mode (which succeeds) through audit2allow and gotten to the point where it doesn't seem that I am getting any killer AVCs. What am I missing that is needed for a custom user to use X-Windows? Is there some place I can look to determine what is causing the error?

I see that you've resolved the problem now, but could you describe what you had to do to get it to work for future reference? That way the next time someone comes along with the same issue, they can find the answer in the mailing list archives.

BTW, "executable context" in the error message means that the attempts by gdm to invoke setexeccon(3) failed. setexecon(3) is the libselinux interface to set the security context to which the process will transition upon the next execve(2) call. Usually a setexeccon(3) error means that the security context was invalid under the current policy.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
author
#12 lore raw
Quoted 16 lines · Stephen Smalley
Quoted 6 lines · Larry Ross

I am trying to create a custom selinux user for the strict policy on RHEL5.3
I want logins that are mapped to this user to be able to login via gdm, but when they do I get an error "Error! Unable to set executable context."

Quoted 8 lines

What does this error message mean?

I am able to login via gdm with logins that are mapped to user_u. I have run the AVCs generated when I login in permissive mode (which succeeds) through audit2allow and gotten to the point where it doesn't seem that I am getting any killer AVCs. What am I missing that is needed for a custom user to use X-Windows? Is there some place I can look to determine what is causing the error?

Quoted 4 lines

I see that you've resolved the problem now, but could you describe what you had to do to get it to work for future reference? That way the next time someone comes along with the same issue, they can find the answer in the mailing list archives.

I think (and that is why I didn't say specifically) that it was calling:
userdom_unpriv_user_template(app_user)

I know I needed to add a default context to:
/etc/selinux/strict/contexts/default_contexts
but although I added more per Dominicks suggestion, I think I already had the ones that were needed.

Quoted 7 lines

BTW, "executable context" in the error message means that the attempts by gdm to invoke setexeccon(3) failed. setexecon(3) is the libselinux interface to set the security context to which the process will transition upon the next execve(2) call. Usually a setexeccon(3) error means that the security context was invalid under the current policy.

This didn't seem to be well documented anywhere as to what the above actually means.
My take is that there has to be an executable context (which is what I think the userdom_unpriv_user_template gave me) which is listed in the default contexts in the same row as the "current" context. But I could be wrong.

-- Larry

Quoted 7 lines

--
Stephen Smalley
National Security Agency

#13 lore raw
Quoted 59 lines · Larry Ross

On Mon, Jul 27, 2009 at 6:45 AM, Stephen Smalley <[email protected]> wrote:
On Sat, 2009-07-25 at 12:41 -0700, Larry Ross wrote:

> I am trying to create a custom selinux user for the strict policy on
> RHEL5.3
> I want logins that are mapped to this user to be able to login via
> gdm, but when they do I get an error "Error! Unable to set executable
> context."
>
> What does this error message mean?
>
> I am able to login via gdm with logins that are mapped to user_u. I
> have run the AVCs generated when I login in permissive mode (which
> succeeds) through audit2allow and gotten to the point where it doesn't
> seem that I am getting any killer AVCs. What am I missing that is
> needed for a custom user to use X-Windows? Is there some place I can
> look to determine what is causing the error?

I see that you've resolved the problem now, but could you describe what
you had to do to get it to work for future reference? That way the next
time someone comes along with the same issue, they can find the answer
in the mailing list archives.

I think (and that is why I didn't say specifically) that it was calling:
userdom_unpriv_user_template(app_user)

I know I needed to add a default context to:
/etc/selinux/strict/contexts/default_contexts

but although I added more per Dominicks suggestion, I think I already had the ones that were needed.

BTW, "executable context" in the error message means that the attempts
by gdm to invoke setexeccon(3) failed. setexecon(3) is the libselinux
interface to set the security context to which the process will
transition upon the next execve(2) call. Usually a setexeccon(3) error
means that the security context was invalid under the current policy.

Quoted 6 lines

This didn't seem to be well documented anywhere as to what the above actually means.
My take is that there has to be an executable context (which is what I think the userdom_unpriv_user_template gave me) which is listed in the default contexts in the same row as the "current" context. But I could be wrong.

Usually what happens is that it is unable to find any valid context for the user and thus falls back to trying a failsafe context defined for emergency logins, but that wasn't valid for that particular SELinux user.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#14 lore raw
Quoted 67 lines · Stephen Smalley
Quoted 59 lines · Larry Ross

On Mon, Jul 27, 2009 at 6:45 AM, Stephen Smalley <[email protected]> wrote:
        On Sat, 2009-07-25 at 12:41 -0700, Larry Ross wrote:

        > I am trying to create a custom selinux user for the strict policy on
        > RHEL5.3
        > I want logins that are mapped to this user to be able to login via
        > gdm, but when they do I get an error "Error! Unable to set executable
        > context."
        >
        > What does this error message mean?
        >
        > I am able to login via gdm with logins that are mapped to user_u.  I
        > have run the AVCs generated when I login in permissive mode (which
        > succeeds) through audit2allow and gotten to the point where it doesn't
        > seem that I am getting any killer AVCs.  What am I missing that is
        > needed for a custom user to use X-Windows?  Is there some place I can
        > look to determine what is causing the error?

        I see that you've resolved the problem now, but could you describe what
        you had to do to get it to work for future reference?  That way the next
        time someone comes along with the same issue, they can find the answer
        in the mailing list archives.

I think (and that is why I didn't say specifically) that it was calling:
userdom_unpriv_user_template(app_user)

I know I needed to add a default context to:
/etc/selinux/strict/contexts/default_contexts

but although I added more per Dominicks suggestion, I think I already had the ones that were needed.

        BTW, "executable context" in the error message means that the attempts
        by gdm to invoke setexeccon(3) failed.  setexecon(3) is the libselinux
        interface to set the security context to which the process will
        transition upon the next execve(2) call.  Usually a setexeccon(3) error
        means that the security context was invalid under the current policy.

Quoted 6 lines

This didn't seem to be well documented anywhere as to what the above actually means.
My take is that there has to be an executable context (which is what I think the userdom_unpriv_user_template gave me) which is listed in the default contexts in the same row as the "current" context.  But I could be wrong.

Quoted 4 lines

Usually what happens is that it is unable to find any valid context for the user and thus falls back to trying a failsafe context defined for emergency logins, but that wasn't valid for that particular SELinux user.

Where is that behavior implemented? I didn't see it. Where are the "failsafe" contexts defined, are they in the code somewhere?

When you say "wasn't valid for that particular SELinux user" I assume you mean that the permissions required were not given to that selinux user (which is what I think I fixed with the userdom_unpriv_user_template). Which would imply that there would be no "failsafe context" for my custom selinux user.

-- Larry

Quoted 11 lines

--
Stephen Smalley
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.