All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [RFC] selinux management API
@ 2005-07-18 22:11 Chad Hanson
  2005-07-19 14:08 ` Daniel J Walsh
  0 siblings, 1 reply; 22+ messages in thread
From: Chad Hanson @ 2005-07-18 22:11 UTC (permalink / raw)
  To: Daniel J Walsh, gyurdiev; +Cc: Chad Hanson, Joshua Brindle, selinux


A use case and example below.

> -----Original Message-----
> From: Daniel J Walsh [mailto:dwalsh@redhat.com]
> Sent: Monday, July 18, 2005 2:36 PM
> To: gyurdiev@redhat.com
> Cc: Chad Hanson; Joshua Brindle; selinux@tycho.nsa.gov
> Subject: Re: [RFC] selinux management API
> 
> >>>
> >>Are nodes and interfaces on this list as well? These are 
> very necessary
> >>IMHO.
> >>    
> >>
> >
> >Can you give a usage scenario... 
> >
> >
> I belieive the way to make this work from the users 
> perspective is via iptables.  I am not sure if iptables would talk
> directly to the kernel or would use libsemanage to rewrite rules.
> 
> So you could say something like
> iptables allow named_t to listen on eth0
> iptables allow mail to write on eth1
> 

In the current setup you can use the interface and node rules to limit
traffic, both by TE and MLS. This is especially important in MLS and TE
separation of networks. I'll show a case for interface rules.

In the current global_macros.te:712 there is the following rule

allow $1 netif_type:netif *;

where netif_type is an attribute on netif_lo_t, netif_eth0_t, netif_eth1_t,
etc.... 

If you have three interfaces on a machine lo, eth0, eth1, you could prevent
traffic from unconfined_t to eth1 by changing to the follwing rules:

#allow $1 netif_type:netif *;
allow $1 netif_lo_t:netif *;
allow $1 netif_eth0_t:netif *;

In practice MLS and TE systems used for network domain separation you would
want to assign types and MLS labels to intefaces and nodes (networks) to
prevent data from going where it shouldn't.  An MLS/TE example is making one
interface INSIDE and another OUTSIDE. You could then have node rules for
network descriptions of INSIDE/OUTSIDE.

-Chad


 

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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* RE: [RFC] selinux management API
@ 2005-07-19 14:48 Chad Hanson
  2005-07-21 10:22 ` Ivan Gyurdiev
  0 siblings, 1 reply; 22+ messages in thread
From: Chad Hanson @ 2005-07-19 14:48 UTC (permalink / raw)
  To: Daniel J Walsh, Chad Hanson; +Cc: gyurdiev, Joshua Brindle, selinux


> -----Original Message-----
> From: Daniel J Walsh [mailto:dwalsh@redhat.com]
> Sent: Tuesday, July 19, 2005 9:09 AM
> To: Chad Hanson
> Cc: gyurdiev@redhat.com; Joshua Brindle; selinux@tycho.nsa.gov
> Subject: Re: [RFC] selinux management API
> 
> >
> But I don't like the idea of Admins modifying policy in order to 
> customize their system.  This is what we
> are trying to get away from.    Try to explain to an administrator that 
> you only want the apache web site to
> be allowed to listen on your intranet side and not on the 
> internet.  I would have a hard time writing policy for

It really could be done be expanding can_network or other macro to take a
value, such as the interface, and restrict the network access to just a
specific interface instead of all interfaces.


> that.   I can imagine it could be fairly easy using iptables type syntax 
> to do it though.
> 
> We (Red Hat) want to get to the point where we eliminate policy-sources 
> and it becomes just policy.src.rpm.  The
> same way we did with kernel-sources.
> 

I agree that this customization is bad. My example could have been better. A
better topic is just talking about the contents of the net_contexts file,
particularly nodes and interfaces.  Currently all of netifcon and nodecon
rules are static. One, this isn't modular and doesn't fall into the category
if not in use remove it, and second if server has four ethernet interface
cards the fourth defaults back to the initial sid instead of policy defined
in net_contexts. The same would hold true for virtual interfaces. Nodes have
a similiar issue. In MLS, the interface and node rules need to be customized
for attaching the desired MLS label (such as unclassified, secret, etc...).
In TE, you can definitely use strict rules to prevent certain types from
transmitting data to interfaces or nodes, possibly this should be an
addition to the mls or strict policy initially. I would think we would want
the ability to configure these objects even if everyone doesn't choose to. I
can guarantee in a guard environment, it would be highly desirable for the
policy to restrict a process to communicate on one interface only.

-Chad

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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* RE: [RFC] selinux management API
@ 2005-07-18 22:31 Chad Hanson
  0 siblings, 0 replies; 22+ messages in thread
From: Chad Hanson @ 2005-07-18 22:31 UTC (permalink / raw)
  To: gyurdiev, Joshua Brindle; +Cc: selinux


I want to clarify something below.

> -----Original Message-----
> From: Ivan Gyurdiev [mailto:gyurdiev@redhat.com]
> Sent: Friday, July 15, 2005 10:57 AM
> To: Joshua Brindle
> Cc: selinux@tycho.nsa.gov
> Subject: Re: [RFC] selinux management API
> 
> ===========================
> 
> During a teleconference meeting with Tresys, and Stephen, we 
> discussed Karl's proposal for mapping users to selinux users 
> many-to-one (see previous discussions), and several key points were
> established:
> 
> 1) Granularity at the Unix user level (and not just the selinux user
> level) is useful for implementing the categories for the MCS policy
> that Redhat is developing. As a result, we plan to move MLS categories
> from the selinux user config file into the map file (or alternative
> backend), where they can be associated with users, and not just selinux
> users. The set of accessible categories will be configured by login
> programs. Sensitivities would remain associated with selinux users.
> 

Is this just having categories available in the mapping file for users and
leaving the original MLS Range definition as per the current binary policy
in the selinux users file? 

Some simple MLS scenarios scenarios could be satisfied by a Unix user to
SELinux user mapping.   

-Chad


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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* RE: [RFC] selinux management API
@ 2005-07-18 16:06 Chad Hanson
  2005-07-18 18:28 ` Ivan Gyurdiev
  0 siblings, 1 reply; 22+ messages in thread
From: Chad Hanson @ 2005-07-18 16:06 UTC (permalink / raw)
  To: Joshua Brindle, selinux


> -----Original Message-----
> From: Joshua Brindle [mailto:jbrindle@tresys.com]
> Sent: Friday, July 15, 2005 9:47 AM
> To: selinux@tycho.nsa.gov
> Subject: [RFC] selinux management API
> 
> 
> After some discussion about the newly introduced libsemod and the user 
> management that Red Hat wants to introduce we've tried to come up with 
> an API that all management applications can use, which allow management 
> of many components of SELinux policy, including users, booleans states, 
> and soon ports. It's written with the expectation to add more managed 

Are nodes and interfaces on this list as well? These are very necessary
IMHO.

-Chad

> components later, without disturbing the API. We plan on make a new 
> library called libsemanage with this API exported through a shared 
> library and getting rid of libsemod.
> 

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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [RFC] selinux management API
@ 2005-07-15 14:46 Joshua Brindle
  2005-07-15 15:56 ` Ivan Gyurdiev
  0 siblings, 1 reply; 22+ messages in thread
From: Joshua Brindle @ 2005-07-15 14:46 UTC (permalink / raw)
  To: selinux

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

After some discussion about the newly introduced libsemod and the user 
management that Red Hat wants to introduce we've tried to come up with 
an API that all management applications can use, which allow management 
of many components of SELinux policy, including users, booleans states, 
and soon ports. It's written with the expectation to add more managed 
components later, without disturbing the API. We plan on make a new 
library called libsemanage with this API exported through a shared 
library and getting rid of libsemod.

This library should seamlessly handle management on systems with the 
current policy, policy modules or the policy management server. This way 
the management apps do not need to know what kind of SELinux system is 
running.

Comments are appreciated.


Joshua Brindle

[-- Attachment #2: semanage.h --]
[-- Type: text/x-chdr, Size: 6016 bytes --]

/* This #include needed to get struct timeval. */
#include <sys/time.h>

/* All accesses with semanage is through a "semanage_handle".  This
 * handler may be with the monolithic policy, directly to a module
 * store, or with a policy management server.  The handler represents
 * a persistent connection to that policy manager.  It is created
 * through a semanage_connect() call and must be afterwards
 * deallocated with semanage_handle_free(). */
typedef struct semanage_handle semanage_handle_t;

/* "Connect" to a manager, as specified in the file
 * /etc/selinux/semanage.conf.  This function always allocates a new
 * semanage_handle_t and assigns it to the passed reference pointer.
 * The caller is later responsible for deallocating the pointer by
 * calling semanage_handle_free().  If the connect fails then this
 * function returns a negative value, else it returns zero. */
int semanage_connect(semanage_handle_t **);

/* Disconnect from the manager given by the handle.  If already
 * disconnected then this function does nothing.  Return 0 if
 * disconnected properly or already disconnected, negative value on
 * error. */
int semanage_disconnect(semanage_handle_t *);

/* Deallocate all space associated with a semanage_handle_t, including
 * the pointer itself.  CAUTION: this function does not disconnect
 * from the manager; be sure that a semanage_disconnect() was
 * previously called. */
void semanage_handle_free(semanage_handle_t *);

/* Return a string describing the most recently encountered error
 * associated with a semanage_handle_t.  The returned string must not
 * be modified by the caller.  Be aware that this string is not
 * persistent; future calls to this library may alter the buffer
 * contents. */
const char *semanage_strerror(semanage_handle_t *);


/* Attempt to obtain a transaction lock on the manager.  If another
 * process has the lock then this function may block, depending upon
 * the timeout value.  The timeout parameter acts similarly to
 * select(2).
 *
 * Note that if the semanage_handle has not yet obtained a transaction
 * lock whenever a writer function is called, there will be an
 * implicit call to this function with timeout set to zero (i.e.,
 * return immediately if unable to obtain). */
int semanage_begin_transaction(semanage_handle_t *,
                               struct timeval *timeout);

/* Attempt to commit all changes since this transaction began.  If the
 * commit is successful then increment the "policy sequence number"
 * and then release the transaction lock.
 */
int semanage_commit(semanage_handle_t *);


/* META NOTES
 *
 * All of the below functions exepct a semanage_handle as its first
 * parameter.  If an error occurs then the function returns a negative
 * value.  Call semanage_strerror() to retrieve a string that fully
 * describes the error.
 *
 * For all functions a non-negative number indicates success.  The
 * particular returned value is the "policy sequence number".  This
 * number keeps tracks of policy revisions and is used to detect if
 * one semanage client has committed policy changes while another is
 * still connected.
 *
 * The info structs are nebulous at this time.  They will have
 * accessor functions from which to retrieve particular information.
 * The particular accessors are unknown at this time; as design
 * progresses those accessors will be decided.  Two such proposed
 * accessors are:

const char *semanage_module_get_name(semanage_module_info_t *);
const char *semanage_module_get_version(semanage_module_info_t *);

 */

int semanage_module_install(semanage_handle_t *,
                            char *module_data, size_t data_len);
int semanage_module_upgrade(semanage_handle_t *,
                            char *module_data, size_t data_len);
int semanage_module_install_base(semanage_handle_t *,
                                 char *module_data, size_t data_len);
int semanage_module_remove(semanage_handle_t *,
                           char *module_name);
typedef struct semanage_module_info semanage_module_info_t;
int semanage_module_list(semanage_handle_t *,
                         semanage_module_info_t **, int *num_modules);
void semanage_module_info_free(semanage_module_info_t *);


int semanage_user_add(semanage_handle_t *,
                      char *selinux_user_name,
                      char **roles, int num_roles);
int semanage_user_remove(semanage_handle_t *,
                         char *selinux_user_name);
typedef struct semanage_user_info semanage_user_info_t;
int semanage_user_list(semanage_handle_t *,
                       semanage_user_info_t **, int *num_users);
void semanage_user_info_free(semanage_user_info_t *);


int semanage_homedir_add(semanage_handle_t *,
                         char *dirname, char *context);
int semanage_homedir_remove(semanage_handle_t *,
                            char *dirname);
typedef struct semanage_homedir_info semanage_homedir_info_t;
int semanage_homedir_list(semanage_handle_t *,
                          semanage_homedir_info_t **, int *num_homedirs);
void semanage_homedir_info_free(semanage_homedir_info_t *);


int semanage_boolean_set(semanage_handle_t *,
                         char *boolname, int new_bool_value, int permanent);
/* if for some reason the caller does not have permission to read a
 * particular boolean value, it will not be added to the returned
 * array */
typedef struct semanage_boolean_info semanage_boolean_info_t;
int semanage_boolean_list(semanage_handle_t *,
                          semanage_boolean_info_t **, int *num_bools);
void semanage_boolean_info_free(semanage_boolean_info_t *);


int semanage_tunable_set(semanage_handle_t *,
                         char *tunablename, int new_tunable_value);
typedef struct semanage_tunable_info semanage_tunable_info_t;
int semanage_tunable_list(semanage_handle_t *,
                          semanage_tunable_info_t **, int *num_tunables);
void semanage_tunable_info_free(semanage_tunable_info_t *);

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

end of thread, other threads:[~2005-08-02  2:22 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-18 22:11 [RFC] selinux management API Chad Hanson
2005-07-19 14:08 ` Daniel J Walsh
  -- strict thread matches above, loose matches on Subject: below --
2005-07-19 14:48 Chad Hanson
2005-07-21 10:22 ` Ivan Gyurdiev
2005-07-18 22:31 Chad Hanson
2005-07-18 16:06 Chad Hanson
2005-07-18 18:28 ` Ivan Gyurdiev
2005-07-18 19:35   ` Daniel J Walsh
2005-07-19  2:25   ` Joshua Brindle
2005-07-15 14:46 Joshua Brindle
2005-07-15 15:56 ` Ivan Gyurdiev
2005-07-15 18:12   ` Joshua Brindle
2005-07-15 19:19     ` Ivan Gyurdiev
2005-07-15 19:29       ` Joshua Brindle
2005-07-15 19:45         ` Ivan Gyurdiev
2005-07-15 19:57           ` Joshua Brindle
2005-07-15 20:08             ` Ivan Gyurdiev
2005-07-28  8:36     ` Russell Coker
2005-07-28 13:43       ` Joshua Brindle
2005-07-28 13:54         ` Russell Coker
2005-08-01 18:12       ` Jason Tang
2005-08-02  2:15         ` Russell Coker

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.