Non root users fail to login after switch to latest kernel
Subsystems (2)
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to commoncap.c, which not exactly correct.
-------------------
security/commoncap.c +1 -1
@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns)
-------------------
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
When I try to login over ssh I consistantly see this message:
Jan 1 05:58:14 192.168.137.1 sshd[928]: error: open /dev/tty failed - could not set controlling tty: Permission denied
However root user login at console or ssh work just fine.
I would appreciate any pointers/clues as to what I should look in my policy definitions that is preventing users other than root from logging into the system?
-Subodh
Quoted 29 lines · Subodh Nijsure
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux. CONFIG_USER_NS=n
Signature · 2 lines
Stephen Smalley National Security Agency
Quoted 29 lines · Subodh Nijsure
Quoted 29 lines
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------
Quoted 6 lines
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux.
CONFIG_USER_NS=n
Actually CONFIG_USER_NS is not set in the kernel configuration and its off by default.
Also I have verified that it is not defined by adding a check in kernel source file (#ifdef CONFIG_USER_NS / #error "CONFIG_USER_NS_DEFINED")...
So CONFIG_USER_NS=y doesn't appear to be issue?
It appears that if USER_NS is not defined then the kernel uses the init_user_ns should I be assigning capabilities to "initrc" user in my policy?
Should I move this question to linux-security instead of selinux?
Regards,
-Subodh
Quoted 37 lines · Subodh Nijsure
Quoted 29 lines · Subodh Nijsure
Quoted 29 lines
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------Quoted 6 lines
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux.
CONFIG_USER_NS=n
Quoted 8 lines
Actually
CONFIG_USER_NSis not set in the kernel configuration and its off by default.
Also I have verified that it is not defined by adding a check in kernel source file (#ifdefCONFIG_USER_NS/ #error "CONFIG_USER_NS_DEFINED")...So
CONFIG_USER_NS=ydoesn't appear to be issue?It appears that if
USER_NSis not defined then the kernel uses theinit_user_nsshould I be assigning capabilities to "initrc" user in my policy?Should I move this question to linux-security instead of selinux?
Can you confirm that it happens even if SELinux is permissive? Because your patch has nothing to do with SELinux.
If it happens even with SELinux in permissive, then yes, I'd take it to linux-security-module.
Signature · 2 lines
Stephen Smalley National Security Agency
Quoted 43 lines · Stephen Smalley
Quoted 42 lines · Subodh Nijsure
Quoted 29 lines · Subodh Nijsure
Quoted 29 lines
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------Quoted 6 lines
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux.
CONFIG_USER_NS=nActually
CONFIG_USER_NSis not set in the kernel configuration and its off by default.
Also I have verified that it is not defined by adding a check in kernel source file (#ifdefCONFIG_USER_NS/ #error "CONFIG_USER_NS_DEFINED")...So
CONFIG_USER_NS=ydoesn't appear to be issue?
Quoted 8 lines
Quoted 3 lines
It appears that if
USER_NSis not defined then the kernel uses theinit_user_nsshould I be assigning capabilities to "initrc" user in my policy?Should I move this question to linux-security instead of selinux?
Can you confirm that it happens even if SELinux is permissive? Because your patch has nothing to do with SELinux.
If it happens even with SELinux in permissive, then yes, I'd take it to linux-security-module.
Also, you should check whether it happens with an actual released kernel, not just an -rc kernel. 3.5.5 or 3.6
Signature · 2 lines
Stephen Smalley National Security Agency
Quoted 48 lines · Stephen Smalley
Quoted 47 lines · Subodh Nijsure
Quoted 45 lines · Subodh Nijsure
Quoted 29 lines
Quoted 29 lines
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------Quoted 6 lines
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux.
CONFIG_USER_NS=nActually
CONFIG_USER_NSis not set in the kernel configuration and its off by default.
Also I have verified that it is not defined by adding a check in kernel source file (#ifdefCONFIG_USER_NS/ #error "CONFIG_USER_NS_DEFINED")...So
CONFIG_USER_NS=ydoesn't appear to be issue?It appears that if
USER_NSis not defined then the kernel uses theinit_user_nsshould I be assigning capabilities to "initrc" user in my policy?Should I move this question to linux-security instead of selinux?
Quoted 8 lines
Quoted 4 lines
Can you confirm that it happens even if SELinux is permissive? Because your patch has nothing to do with SELinux.
If it happens even with SELinux in permissive, then yes, I'd take it to linux-security-module.Also, you should check whether it happens with an actual released kernel, not just an -rc kernel. 3.5.5 or 3.6
Indeed I get same behavior even if SELINUX is in permissive mode.
I will try do run things with older kernels, it may take me some time to figure this out, platform (ARM MX28) depends on some of the latest device-tree stuff to run.
I will take this thread to linux-security and attach my kernel config file.
Thanks.
-Subodh
Quoted 53 lines · Subodh Nijsure
Quoted 53 lines · Stephen Smalley
Quoted 51 lines · Subodh Nijsure
Quoted 37 lines · Subodh Nijsure
Quoted 29 lines
Quoted 29 lines
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------Quoted 6 lines
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux.
CONFIG_USER_NS=nQuoted 8 lines
Actually
CONFIG_USER_NSis not set in the kernel configuration and its off by default.
Also I have verified that it is not defined by adding a check in kernel source file (#ifdefCONFIG_USER_NS/ #error "CONFIG_USER_NS_DEFINED")...So
CONFIG_USER_NS=ydoesn't appear to be issue?It appears that if
USER_NSis not defined then the kernel uses theinit_user_nsshould I be assigning capabilities to "initrc" user in my policy?Should I move this question to linux-security instead of selinux?
Can you confirm that it happens even if SELinux is permissive? Because your patch has nothing to do with SELinux.
If it happens even with SELinux in permissive, then yes, I'd take it to linux-security-module.
Quoted 6 lines
Quoted 3 lines
Also, you should check whether it happens with an actual released kernel, not just an -rc kernel. 3.5.5 or 3.6
Indeed I get same behavior even if SELINUX is in permissive mode.
I will try do run things with older kernels, it may take me some time to figure this out, platform (ARM MX28) depends on some of the latest device-tree stuff to run.
3.5.5 or 3.6.0 (both available from kernel.org) are newer than 3.5-rc4 (a release candidate for 3.5, before 3.5.0 was released), so you shouldn't have a problem testing them.
Signature · 2 lines
Stephen Smalley National Security Agency
Quoted 57 lines · Stephen Smalley
Quoted 56 lines · Subodh Nijsure
Quoted 56 lines · Stephen Smalley
Quoted 43 lines · Subodh Nijsure
Quoted 42 lines · Subodh Nijsure
Quoted 29 lines
Quoted 29 lines
Hello,
We have been running SELinux on our embedded platform for almost 18 months. We have been using kernel revision - 2.6.31. Since our platform only has 64MB memory we decided roll out our own policy.
Recently we have upgrade our linux kernel to version 3.5-rc4 again with our policy every thing is working, except one thing, login for any user other than root doesn't work.
Login at console works if I apply change shown below to
commoncap.c, which not exactly correct.-------------------
security/commoncap.c +1
-2@@ -83,7 +83,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,/* Do we have the necessary capabilities? */ if (targ_ns == cred->user_ns) -return cap_raised (cred->cap_effective, cap) ?0 : -EPERM ; +return cap_raised (cred->cap_effective, cap) ?0 :0 ;/* Have we tried all of the parent namespaces? */ if (targ_ns == &init_user_ns) -------------------Quoted 6 lines
Quoted 2 lines
So it looks like the users definition is missing some capabilities? I don't even see any avc messages.
Unless you are using them, I'd recommend disabling user namespaces in your kernel. They are marked as experimental. This has nothing to do with SELinux.
CONFIG_USER_NS=nActually
CONFIG_USER_NSis not set in the kernel configuration and its off by default.
Also I have verified that it is not defined by adding a check in kernel source file (#ifdefCONFIG_USER_NS/ #error "CONFIG_USER_NS_DEFINED")...So
CONFIG_USER_NS=ydoesn't appear to be issue?Quoted 8 lines
Quoted 3 lines
It appears that if
USER_NSis not defined then the kernel uses theinit_user_nsshould I be assigning capabilities to "initrc" user in my policy?Should I move this question to linux-security instead of selinux?
Can you confirm that it happens even if SELinux is permissive? Because your patch has nothing to do with SELinux.
If it happens even with SELinux in permissive, then yes, I'd take it to linux-security-module.Also, you should check whether it happens with an actual released kernel, not just an -rc kernel. 3.5.5 or 3.6
Quoted 7 lines
Quoted 3 lines
Indeed I get same behavior even if SELINUX is in permissive mode.
I will try do run things with older kernels, it may take me some time to figure this out, platform (ARM MX28) depends on some of the latest device-tree stuff to run.
3.5.5 or 3.6.0 (both available from kernel.org) are newer than 3.5-rc4 (a release candidate for 3.5, before 3.5.0 was released), so you shouldn't have a problem testing them.
Also, it would help to know exactly what called cap_capable() and with what arguments when it failed. Maybe call dump_stack() from cap_capable() in the EPERM case?
Signature · 2 lines
Stephen Smalley National Security Agency