MIME-Version: 1.0 In-Reply-To: <1255972389.3099.70.camel@moss-pluto.epoch.ncsc.mil> References: <81092d890910161715n12f3f523n16e02e08a3834b97@mail.gmail.com> <4AD9AD06.9030309@redhat.com> <81092d890910171117i71b699cete972bd9ae4b8834f@mail.gmail.com> <1255960382.3099.5.camel@moss-pluto.epoch.ncsc.mil> <81092d890910190949t537c00e8t3d7633c9f56a4800@mail.gmail.com> <1255972389.3099.70.camel@moss-pluto.epoch.ncsc.mil> Date: Mon, 19 Oct 2009 18:43:16 -0700 Message-ID: <81092d890910191843q4aa20f6ep877f8e739b52ce43@mail.gmail.com> Subject: Re: sshd error: Failed to get default security context From: Larry Ross To: Stephen Smalley Cc: Daniel J Walsh , selinux@tycho.nsa.gov Content-Type: multipart/alternative; boundary=001517576bd277c353047653fcd8 Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov --001517576bd277c353047653fcd8 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Oct 19, 2009 at 10:13 AM, Stephen Smalley wrote: > On Mon, 2009-10-19 at 09:49 -0700, Larry Ross wrote: > > On Mon, Oct 19, 2009 at 6:53 AM, Stephen Smalley > > wrote: > > > > On Sat, 2009-10-17 at 11:17 -0700, Larry Ross wrote: > > > > > > > > > On Sat, Oct 17, 2009 at 4:39 AM, Daniel J Walsh > > > > > wrote: > > > > > > On 10/16/2009 08:15 PM, Larry Ross wrote: > > > > I have created a custom selinux user for the > > strict policy > > > on RHEL5.3 who's > > > > purpose is to connect via ssh and scp files off > > the > > > machine. When that user > > > > tries to login via ssh, I see the following > > messages > > > in /var/log/secure: > > > > > > > > In enforcing: > > > > Oct 16 07:49:40 localhost sshd[20461]: Accepted > > password for > > > scpuser > > > > from 192.168.1.1 port 64680 ssh2 > > > > Oct 16 07:49:40 localhost sshd[20461]: error: > > Failed to get > > > default security > > > > context for scpuser. > > > > Oct 16 07:49:40 localhost sshd[20461]: fatal: > > SELinux > > > failure. Aborting > > > > connection. > > > > > > > > In permissive: > > > > Oct 16 07:55:59 localhost sshd[23302]: Accepted > > password for > > > scpuser from > > > > 192.168.1.1 port 56254 ssh2 > > > > Oct 16 07:55:59 localhost sshd[23302]: error: > > Failed to get > > > default security > > > > context for scpuser. > > > > Oct 16 07:55:59 localhost sshd[23302]: error: > > SELinux > > > failure. Continuing in > > > > permissive mode. > > > > > > > > Could someone explain what these messages mean? > > > > > > > > I believe that I have a default context defined in > > the > > > "default context" > > > > file that should work. I believe I have an > > executable > > > context available for > > > > this user (using rbash rather than bash). > > > > > > > > How is sshd making this decision? It looks like > > it is > > > calling setexeccon, > > > > but I'm not sure how that makes its decision. > > Where should > > > I look for clues > > > > as to how to fix it? > > > > > > > > Thank you, > > > > Larry > > > > > > > > > > Did you add an entry to default_types? > > > > > > I did. And in default_contexts and in users/scpuser. None > > of > > > them fixed the issue. > > > Could someone explain to me if these files are still used > > and what > > > they are used for? And if there are other files that might > > need to be > > > modified as well? > > > > > > Not up to date, but possibly still useful: > > > http://www.nsa.gov/research/_files/selinux/papers/policy2/x724.shtml > > http://oss.tresys.com/projects/refpolicy/wiki/RoleCreation > > > > Stephen, > > Thank you for these links, I hadn't found them in my searching and > > they seem to contain the information I need (and it looks like they > > are for the most part still accurate). > > > > The missing piece is the MLS/MCS portion of the context, that seems > > to be included in the files that came with RHEL5, is that used as any > > part of the context decision? Is it used when setting the new > > context? > > Not anymore, no - that is a legacy of the original MLS logic and > predates the use of the seusers configuration. The MLS/MCS portion gets > set from the user's entry in the seusers configuration these days, > although it has to be within the authorized range for the corresponding > SELinux user in the policy of course. LSPP configuration also has a > setup where sshd will try to preserve the level of the client when using > labeled networking, but that has to be enabled. > Stephen, Thank you for your reply. That was helpful. One question, what do you mean when you say "seusers configuration"? Is that the files in /contexts/users or the information maintained by semanage or something else? Thanks, Larry > > -- > Stephen Smalley > National Security Agency > > --001517576bd277c353047653fcd8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Mon, Oct 19, 2009 at 10:13 AM, Stephen Smalle= y <sds@tycho.nsa.= gov> wrote:
On Mon, 2009-10-19 at 09:49 -0700, Larry Ross wrote:
&= gt; On Mon, Oct 19, 2009 at 6:53 AM, Stephen Smalley <sds@tycho.nsa.gov>
> wrote:
>
>= =A0 =A0 =A0 =A0 On Sat, 2009-10-17 at 11:17 -0700, Larry Ross wrote:
> =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 = =A0 > On Sat, Oct 17, 2009 at 4:39 AM, Daniel J Walsh
> =A0 =A0 = =A0 =A0 <dwalsh@redhat.com><= br>> =A0 =A0 =A0 =A0 > wrote:
> =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 On 10/16/2009 08:15 PM, Larry Ros= s wrote:
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > I have created a= custom selinux user for the
> =A0 =A0 =A0 =A0 strict policy
> = =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 on RHEL5.3 who's
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > purpose is to connect via ss= h and scp files off
> =A0 =A0 =A0 =A0 the
> =A0 =A0 =A0 =A0 >= ; =A0 =A0 =A0 =A0 machine. =A0When that user
> =A0 =A0 =A0 =A0 > = =A0 =A0 =A0 =A0 > tries to login via ssh, I see the following
> =A0 =A0 =A0 =A0 messages
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 = in /var/log/secure:
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 >
&g= t; =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > In enforcing:
> =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 > Oct 16 07:49:40 localhost sshd[20461]: Ac= cepted
> =A0 =A0 =A0 =A0 password for
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 = =A0 scpuser
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > from 192.168.= 1.1 port 64680 ssh2
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > Oct 1= 6 07:49:40 localhost sshd[20461]: error:
> =A0 =A0 =A0 =A0 Failed to = get
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 default security
> =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 > context for scpuser.
> =A0 =A0 =A0 = =A0 > =A0 =A0 =A0 =A0 > Oct 16 07:49:40 localhost sshd[20461]: fatal:=
> =A0 =A0 =A0 =A0 SELinux
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 = =A0 failure. Aborting
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > connection.
> =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 = =A0 > In permissive:
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > O= ct 16 07:55:59 localhost sshd[23302]: Accepted
> =A0 =A0 =A0 =A0 pass= word for
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 scpuser from
> =A0 =A0 =A0 = =A0 > =A0 =A0 =A0 =A0 > 192.168.1.1 port 56254 ssh2
> =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 > Oct 16 07:55:59 localhost sshd[23302]: er= ror:
> =A0 =A0 =A0 =A0 Failed to get
> =A0 =A0 =A0 =A0 > =A0= =A0 =A0 =A0 default security
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > context for scpuser.
>= =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > Oct 16 07:55:59 localhost sshd[2= 3302]: error:
> =A0 =A0 =A0 =A0 SELinux
> =A0 =A0 =A0 =A0 > = =A0 =A0 =A0 =A0 failure. Continuing in
> =A0 =A0 =A0 =A0 > =A0 =A0= =A0 =A0 > permissive mode.
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 >= =A0 =A0 =A0 =A0 > Could someone explain what these messages mean?
&g= t; =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 > = =A0 =A0 =A0 =A0 > I believe that I have a default context defined in
> =A0 =A0 =A0 =A0 the
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 "= ;default context"
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > fi= le that should work. I believe I have an
> =A0 =A0 =A0 =A0 executable=
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 context available for
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > this user (using rbash rathe= r than bash).
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 >
> =A0= =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > How is sshd making this decision? = =A0It looks like
> =A0 =A0 =A0 =A0 it is
> =A0 =A0 =A0 =A0 >= =A0 =A0 =A0 =A0 calling setexeccon,
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > but I'm not sure how tha= t makes its decision.
> =A0 =A0 =A0 =A0 =A0Where should
> =A0 = =A0 =A0 =A0 > =A0 =A0 =A0 =A0 I look for clues
> =A0 =A0 =A0 =A0 &= gt; =A0 =A0 =A0 =A0 > as to how to fix it?
> =A0 =A0 =A0 =A0 > = =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0Thank you,
> = =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0Larry
> =A0 =A0 =A0 = =A0 > =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 >
> =A0 =A0 = =A0 =A0 > =A0 =A0 =A0 =A0 Did you add an entry to default_types?
>= =A0 =A0 =A0 =A0 >
> =A0 =A0 =A0 =A0 > I did. =A0And in default_contexts and in users/sc= puser. =A0None
> =A0 =A0 =A0 =A0 of
> =A0 =A0 =A0 =A0 > them= fixed the issue.
> =A0 =A0 =A0 =A0 > Could someone explain to me = if these files are still used
> =A0 =A0 =A0 =A0 and what
> =A0 =A0 =A0 =A0 > they are used fo= r? =A0And if there are other files that might
> =A0 =A0 =A0 =A0 need = to be
> =A0 =A0 =A0 =A0 > modified as well?
>
>
>= ; =A0 =A0 =A0 =A0 Not up to date, but possibly still useful:
> =A0 =A0 =A0 =A0 http://www.nsa.gov/research/_f= iles/selinux/papers/policy2/x724.shtml
> =A0 =A0 =A0 =A0 http://oss.tresys.com/projects/refpolicy/wiki/RoleCreation
>
> Stephen,
> =A0 Thank you for these links, I hadn't f= ound them in my searching and
> they seem to contain the information = I need (and it looks like they
> are for the most part still accurate= ).
>
> =A0 The missing piece is the MLS/MCS portion of the context, t= hat seems
> to be included in the files that came with RHEL5, is that= used as any
> part of the context decision? =A0Is it used when setti= ng the new
> context?

Not anymore, no - that is a legacy of the = original MLS logic and
predates the use of the seusers configuration. = =A0The MLS/MCS portion gets
set from the user's entry in the seusers= configuration these days,
although it has to be within the authorized range for the corresponding
= SELinux user in the policy of course. =A0LSPP configuration also has a
s= etup where sshd will try to preserve the level of the client when using
labeled networking, but that has to be enabled.
=A0
Stephen,
=A0 Thank you for your reply.=A0 That was helpful.
=A0=A0One question, what do you mean when you say "seusers config= uration"?=A0 Is that the files in <policy type>/contexts/users o= r the information maintained by semanage or something else?
=A0
=A0 Thanks,
=A0 Larry
=A0

--
Stephen Smalley
National Security Agency

=

--001517576bd277c353047653fcd8-- -- 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.