All of lore.kernel.org
 help / color / mirror / Atom feed
From: dominick.grift@gmail.com (grift)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH 03/11] Initial policy for logsentry
Date: Sat, 08 Dec 2012 23:03:50 +0100	[thread overview]
Message-ID: <1355004230.1797.52.camel@localhost> (raw)
In-Reply-To: <1355000222-7297-4-git-send-email-sven.vermeulen@siphos.be>

On Sat, 2012-12-08 at 21:56 +0100, Sven Vermeulen wrote:
> Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
> ---
>  logsentry.fc |    8 +++++++
>  logsentry.if |   33 +++++++++++++++++++++++++++++
>  logsentry.te |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 106 insertions(+), 0 deletions(-)
>  create mode 100644 logsentry.fc
>  create mode 100644 logsentry.if
>  create mode 100644 logsentry.te
> 
> diff --git a/logsentry.fc b/logsentry.fc
> new file mode 100644
> index 0000000..6327e1e
> --- /dev/null
> +++ b/logsentry.fc
> @@ -0,0 +1,8 @@
> +/usr/bin/logtail	--	gen_context(system_u:object_r:logsentry_exec_t,s0)
> +/etc/logcheck/logcheck\.sh	--	gen_context(system_u:object_r:logsentry_exec_t,s0)

Same as with makewhatis

I would rather have the actual cron script labeled with the executable
file type and leave /usr/bin/logtail generic since only a domain
transition from crond is supported in this policy

Then probably add a fc spec for /etc/logcheck/logcheck\.sh (bin_t) to
corecommands.if


> +
> +/etc/logcheck(/.*)?	--	gen_context(system_u:object_r:logsentry_etc_t,s0)
> +
> +/etc/logcheck/tmp(/.*)?	gen_context(system_u:object_r:logsentry_tmp_t,s0)

I would probably label above logsentry_etc_rw_t instead

> +
> +/etc/logcheck/logcheck\..*	--	gen_context(system_u:object_r:logsentry_filter_t,s0)

> diff --git a/logsentry.if b/logsentry.if
> new file mode 100644
> index 0000000..2109f42
> --- /dev/null
> +++ b/logsentry.if
> @@ -0,0 +1,33 @@
> +## <summary>Log file monitoring tool</summary>
> +
> +#######################################
> +## <summary>
> +##	All of the rules required to administrate
> +##	a logsentry environment.
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +## <param name="role">
> +##	<summary>
> +##	Role allowed access.
> +##	</summary>
> +## </param>
> +#
> +interface(`logsentry_admin',`
> +	gen_require(`
> +		type logsentry_t, logsentry_etc_t, logsentry_tmp_t, logsentry_filter_t;
> +	')
> +
> +	allow $1 logsentry_t:process { ptrace signal_perms };
> +	ps_process_pattern($1, logsentry_t)
> +
> +	files_list_etc($1)
> +	admin_pattern($1, logsentry_etc_t)
> +	admin_pattern($1, logsentry_filter_t)
> +
> +	files_list_tmp($1)
> +	admin_pattern($1, logsentry_tmp_t)
> +')
> diff --git a/logsentry.te b/logsentry.te
> new file mode 100644
> index 0000000..3cdfcbe
> --- /dev/null
> +++ b/logsentry.te
> @@ -0,0 +1,65 @@
> +policy_module(logsentry, 0.2)
> +
> +#######################################
> +# 
> +# Declarations
> +#
> +
> +type logsentry_t;
> +type logsentry_exec_t;
> +application_domain(logsentry_t, logsentry_exec_t)
> +role system_r types logsentry_t;
> +
> +type logsentry_etc_t;
> +files_type(logsentry_etc_t);
> +
> +type logsentry_tmp_t;
> +files_tmp_file(logsentry_tmp_t);
> +
> +type logsentry_filter_t;
> +files_type(logsentry_filter_t)
> +
> +#######################################
> +#
> +# Local Policy
> +#
> +
> +allow logsentry_t self:fifo_file { read write getattr ioctl };
> +allow logsentry_t self:capability { setuid setgid };
> +allow logsentry_t logsentry_exec_t:file execute_no_trans;
> +
> +manage_dirs_pattern(logsentry_t, logsentry_tmp_t, logsentry_tmp_t)
> +manage_files_pattern(logsentry_t, logsentry_tmp_t, logsentry_tmp_t)
> +
> +files_tmp_filetrans(logsentry_t, logsentry_tmp_t, file)
> +
> +manage_files_pattern(logsentry_t, logsentry_filter_t, logsentry_filter_t)
> +
> +files_read_etc_files(logsentry_t)
> +
> +logging_search_logs(logsentry_t)
> +logging_manage_generic_logs(logsentry_t)
> +
> +kernel_read_system_state(logsentry_t)
> +
> +corecmd_exec_shell(logsentry_t)
> +corecmd_exec_bin(logsentry_t)
> +
> +miscfiles_read_localization(logsentry_t)
> +
> +mta_send_mail(logsentry_t)
> +
> +userdom_dontaudit_search_user_home_dirs(logsentry_t)
> +
> +optional_policy(`
> +  logging_manage_audit_log(logsentry_t)
> +')
> +
> +optional_policy(`
> +  hostname_exec(logsentry_t)
> +')
> +
> +optional_policy(`
> +  cron_system_entry(logsentry_t, logsentry_exec_t)
> +')
> +

  reply	other threads:[~2012-12-08 22:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08 20:56 [refpolicy] [PATCH 00/11] Contrib changes Sven Vermeulen
2012-12-08 20:56 ` [refpolicy] [PATCH 01/11] Moving sandbox code to sandbox section (v2) Sven Vermeulen
2012-12-09 13:51   ` grift
2012-12-08 20:56 ` [refpolicy] [PATCH 02/11] Allow sandbox to log violations Sven Vermeulen
2012-12-09 13:55   ` grift
2012-12-08 20:56 ` [refpolicy] [PATCH 03/11] Initial policy for logsentry Sven Vermeulen
2012-12-08 22:03   ` grift [this message]
2013-10-05  7:22   ` Dominick Grift
2012-12-08 20:56 ` [refpolicy] [PATCH 04/11] Initial policy for makewhatis Sven Vermeulen
2012-12-08 21:57   ` grift
2012-12-09  9:44     ` Sven Vermeulen
2012-12-09 10:59       ` grift
2012-12-08 20:56 ` [refpolicy] [PATCH 05/11] Use rw_fifo_file_perms Sven Vermeulen
2012-12-09 13:58   ` grift
2012-12-08 20:56 ` [refpolicy] [PATCH 06/11] Apache should not depend on gpg Sven Vermeulen
2012-12-09 13:59   ` grift
2012-12-08 20:56 ` [refpolicy] [PATCH 07/11] Mark make.profile entry as portage_conf_t Sven Vermeulen
2012-12-08 21:46   ` grift
2012-12-08 20:56 ` [refpolicy] [PATCH 08/11] Named init script creates rundir Sven Vermeulen
2012-12-09 14:00   ` grift
2012-12-08 20:57 ` [refpolicy] [PATCH 09/11] Add ~/.maildir as a valid maildir destination Sven Vermeulen
2012-12-09 14:01   ` grift
2012-12-08 20:57 ` [refpolicy] [PATCH 10/11] Support stunnel_read_config for startup Sven Vermeulen
2012-12-09 14:03   ` grift
2012-12-08 20:57 ` [refpolicy] [PATCH 11/11] Updates on stunnel policy Sven Vermeulen
2012-12-09 14:04   ` grift

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=1355004230.1797.52.camel@localhost \
    --to=dominick.grift@gmail.com \
    --cc=refpolicy@oss.tresys.com \
    /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.