|
Chris PeBenito |
31b7c0 |
# DESC tripwire
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Author: David Hampton <hampton@employees.org>
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# NOTE: Tripwire creates temp file in its current working directory.
|
|
Chris PeBenito |
31b7c0 |
# This policy does not allow write access to home directories, so
|
|
Chris PeBenito |
31b7c0 |
# users will need to either cd to a directory where they have write
|
|
Chris PeBenito |
31b7c0 |
# permission, or set the TEMPDIRECTORY variable in the tripwire config
|
|
Chris PeBenito |
31b7c0 |
# file. The latter is preferable, as then the file_type_auto_trans
|
|
Chris PeBenito |
31b7c0 |
# rules will kick in and label the files as private to tripwire.
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Common definitions
|
|
Chris PeBenito |
31b7c0 |
type tripwire_report_t, file_type, sysadmfile;
|
|
Chris PeBenito |
31b7c0 |
etcdir_domain(tripwire)
|
|
Chris PeBenito |
31b7c0 |
var_lib_domain(tripwire)
|
|
Chris PeBenito |
31b7c0 |
tmp_domain(tripwire)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Macro for defining tripwire domains
|
|
Chris PeBenito |
31b7c0 |
define(`tripwire_domain',`
|
|
Chris PeBenito |
31b7c0 |
application_domain($1, `, auth')
|
|
Chris PeBenito |
31b7c0 |
role system_r types $1_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow access to common tripwire files
|
|
Chris PeBenito |
31b7c0 |
allow $1_t tripwire_etc_t:file r_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t tripwire_etc_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t tripwire_etc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
file_type_auto_trans($1_t, var_lib_t, tripwire_var_lib_t, file)
|
|
Chris PeBenito |
31b7c0 |
allow $1_t tripwire_var_lib_t:dir rw_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
file_type_auto_trans($1_t, tmp_t, tripwire_tmp_t, `{ file dir }')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:process { fork sigchld };
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:capability { setgid setuid dac_override };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Tripwire needs to read all files on the system
|
|
Chris PeBenito |
31b7c0 |
general_proc_read_access($1_t)
|
|
Chris PeBenito |
31b7c0 |
allow $1_t file_type:dir { search getattr read};
|
|
Chris PeBenito |
31b7c0 |
allow $1_t file_type:{file chr_file lnk_file sock_file} {getattr read};
|
|
Chris PeBenito |
31b7c0 |
allow $1_t file_type:fifo_file { getattr };
|
|
Chris PeBenito |
31b7c0 |
allow $1_t device_type:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
allow $1_t sysctl_t:dir { getattr read };
|
|
Chris PeBenito |
31b7c0 |
allow $1_t {memory_device_t tty_device_t urandom_device_t zero_device_t}:chr_file getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Tripwire report files
|
|
Chris PeBenito |
31b7c0 |
create_dir_file($1_t, tripwire_report_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# gethostid()?
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:unix_stream_socket { connect create };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Running editor program (tripwire forks then runs bash which rins editor)
|
|
Chris PeBenito |
31b7c0 |
can_exec($1_t, shell_exec_t)
|
|
Chris PeBenito |
31b7c0 |
can_exec($1_t, bin_t)
|
|
Chris PeBenito |
31b7c0 |
uses_shlib($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# When run by a user
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
tripwire_domain(`tripwire')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Running from the command line
|
|
Chris PeBenito |
31b7c0 |
allow tripwire_t devpts_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow tripwire_t devtty_t:chr_file { read write };
|
|
Chris PeBenito |
31b7c0 |
allow tripwire_t {sysadm_devpts_t user_devpts_t}:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow tripwire_t privfd:fd use;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# When run from cron
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
tripwire_domain(`tripwire_crond')
|
|
Chris PeBenito |
31b7c0 |
system_crond_entry(tripwire_exec_t, tripwire_crond_t)
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(crond_t, tripwire_exec_t, tripwire_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Tripwire uses a temp file in the root home directory
|
|
Chris PeBenito |
31b7c0 |
#create_dir_file(tripwire_crond_t, root_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
# Twadmin
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
application_domain(twadmin)
|
|
Chris PeBenito |
31b7c0 |
read_locale(twadmin_t)
|
|
Chris PeBenito |
31b7c0 |
create_dir_file(twadmin_t, tripwire_etc_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow twadmin_t sysadm_tmp_t:file { getattr read write };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Running from the command line
|
|
Chris PeBenito |
31b7c0 |
allow twadmin_t sshd_t:fd use;
|
|
Chris PeBenito |
31b7c0 |
allow twadmin_t admin_tty_type:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
dontaudit twadmin_t { bin_t sbin_t }:dir search;
|
|
Chris PeBenito |
31b7c0 |
dontaudit twadmin_t home_root_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
dontaudit twprint_t user_home_dir_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
# Twprint
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
application_domain(twprint)
|
|
Chris PeBenito |
31b7c0 |
read_locale(twprint_t)
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(twprint_t, tripwire_etc_t)
|
|
Chris PeBenito |
31b7c0 |
allow twprint_t { var_t var_lib_t }:dir search;
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(twprint_t, tripwire_var_lib_t)
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(twprint_t, tripwire_report_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Running from the command line
|
|
Chris PeBenito |
31b7c0 |
allow twprint_t sshd_t:fd use;
|
|
Chris PeBenito |
31b7c0 |
allow twprint_t admin_tty_type:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
dontaudit twprint_t { bin_t sbin_t }:dir search;
|
|
Chris PeBenito |
31b7c0 |
dontaudit twprint_t home_root_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
# Siggen
|
|
Chris PeBenito |
31b7c0 |
##########
|
|
Chris PeBenito |
31b7c0 |
application_domain(siggen, `, auth')
|
|
Chris PeBenito |
31b7c0 |
read_locale(siggen_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Need permission to read files
|
|
Chris PeBenito |
31b7c0 |
allow siggen_t file_type:dir { search getattr read};
|
|
Chris PeBenito |
31b7c0 |
allow siggen_t file_type:file {getattr read};
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Running from the command line
|
|
Chris PeBenito |
31b7c0 |
allow siggen_t sshd_t:fd use;
|
|
Chris PeBenito |
31b7c0 |
allow siggen_t admin_tty_type:chr_file rw_file_perms;
|