|
Chris PeBenito |
ab58ad |
#DESC Amanda - Automated backup program
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# This policy file sets the rigths for amanda client started by inetd_t
|
|
Chris PeBenito |
ab58ad |
# and amrecover
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# X-Debian-Packages: amanda-common amanda-server
|
|
Chris PeBenito |
ab58ad |
# Depends: inetd.te
|
|
Chris PeBenito |
ab58ad |
# Author : Carsten Grohmann <carstengrohmann@gmx.de>
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# License : GPL
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# last change: 27. August 2002
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# state : complete and tested
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Hints :
|
|
Chris PeBenito |
ab58ad |
# - amanda.fc is the appendant file context file
|
|
Chris PeBenito |
ab58ad |
# - If you use amrecover please extract the files and directories to the
|
|
Chris PeBenito |
ab58ad |
# directory speficified in amanda.fc as type amanda_recover_dir_t.
|
|
Chris PeBenito |
ab58ad |
# - The type amanda_user_exec_t is defined to label the files but not used.
|
|
Chris PeBenito |
ab58ad |
# This configuration works only as an client and a amanda client does not need
|
|
Chris PeBenito |
ab58ad |
# this programs.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Enhancements/Corrections:
|
|
Chris PeBenito |
ab58ad |
# - set tighter permissions to /bin/tar instead bin_t
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
##############################################################################
|
|
Chris PeBenito |
ab58ad |
# AMANDA CLIENT DECLARATIONS
|
|
Chris PeBenito |
ab58ad |
##############################################################################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# General declarations
|
|
Chris PeBenito |
ab58ad |
######################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
type amanda_t, domain, privlog, auth, fs_domain, nscd_client_domain;
|
|
Chris PeBenito |
ab58ad |
role system_r types amanda_t;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for the amanda executables
|
|
Chris PeBenito |
ab58ad |
type amanda_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for the amanda executables started by inetd
|
|
Chris PeBenito |
ab58ad |
type amanda_inetd_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for amanda configurations files
|
|
Chris PeBenito |
ab58ad |
type amanda_config_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for files in /usr/lib/amanda
|
|
Chris PeBenito |
ab58ad |
type amanda_usr_lib_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for all files in /var/lib/amanda
|
|
Chris PeBenito |
ab58ad |
type amanda_var_lib_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for all files in /var/lib/amanda/gnutar-lists/
|
|
Chris PeBenito |
ab58ad |
type amanda_gnutarlists_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for user startable files
|
|
Chris PeBenito |
ab58ad |
type amanda_user_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for same awk and other scripts
|
|
Chris PeBenito |
ab58ad |
type amanda_script_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for the shell configuration files
|
|
Chris PeBenito |
ab58ad |
type amanda_shellconfig_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
tmp_domain(amanda)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for /etc/amandates
|
|
Chris PeBenito |
ab58ad |
type amanda_amandates_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for /etc/dumpdates
|
|
Chris PeBenito |
ab58ad |
type amanda_dumpdates_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for amanda data
|
|
Chris PeBenito |
ab58ad |
type amanda_data_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Domain transitions
|
|
Chris PeBenito |
ab58ad |
####################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans(inetd_t, amanda_inetd_exec_t, amanda_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
##################
|
|
Chris PeBenito |
ab58ad |
# File permissions
|
|
Chris PeBenito |
ab58ad |
##################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# configuration files -> read only
|
|
Chris PeBenito |
ab58ad |
allow amanda_t amanda_config_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to amanda_amandates_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_t amanda_amandates_t:file { getattr lock read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to amanda_dumpdates_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_t amanda_dumpdates_t:file { getattr lock read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to amandas data structure
|
|
Chris PeBenito |
ab58ad |
allow amanda_t amanda_data_t:dir { read search write };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t amanda_data_t:file { read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to proc_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_t proc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to etc_t and similar
|
|
Chris PeBenito |
ab58ad |
allow amanda_t etc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t etc_runtime_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to amanda_gnutarlists_t (/var/lib/amanda/gnutar-lists)
|
|
Chris PeBenito |
ab58ad |
rw_dir_create_file(amanda_t, amanda_gnutarlists_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to device_t and similar
|
|
Chris PeBenito |
ab58ad |
allow amanda_t devtty_t:chr_file { read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to fs_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to sysctl_kernel_t ( proc/sys/kernel/* )
|
|
Chris PeBenito |
ab58ad |
read_sysctl(amanda_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#####################
|
|
Chris PeBenito |
ab58ad |
# process permissions
|
|
Chris PeBenito |
ab58ad |
#####################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Allow to use shared libs
|
|
Chris PeBenito |
ab58ad |
uses_shlib(amanda_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Allow to execute a amanda executable file
|
|
Chris PeBenito |
ab58ad |
allow amanda_t amanda_exec_t:file { execute execute_no_trans getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Allow to run a shell
|
|
Chris PeBenito |
ab58ad |
allow amanda_t shell_exec_t:file { execute execute_no_trans getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to bin_t (tar)
|
|
Chris PeBenito |
ab58ad |
allow amanda_t bin_t:file { execute execute_no_trans };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:capability { chown dac_override setuid };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:process { fork sigchld setpgid signal };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:dir search;
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
###################################
|
|
Chris PeBenito |
ab58ad |
# Network and process communication
|
|
Chris PeBenito |
ab58ad |
###################################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
can_network_server(amanda_t);
|
|
Chris PeBenito |
ab58ad |
can_ypbind(amanda_t);
|
|
Chris PeBenito |
ab58ad |
can_exec(amanda_t, sbin_t);
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:fifo_file { getattr read write ioctl lock };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
ab58ad |
allow amanda_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
##########################
|
|
Chris PeBenito |
ab58ad |
# Communication with inetd
|
|
Chris PeBenito |
ab58ad |
##########################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow amanda_t inetd_t:udp_socket { read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
###################
|
|
Chris PeBenito |
ab58ad |
# inetd permissions
|
|
Chris PeBenito |
ab58ad |
###################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow inetd_t amanda_usr_lib_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
########################
|
|
Chris PeBenito |
ab58ad |
# Access to to save data
|
|
Chris PeBenito |
ab58ad |
########################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to user_home_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_t user_home_type:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
##############################################################################
|
|
Chris PeBenito |
ab58ad |
# AMANDA RECOVER DECLARATIONS
|
|
Chris PeBenito |
ab58ad |
##############################################################################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# General declarations
|
|
Chris PeBenito |
ab58ad |
######################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for amrecover
|
|
Chris PeBenito |
ab58ad |
type amanda_recover_t, domain;
|
|
Chris PeBenito |
ab58ad |
role sysadm_r types amanda_recover_t;
|
|
Chris PeBenito |
ab58ad |
role system_r types amanda_recover_t;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# exec types for amrecover
|
|
Chris PeBenito |
ab58ad |
type amanda_recover_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# type for recover files ( restored data )
|
|
Chris PeBenito |
ab58ad |
type amanda_recover_dir_t, file_type, sysadmfile;
|
|
Chris PeBenito |
ab58ad |
file_type_auto_trans(amanda_recover_t, sysadm_home_dir_t, amanda_recover_dir_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# domain transsition
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans(sysadm_t, amanda_recover_exec_t, amanda_recover_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# file type auto trans to write debug messages
|
|
Chris PeBenito |
ab58ad |
file_type_auto_trans(amanda_recover_t, tmp_t, amanda_tmp_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# amanda recover process permissions
|
|
Chris PeBenito |
ab58ad |
####################################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
uses_shlib(amanda_recover_t)
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t self:process { fork sigkill sigstop sigchld signal };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t self:capability { fowner fsetid kill setgid setuid chown dac_override net_bind_service };
|
|
Chris PeBenito |
ab58ad |
can_exec(amanda_recover_t, shell_exec_t)
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t privfd:fd use;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# amrecover network and process communication
|
|
Chris PeBenito |
ab58ad |
#############################################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
can_network(amanda_recover_t);
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t amanda_port_t:tcp_socket name_connect;
|
|
Chris PeBenito |
ab58ad |
can_ypbind(amanda_recover_t);
|
|
Chris PeBenito |
ab58ad |
read_locale(amanda_recover_t);
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t self:fifo_file { getattr ioctl read write };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t self:unix_stream_socket { connect create read write };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t var_log_t:dir search;
|
|
Chris PeBenito |
ab58ad |
rw_dir_create_file(amanda_recover_t, amanda_log_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# amrecover file permissions
|
|
Chris PeBenito |
ab58ad |
############################
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to etc_t and similar
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t etc_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t etc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t etc_runtime_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to amanda_recover_dir_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t amanda_recover_dir_t:dir { add_name remove_name search write };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t amanda_recover_dir_t:file { append create getattr setattr unlink };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to var_t and var_run_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t var_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t var_run_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to proc_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t proc_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t proc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to sysctl_kernel_t
|
|
Chris PeBenito |
ab58ad |
read_sysctl(amanda_recover_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to dev_t and similar
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t device_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t devtty_t:chr_file { read write };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t null_device_t:chr_file { getattr write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to bin_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t bin_t:file { execute execute_no_trans };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to sysadm_home_t and sysadm_home_dir_t to start amrecover
|
|
Chris PeBenito |
ab58ad |
# in the sysadm home directory
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t { sysadm_home_dir_t sysadm_home_t }:dir { search getattr };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to use sysadm_tty_device_t (/dev/tty?)
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t sysadm_tty_device_t:chr_file { getattr ioctl read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# access to amanda_tmp_t and tmp_t
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t amanda_tmp_t:dir { add_name remove_name search write };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t amanda_tmp_t:file { append create getattr setattr unlink };
|
|
Chris PeBenito |
ab58ad |
allow amanda_recover_t tmp_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Rules to allow amanda to be run as a service in xinetd
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
allow inetd_t amanda_port_t:{ tcp_socket udp_socket } name_bind;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#amanda needs to look at fs_type directories to decide whether it should backup
|
|
Chris PeBenito |
ab58ad |
allow amanda_t { fs_type file_type }:dir {getattr read search };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t file_type:{ lnk_file file chr_file blk_file } {getattr read };
|
|
Chris PeBenito |
ab58ad |
allow amanda_t device_type:{ blk_file chr_file } getattr;
|
|
Chris PeBenito |
ab58ad |
allow amanda_t fixed_disk_device_t:blk_file read;
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans(amanda_t, fsadm_exec_t, fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow amanda_t file_type:sock_file getattr;
|
|
Chris PeBenito |
ab58ad |
logdir_domain(amanda)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
dontaudit amanda_t proc_t:lnk_file read;
|
|
Chris PeBenito |
ab58ad |
dontaudit amanda_t unlabeled_t:file getattr;
|
|
Chris PeBenito |
ab58ad |
#amanda wants to check attributes on fifo_files
|
|
Chris PeBenito |
ab58ad |
allow amanda_t file_type:fifo_file getattr;
|