All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] Define CAP_SYSLOG
@ 2010-03-05 20:56 Serge E. Hallyn
  2010-03-08 18:58 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Serge E. Hallyn @ 2010-03-05 20:56 UTC (permalink / raw)
  To: linux-security-module; +Cc: Linux Containers

Privileged syslog operations currently require CAP_SYS_ADMIN.  Split
this off into a new CAP_SYSLOG privilege which we can sanely take away
from a container through the capability bounding set.

With this patch, an lxc container can be prevented from messing with
the host's syslog.

There is one downside to this patch:  If some site or distro currently
has syslogd/whatever running as a non-root user with cap_sys_admin+pe,
then it will need to be changed to run with cap_syslog+pe.  I don't
know if there are such sites, or if that concern means we should take
a different approach to introducing this change, or simply refuse this
change.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
 include/linux/capability.h |    7 +++++--
 security/commoncap.c       |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/capability.h b/include/linux/capability.h
index 39e5ff5..837a55c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -249,7 +249,6 @@ struct cpu_vfs_cap_data {
 /* Allow configuration of the secure attention key */
 /* Allow administration of the random device */
 /* Allow examination and configuration of disk quotas */
-/* Allow configuring the kernel's syslog (printk behaviour) */
 /* Allow setting the domainname */
 /* Allow setting the hostname */
 /* Allow calling bdflush() */
@@ -355,7 +354,11 @@ struct cpu_vfs_cap_data {
 
 #define CAP_MAC_ADMIN        33
 
-#define CAP_LAST_CAP         CAP_MAC_ADMIN
+/* Allow configuring the kernel's syslog (printk behaviour) */
+
+#define CAP_SYSLOG           34
+
+#define CAP_LAST_CAP         CAP_SYSLOG
 
 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
 
diff --git a/security/commoncap.c b/security/commoncap.c
index 6166973..018985e 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -899,7 +899,7 @@ int cap_syslog(int type, bool from_file)
 	if (type != SYSLOG_ACTION_OPEN && from_file)
 		return 0;
 	if ((type != SYSLOG_ACTION_READ_ALL &&
-	     type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN))
+	     type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYSLOG))
 		return -EPERM;
 	return 0;
 }
-- 
1.6.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] Define CAP_SYSLOG
  2010-03-05 20:56 [PATCH RFC] Define CAP_SYSLOG Serge E. Hallyn
@ 2010-03-08 18:58 ` Kees Cook
  2010-03-11  1:19   ` Andrew G. Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2010-03-08 18:58 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: linux-security-module, Linux Containers

Hi Serge,

On Fri, Mar 05, 2010 at 02:56:07PM -0600, Serge E. Hallyn wrote:
> Privileged syslog operations currently require CAP_SYS_ADMIN.  Split
> this off into a new CAP_SYSLOG privilege which we can sanely take away
> from a container through the capability bounding set.

Seems like a good idea, but it'll require code changes in libcap2,
libcap-ng, as well as manpages.

I support the idea -- more stuff needs to be extracted from CAP_SYS_ADMIN,
but this is a nice distinct subsystem to do now.

Acked-By: Kees Cook <kees.cook@canonical.com>

-- 
Kees Cook
Ubuntu Security Team

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] Define CAP_SYSLOG
  2010-03-08 18:58 ` Kees Cook
@ 2010-03-11  1:19   ` Andrew G. Morgan
       [not found]     ` <551280e51003101719t3c61da42ja5796b3d86b0126a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew G. Morgan @ 2010-03-11  1:19 UTC (permalink / raw)
  To: Kees Cook; +Cc: Serge E. Hallyn, linux-security-module, Linux Containers

Acked-by: Andrew G. Morgan <morgan@kernel.org>

I concur with Kees.

Cheers

Andrew

On Mon, Mar 8, 2010 at 10:58 AM, Kees Cook <kees@ubuntu.com> wrote:
> Hi Serge,
>
> On Fri, Mar 05, 2010 at 02:56:07PM -0600, Serge E. Hallyn wrote:
>> Privileged syslog operations currently require CAP_SYS_ADMIN.  Split
>> this off into a new CAP_SYSLOG privilege which we can sanely take away
>> from a container through the capability bounding set.
>
> Seems like a good idea, but it'll require code changes in libcap2,
> libcap-ng, as well as manpages.
>
> I support the idea -- more stuff needs to be extracted from CAP_SYS_ADMIN,
> but this is a nice distinct subsystem to do now.
>
> Acked-By: Kees Cook <kees.cook@canonical.com>
>
> --
> Kees Cook
> Ubuntu Security Team
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] Define CAP_SYSLOG
       [not found]     ` <551280e51003101719t3c61da42ja5796b3d86b0126a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-03-12 15:02       ` Serge E. Hallyn
  0 siblings, 0 replies; 4+ messages in thread
From: Serge E. Hallyn @ 2010-03-12 15:02 UTC (permalink / raw)
  To: Andrew G. Morgan
  Cc: Linux Containers, linux-security-module-u79uwXL29TY76Z2rM5mHXA,
	Kees Cook

Thanks, guys - I also need to update the selinux classmap in both
kernel and policy.  Hoping to get around to that this afternoon,
but not sure.

-serge

Quoting Andrew G. Morgan (morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org):
> Acked-by: Andrew G. Morgan <morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> 
> I concur with Kees.
> 
> Cheers
> 
> Andrew
> 
> On Mon, Mar 8, 2010 at 10:58 AM, Kees Cook <kees-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org> wrote:
> > Hi Serge,
> >
> > On Fri, Mar 05, 2010 at 02:56:07PM -0600, Serge E. Hallyn wrote:
> >> Privileged syslog operations currently require CAP_SYS_ADMIN.  Split
> >> this off into a new CAP_SYSLOG privilege which we can sanely take away
> >> from a container through the capability bounding set.
> >
> > Seems like a good idea, but it'll require code changes in libcap2,
> > libcap-ng, as well as manpages.
> >
> > I support the idea -- more stuff needs to be extracted from CAP_SYS_ADMIN,
> > but this is a nice distinct subsystem to do now.
> >
> > Acked-By: Kees Cook <kees.cook-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> >
> > --
> > Kees Cook
> > Ubuntu Security Team
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-12 15:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-05 20:56 [PATCH RFC] Define CAP_SYSLOG Serge E. Hallyn
2010-03-08 18:58 ` Kees Cook
2010-03-11  1:19   ` Andrew G. Morgan
     [not found]     ` <551280e51003101719t3c61da42ja5796b3d86b0126a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-12 15:02       ` Serge E. Hallyn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.