From: Joshua Brindle <jbrindle@tresys.com>
To: gyurdiev@redhat.com
Cc: Karl MacMillan <kmacmillan@tresys.com>,
"'Daniel J Walsh'" <dwalsh@redhat.com>,
selinux@tycho.nsa.gov
Subject: Re: Iptables discussion
Date: Fri, 22 Jul 2005 10:51:48 -0400 [thread overview]
Message-ID: <42E10804.5030401@tresys.com> (raw)
In-Reply-To: <1122039886.24847.6.camel@celtics.boston.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]
Ivan Gyurdiev wrote:
>>Solving the user-interface issues can be done more effectively, in my opinion,
>>by hiding both iptables and SElinux. My preference would be to extend the
>>SELinux policy language to be able to express the kind of controls that you are
>>interested in expressing and create a configuration tool (gui or text based)
>>that generates the policy. That would leave a policy.conf or equivalent that
>>could be analyzed for correctness.
>>
>>
>
>I think whatever rules are automatically generated will be at a low
>level of complexity, because anything else would be better handled by
>writing policy. Given this, I think it will be trivial to generate
>additions to policy.conf to address your analysis concern.
>
This is not very forward looking, needs will undoubtedly become more complex
>Where
>exactly this is done is an implementation detail :)
>
>
>
sure but there are right ways to do this and not-so-right ways to do it.
>What's missing here, is a good API to work with policy, so that you
>can manipulate policy internals with anything other than checkpolicy.
>
>
I'm pretty sure thats what we've been proposing
>That's why I'm asking for an intermediate representation. My particular
>implementation of it may not be very good (suggestions welcome),
>but it's certainly better than what's out there - I don't think
>passing in policy-dependent integer id's, and exposing internal data
>structures will make a successful api.
>
>
The module format is an intermediate representation. I don't think
anyone is suggesting we expose anything about the policy, the last few
days of discussion has been about abstracting this. With respect to the
proposed libsemanage API, please let us know what else you need, or
better yet add some structs and functions and send an rfc. The more
comprehensive semanage api is attached and can probably start being used
for the user management and port management.
[-- Attachment #2: semanage.h --]
[-- Type: text/plain, Size: 7298 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:
*/
/* High level module management functions. These are all part of
* a transaction
*/
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);
/* semanage_module_info is for getting information on installed
modules, only name and version at this time */
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 *);
const char *semanage_module_get_name(semanage_module_info_t *);
const char *semanage_module_get_version(semanage_module_info_t *);
/* accessors for mls and role support structs */
typedef struct semanage_mls semanage_role_t;
typedef struct semanage_role semanage_role_t;
const char* semanage_mls_get_range(semanage_mls *);
const char* semanage_mls_get_level(semanage_mls *);
int semanage_mls_set_range(semanage_mls *);
int semanage_mls_set_level(semanage_mls *);
const char* semanage_role_get_name(semanage_role *);
int semanage_role_set_name(semanage_role *);
/* semanage_user represents selinux users in the policy */
typedef struct semanage_user semanage_user_t;
/* semanage_user management functions */
int semanage_user_init(semanage_handle_t **);
int semanage_user_add(semanage_handle_t *, semanage_user_t *userdata);
int semanage_user_remove(semanage_handle_t *, semanage_user_t *userdata);
int semanage_user_list(semanage_handle_t *, semanage_user_t **users, int *num_users);
void semanage_user_free(semanage_user_t *);
/* semanage_user accessor functions */
const char* semanage_user_get_name(semanage_user_t *);
int semanage_user_get_roles(semanage_user_t *, semanage_role **roles, int num_roles);
int semanage_user_get_mls(semanage_user_t *, semanage_mls *mls);
int semanage_user_set_name(semange_user_t *);
int semanage_user_set_roles(semanage_user_t *, semanage_roles **roles, int num_roles);
int semanage_user_set_mls(semanage_user_t *, semanage_mls *mls);
/* semanage_homedir manages selinux_user->directory maps so that
we can expand home directory contexts */
typedef struct semanage_homedir semanage_homedir_t;
int semanage_homedir_add(semanage_handle_t *, semanage_homedir_t *homedir);
int semanage_homedir_remove(semanage_handle_t *, semanage_homedir_t *homedir);
int semanage_homedir_list(semanage_handle_t *, semanage_homedir_t **, int *num_homedirs);
void semanage_homedir_free(semanage_homedir_t *);
/* semanage_homedir accessors */
const char* semanage_homedir_get_user(semanage_handle_t *);
const char* semanage_homedir_get_path(semanage_handle_t *);
int semanage_homedir_set_user(semanage_handle_t *, char *user);
int semanage_homedir_set_path(semanage_handle_t *, char *path);
/* semanage_boolean manages default boolean states */
typedef struct semanage_boolean semanage_boolean_t
int semanage_boolean_set(semanage_handle_t *, semanage_boolean_t *bool);
/* 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 */
int semanage_boolean_list(semanage_handle_t *, semanage_boolean_t **, int *num_bools);
void semanage_boolean_free(semanage_boolean_t *);
/* semanage_boolean accessors */
const char* semanage_boolean_get_name(semanage_boolean_t *);
const char semanage_boolean_get_state(semanage_boolean_t *);
int semanage_boolean_set_name(semanage_boolean_t *, char *name);
int semanage_boolean_set_state(semanage_boolean_t *, char state);
[-- Attachment #3: semanage_structs.h --]
[-- Type: text/plain, Size: 1467 bytes --]
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* This defines the data structures which are exported opaquely through
semanage.h for policy management clients. */
struct semanage_handle {
int con_id; /* Connection ID */
int policy_serial; /* Policy serial number at connect time */
char *err_buf;
}
struct semanage_module_info {
char *name; /* Key */
char *version;
}
struct semanage_role {
char *name; /* Key */
}
struct semanage_mls {
char *level;
char *range;
}
struct semanage_user {
char *selinux_name; /* Key */
struct semanage_role **roles;
int num_roles;
struct semanage_mls *mls;
}
struct semanage_homedir {
char *user;
char *path; /* Key */
}
struct semanage_boolean {
char *name; /* Key */
char default_state;
}
next prev parent reply other threads:[~2005-07-22 14:56 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-21 17:40 [ libsepol 2/6] Ports Ivan Gyurdiev
2005-07-21 18:04 ` Joshua Brindle
2005-07-21 18:06 ` Ivan Gyurdiev
2005-07-21 18:27 ` Ivan Gyurdiev
2005-07-21 19:35 ` Karl MacMillan
2005-07-21 19:38 ` Ivan Gyurdiev
2005-07-21 20:30 ` Karl MacMillan
2005-07-21 20:47 ` Ivan Gyurdiev
2005-07-21 21:06 ` Joshua Brindle
2005-07-21 21:06 ` Ivan Gyurdiev
2005-07-21 21:15 ` Joshua Brindle
2005-07-21 21:25 ` Ivan Gyurdiev
2005-07-21 23:34 ` Joshua Brindle
2005-07-22 11:53 ` Iptables discussion Ivan Gyurdiev
2005-07-22 12:31 ` Daniel J Walsh
2005-07-22 12:46 ` Karl MacMillan
2005-07-22 13:44 ` Ivan Gyurdiev
2005-07-22 14:19 ` Karl MacMillan
2005-07-22 14:24 ` Ivan Gyurdiev
2005-07-22 15:28 ` Karl MacMillan
2005-07-22 18:18 ` Ivan Gyurdiev
2005-07-22 18:40 ` Karl MacMillan
2005-07-22 19:01 ` Ivan Gyurdiev
2005-07-22 14:42 ` Daniel J Walsh
2005-07-22 15:28 ` Karl MacMillan
2005-07-22 14:51 ` Joshua Brindle
2005-07-22 14:51 ` Joshua Brindle [this message]
2005-07-22 15:39 ` Ivan Gyurdiev
2005-07-22 15:57 ` Karl MacMillan
2005-07-22 16:14 ` Ivan Gyurdiev
2005-07-22 16:31 ` Karl MacMillan
2005-07-22 17:59 ` Ivan Gyurdiev
2005-07-22 16:28 ` Ivan Gyurdiev
2005-07-22 17:28 ` Jason Tang
2005-07-22 17:54 ` Ivan Gyurdiev
2005-07-22 18:28 ` Jason Tang
2005-07-22 18:32 ` Ivan Gyurdiev
2005-07-22 19:19 ` Joshua Brindle
2005-07-22 19:44 ` Ivan Gyurdiev
2005-07-22 19:56 ` Joshua Brindle
2005-07-22 20:18 ` Ivan Gyurdiev
2005-07-22 20:56 ` Ivan Gyurdiev
2005-07-22 15:46 ` Casey Schaufler
2005-07-22 15:54 ` Joshua Brindle
2005-07-22 16:11 ` Frank Mayer
2005-07-22 18:56 ` Casey Schaufler
2005-07-24 5:25 ` James Morris
2005-07-24 15:28 ` Casey Schaufler
2005-07-25 4:24 ` James Morris
2005-07-25 15:37 ` Daniel J Walsh
2005-07-25 18:24 ` Christopher J. PeBenito
2005-07-25 18:28 ` Ivan Gyurdiev
2005-07-25 18:43 ` Ivan Gyurdiev
2005-07-25 18:55 ` Daniel J Walsh
2005-07-25 19:01 ` Joshua Brindle
2005-07-25 19:53 ` Ivan Gyurdiev
2005-07-25 22:42 ` Joshua Brindle
2005-07-26 0:07 ` Ivan Gyurdiev
2005-07-26 0:13 ` Joshua Brindle
2005-07-22 12:37 ` Karl MacMillan
-- strict thread matches above, loose matches on Subject: below --
2005-07-22 14:54 Chad Hanson
2005-07-24 5:08 ` James Morris
2005-07-25 21:00 Chad Hanson
2005-07-25 21:04 Chad Hanson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42E10804.5030401@tresys.com \
--to=jbrindle@tresys.com \
--cc=dwalsh@redhat.com \
--cc=gyurdiev@redhat.com \
--cc=kmacmillan@tresys.com \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.