Skip to contentSkip to conversation

new rules for amanda

DISCUSSION Carsten Grohmann 3 participants 4 messages Aug 27, 2002 – Aug 29, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

I've attached the new rules for amanda. There are only little changes.

Carsten

#
# This policy file sets the rigths for amanda client started by inetd_t

# and amrecover 
#
# Author     :  Carsten Grohmann <[email protected]>
#
# $Id: amanda.te,v 1.13 2002/08/27 17:10:18 carsten Exp $
#
# License    :  GPL
#
# last change:  27. August 2002
#
# state      :  complete and tested
#
# Hints      :
#  - amanda.fc is the appendant file context file
#  - If you use amrecover please extract the files and directories to the
#    directory speficified in amanda.fc as type amanda_recover_dir_t.
#  - The type amanda_user_exec_t is defined to label the files but not used.
#    This configuration works only as an client and a amanda client don't need
#    this programs.
#
# Changes    :
#  - 20020508 complette rewrite
#  - 20020513 move the programs started by inetd to amanda_inetd_exec_t
#  - 20020517 add rules for amanda_recover_t
#  - 20020625 change auditdeny to dontaudit
#  - 20020710 add connect to allow amanda_t self:unix_dgram_socket
#  - 20020717 add new rule: allow amanda_t devlog_t:sock_file { write };
#  - 20020724 add sendto permission to rule: allow amanda_t syslogd_t:unix_dgram_socket
#  - 20020827 add write permission to rule: allow amanda_t syslogd_t:unix_dgram_socket
#
# Enhancements/Corrections:
#  - set tighter permissions to /bin/tar instead bin_t 

##############################################################################
# AMANDA CLIENT DECLARATIONS
##############################################################################

# General declarations
######################

type amanda_t, domain;
role system_r types amanda_t;

# type for the amanda executables
type amanda_exec_t, file_type, sysadmfile, exec_type;
# type for the amanda executables started by inetd
type amanda_inetd_exec_t, file_type, sysadmfile, exec_type;
# type for amanda configurations files
type amanda_config_t, file_type, sysadmfile;
# type for files in /usr/lib/amanda
type amanda_usr_lib_t, file_type, sysadmfile;
# type for all files in /var/lib/amanda
type amanda_var_lib_t, file_type, sysadmfile;
# type for all files in /var/lib/amanda/gnutar-lists/
type amanda_gnutarlists_t, file_type, sysadmfile;
# type for user startable files
type amanda_user_exec_t, file_type, sysadmfile, exec_type;
# type for same awk and other scripts
type amanda_script_exec_t, file_type, sysadmfile, exec_type;
# type for the shell configuration files 
type amanda_shellconfig_t, file_type, sysadmfile;
# type for temporary files
type amanda_tmp_t, file_type, tmpfile, sysadmfile;
file_type_auto_trans(amanda_t, tmp_t, amanda_tmp_t)
# type for /etc/amandates
type amanda_amandates_t, file_type, sysadmfile;
# type for /etc/dumpdates
type amanda_dumpdates_t, file_type, sysadmfile;
# type for amanda data
type amanda_data_t, file_type, sysadmfile;

# Domain transitions
####################

domain_auto_trans(inetd_t, amanda_inetd_exec_t, amanda_t)

##################
# File permissions
##################

# configuration files -> read only
allow amanda_t amanda_config_t:file { getattr read };
allow amanda_t amanda_config_t:dir { search };
# access to amanda_amandates_t
allow amanda_t amanda_amandates_t:file { getattr lock read write };
# access to amanda_dumpdates_t
allow amanda_t amanda_dumpdates_t:file { getattr lock read write };
# access to amandas data structure
allow amanda_t amanda_data_t:dir { read search write };
allow amanda_t amanda_data_t:file { read write };
# access to proc_t
allow amanda_t proc_t:dir { getattr search };
allow amanda_t proc_t:file { getattr read };
# access to etc_t and similar
allow amanda_t etc_t:dir { getattr search };
allow amanda_t etc_t:file { getattr read };
allow amanda_t resolv_conf_t:file { getattr read };
allow amanda_t etc_runtime_t:file { getattr read };
# access to var_t and similar
allow amanda_t var_t:dir { search };
allow amanda_t var_lib_t:dir { search };
allow amanda_t amanda_var_lib_t:dir { search };
# access to amanda_gnutarlists_t (/var/lib/amanda/gnutar-lists)
allow amanda_t amanda_gnutarlists_t:dir { add_name read remove_name search write };
allow amanda_t amanda_gnutarlists_t:file { create getattr read rename setattr unlink write };
# access to var_run_t
allow amanda_t var_run_t:dir { search };
# access to var_log_t
allow amanda_t var_log_t:dir { getattr };
# access to var_spool_t
allow amanda_t var_spool_t:dir { getattr };
# access to amanda_usr_lib_t
allow amanda_t amanda_usr_lib_t:dir { search };
# access to device_t and similar
allow amanda_t device_t:dir { search };
allow amanda_t null_device_t:chr_file { getattr read write };
allow amanda_t devpts_t:dir { getattr };
allow amanda_t fixed_disk_device_t:blk_file { getattr };
allow amanda_t removable_device_t:blk_file { getattr };
allow amanda_t devtty_t:chr_file { read write };
allow amanda_t devlog_t:sock_file { write };
# access to boot_t
allow amanda_t boot_t:dir { getattr };
# access to fs_t
allow amanda_t fs_t:filesystem { getattr };
# access to sysctl_kernel_t ( proc/sys/kernel/* )
allow amanda_t sysctl_kernel_t:dir { search };
allow amanda_t sysctl_kernel_t:file { read };

#####################

# process permissions
#####################

# Allow to use shared libs
uses_shlib(amanda_t)

# Allow to execute a amanda executable file
allow amanda_t amanda_exec_t:file { execute execute_no_trans getattr read };

# Allow to run a shell
allow amanda_t shell_exec_t:file { execute execute_no_trans getattr read };

# access to bin_t (tar)
allow amanda_t bin_t:file { execute execute_no_trans };

allow amanda_t self:capability { chown dac_override setuid }; allow amanda_t self:process { fork sigchld };

###################################
# Network and process communication
###################################

# You can use this can_network or alternate the 9 out comment rules can_network(amanda_t);
#allow amanda_t any_socket_t:udp_socket { sendto };
#allow amanda_t netif_eth0_t:netif { tcp_send };
#allow amanda_t netif_eth0_t:netif { udp_send tcp_send };
#allow amanda_t netmsg_eth0_t:tcp_socket { acceptfrom recvfrom }; #allow amanda_t netmsg_eth0_t:udp_socket { recvfrom };
#allow amanda_t node_t:node { udp_send tcp_send };
#allow amanda_t port_t:tcp_socket { name_bind };
#allow amanda_t self:tcp_socket { accept bind create getattr listen setopt write }; #allow amanda_t self:udp_socket { connect create read write };

allow amanda_t self:fifo_file { getattr read write ioctl lock }; allow amanda_t self:unix_stream_socket { connect create read write }; allow amanda_t self:unix_dgram_socket { connect create write };

###################
# Access to syslogd
###################

allow amanda_t syslogd_t:unix_dgram_socket { sendto };

##########################
# Communication with inetd
##########################

allow amanda_t inetd_t:udp_socket { read write };

###################

# inetd permissions
###################

allow inetd_t amanda_usr_lib_t:dir { search };

########################
# Access to to save data
########################

allow amanda_t cvs_cvsroot_history_t:file { getattr read }; allow amanda_t cvs_cvsroot_t:dir { getattr read search }; allow amanda_t cvs_cvsroot_t:file { getattr read }; allow amanda_t cvs_cvsroot_valtags_t:file { getattr read }; allow amanda_t cvs_dir_t:dir { getattr read search }; allow amanda_t cvs_repository_t:dir { getattr read search }; allow amanda_t cvs_repository_t:file { getattr read };

# access to user_home_t
allow amanda_t user_home_t:dir { search getattr read };
allow amanda_t user_home_t:file { getattr read };

# Allow access to cvs_bin_t and all files inside this directory allow amanda_t cvs_bin_t:dir { getattr read search }; allow amanda_t cvs_exec_t:file { getattr read }; allow amanda_t cvs_wrapper_exec_t:file { getattr read }; allow amanda_t cvs_mailloginfo_exec_t:file { getattr read };

# Allow access to cvs_tmp_t
allow amanda_t cvs_tmp_t:dir { getattr read };

# Allow access to cvs_lockdir_t
allow amanda_t cvs_lockdir_t:dir { getattr read search };

# access to file_t ( /floppy, /cdrom )
allow amanda_t file_t:dir { getattr };

###########
# Dontaudit
###########

dontaudit amanda_t file_labels_t:dir { getattr read search }; dontaudit amanda_t file_labels_t:file { getattr read };
dontaudit amanda_t lost_found_t:dir { getattr read };

##############################################################################
# AMANDA RECOVER DECLARATIONS
##############################################################################

# General declarations
######################

# type for amrecover
type amanda_recover_t, domain;
role sysadm_r types { amanda_recover_t amanda_recover_dir_t };
# exec types for amrecover 
type amanda_recover_exec_t, file_type, sysadmfile, exec_type;
# type for recover files ( restored data )
type amanda_recover_dir_t, file_type, sysadmfile;
file_type_auto_trans(amanda_recover_t, sysadm_home_t, amanda_recover_dir_t)
# domain transsition
domain_auto_trans(sysadm_t, amanda_recover_exec_t, amanda_recover_t)
# file type auto trans to write debug messages
file_type_auto_trans(amanda_recover_t, tmp_t, amanda_tmp_t)
# amanda recover process permissions
####################################

uses_shlib(amanda_recover_t)
allow amanda_recover_t self:process { fork sigkill sigstop sigchld signal };
allow amanda_recover_t self:capability { fowner fsetid setgid setuid chown dac_override net_bind_service }; allow amanda_recover_t shell_exec_t:file { execute execute_no_trans getattr read };
allow amanda_recover_t local_login_t:fd { use };

# amrecover network and process communication
#############################################

# You can use this can_network or alternate the 8 out comment rules can_network(amanda_recover_t);
#allow amanda_recover_t self:tcp_socket { bind getattr connect create read write }; #allow amanda_recover_t self:udp_socket { connect create read write }; #allow amanda_recover_t any_socket_t:udp_socket { sendto };
#allow amanda_recover_t netif_eth0_t:netif { tcp_send udp_send }; #allow amanda_recover_t netmsg_eth0_t:tcp_socket { connectto recvfrom }; #allow amanda_recover_t netmsg_eth0_t:udp_socket { recvfrom };
#allow amanda_recover_t node_t:node { tcp_send udp_send };
#allow amanda_recover_t port_t:tcp_socket { name_bind };

allow amanda_recover_t self:fifo_file { getattr ioctl read write }; allow amanda_recover_t self:unix_stream_socket { connect create read write };

# amrecover file permissions
############################
# access to etc_t and similar
allow amanda_recover_t etc_t:dir { search };
allow amanda_recover_t etc_t:file { getattr read };
allow amanda_recover_t resolv_conf_t:file { getattr read };
allow amanda_recover_t etc_runtime_t:file { getattr read };
# access to amanda_recover_dir_t
#allow amanda_recover_t amanda_recover_dir_t:dir  create_dir_perms;
#allow amanda_recover_t amanda_recover_dir_t:file create_file_perms;
allow amanda_recover_t amanda_recover_dir_t:dir { add_name remove_name search write };
allow amanda_recover_t amanda_recover_dir_t:file { append create getattr setattr unlink };
# access to locale at /usr/lib/locale/de_DE/LC_CTYPE
allow amanda_recover_t writeable_t:file { getattr read };
# access to var_t and var_run_t
allow amanda_recover_t var_t:dir { search };
allow amanda_recover_t var_run_t:dir { search };
# access to proc_t
allow amanda_recover_t proc_t:dir { search };
allow amanda_recover_t proc_t:file { getattr read };
# access to sysctl_kernel_t
allow amanda_recover_t sysctl_kernel_t:dir { search };
allow amanda_recover_t sysctl_kernel_t:file { read };
# access to dev_t and similar
allow amanda_recover_t device_t:dir { search };
allow amanda_recover_t devtty_t:chr_file { read write };
allow amanda_recover_t null_device_t:chr_file { getattr write };
# access to bin_t
allow amanda_recover_t bin_t:file { execute execute_no_trans };
# access to sysadm_home_t to start amrecover in the sysadm_home_t:dir
allow amanda_recover_t sysadm_home_t:dir { search getattr };
# access to use sysadm_tty_device_t (/dev/tty?)
allow amanda_recover_t sysadm_tty_device_t:chr_file { getattr ioctl read write };
# access to amanda_tmp_t and tmp_t
allow amanda_recover_t amanda_tmp_t:dir { add_name remove_name search write };
allow amanda_recover_t amanda_tmp_t:file { append create getattr setattr unlink };
allow amanda_recover_t tmp_t:dir { search };
#1 lore raw
Quoted 1 line · Carsten Grohmann

I've attached the new rules for amanda. There are only little changes.

I've made some changes to amanda.te from my tree and attached it.

Note the use of privlog instead of discrete rules for syslog.

Also note that I've removed the CVS entries as they don't apply to the main tree.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

#DESC Amanda backup
#
# This policy file sets the rigths for amanda client started by inetd_t

# and amrecover 
#
# Author     :  Carsten Grohmann <[email protected]>
#
# License    :  GPL
#
# last change:  27. August 2002
#
# state      :  complete and tested
#
# Hints      :
#  - amanda.fc is the appendant file context file
#  - If you use amrecover please extract the files and directories to the
#    directory speficified in amanda.fc as type amanda_recover_dir_t.
#  - The type amanda_user_exec_t is defined to label the files but not used.
#    This configuration works only as an client and a amanda client don't need
#    this programs.
#
# Enhancements/Corrections:
#  - set tighter permissions to /bin/tar instead bin_t 

##############################################################################
# AMANDA CLIENT DECLARATIONS
##############################################################################

# General declarations
######################

type amanda_t, domain, privlog;
role system_r types amanda_t;

# type for the amanda executables
type amanda_exec_t, file_type, sysadmfile, exec_type;
# type for the amanda executables started by inetd
type amanda_inetd_exec_t, file_type, sysadmfile, exec_type;
# type for amanda configurations files
type amanda_config_t, file_type, sysadmfile;
# type for files in /usr/lib/amanda
type amanda_usr_lib_t, file_type, sysadmfile;
# type for all files in /var/lib/amanda
type amanda_var_lib_t, file_type, sysadmfile;
# type for all files in /var/lib/amanda/gnutar-lists/
type amanda_gnutarlists_t, file_type, sysadmfile;
# type for user startable files
type amanda_user_exec_t, file_type, sysadmfile, exec_type;
# type for same awk and other scripts
type amanda_script_exec_t, file_type, sysadmfile, exec_type;
# type for the shell configuration files 
type amanda_shellconfig_t, file_type, sysadmfile;
# type for temporary files
type amanda_tmp_t, file_type, tmpfile, sysadmfile;
file_type_auto_trans(amanda_t, tmp_t, amanda_tmp_t)
# type for /etc/amandates
type amanda_amandates_t, file_type, sysadmfile;
# type for /etc/dumpdates
type amanda_dumpdates_t, file_type, sysadmfile;
# type for amanda data
type amanda_data_t, file_type, sysadmfile;

# Domain transitions
####################

domain_auto_trans(inetd_t, amanda_inetd_exec_t, amanda_t)

##################
# File permissions
##################

# configuration files -> read only
allow amanda_t amanda_config_t:file { getattr read };
allow amanda_t amanda_config_t:dir { search };
# access to amanda_amandates_t
allow amanda_t amanda_amandates_t:file { getattr lock read write };
# access to amanda_dumpdates_t
allow amanda_t amanda_dumpdates_t:file { getattr lock read write };
# access to amandas data structure
allow amanda_t amanda_data_t:dir { read search write };
allow amanda_t amanda_data_t:file { read write };
# access to proc_t
allow amanda_t proc_t:dir { getattr search };
allow amanda_t proc_t:file { getattr read };
# access to etc_t and similar
allow amanda_t etc_t:dir { getattr search };
allow amanda_t etc_t:file { getattr read };
allow amanda_t resolv_conf_t:file { getattr read };
allow amanda_t etc_runtime_t:file { getattr read };
# access to var_t and similar
allow amanda_t var_t:dir { search };
allow amanda_t var_lib_t:dir { search };
allow amanda_t amanda_var_lib_t:dir { search };
# access to amanda_gnutarlists_t (/var/lib/amanda/gnutar-lists)
allow amanda_t amanda_gnutarlists_t:dir { add_name read remove_name search write };
allow amanda_t amanda_gnutarlists_t:file { create getattr read rename setattr unlink write };
# access to var_run_t
allow amanda_t var_run_t:dir { search };
# access to var_log_t
allow amanda_t var_log_t:dir { getattr };
# access to var_spool_t
allow amanda_t var_spool_t:dir { getattr };
# access to amanda_usr_lib_t
allow amanda_t amanda_usr_lib_t:dir { search };
# access to device_t and similar
allow amanda_t device_t:dir { search };
allow amanda_t null_device_t:chr_file { getattr read write };
allow amanda_t devpts_t:dir { getattr };
allow amanda_t fixed_disk_device_t:blk_file { getattr };
allow amanda_t removable_device_t:blk_file { getattr };
allow amanda_t devtty_t:chr_file { read write };
# access to boot_t
allow amanda_t boot_t:dir { getattr };
# access to fs_t
allow amanda_t fs_t:filesystem { getattr };
# access to sysctl_kernel_t ( proc/sys/kernel/* )
allow amanda_t sysctl_kernel_t:dir { search };
allow amanda_t sysctl_kernel_t:file { read };

#####################

# process permissions
#####################

# Allow to use shared libs
uses_shlib(amanda_t)

# Allow to execute a amanda executable file
allow amanda_t amanda_exec_t:file { execute execute_no_trans getattr read };

# Allow to run a shell
allow amanda_t shell_exec_t:file { execute execute_no_trans getattr read };

# access to bin_t (tar)
allow amanda_t bin_t:file { execute execute_no_trans };

allow amanda_t self:capability { chown dac_override setuid }; allow amanda_t self:process { fork sigchld };

###################################
# Network and process communication
###################################

can_network(amanda_t);

allow amanda_t self:fifo_file { getattr read write ioctl lock }; allow amanda_t self:unix_stream_socket { connect create read write };

##########################
# Communication with inetd
##########################

allow amanda_t inetd_t:udp_socket { read write };

###################

# inetd permissions
###################

allow inetd_t amanda_usr_lib_t:dir { search };

########################
# Access to to save data
########################

# access to user_home_t
allow amanda_t { user_home_dir_type user_home_type }:dir { search getattr read };
allow amanda_t user_home_type:file { getattr read };
# access to file_t ( /floppy, /cdrom )
allow amanda_t file_t:dir { getattr };

###########
# Dontaudit
###########
dontaudit amanda_t file_labels_t:dir { getattr read search }; dontaudit amanda_t file_labels_t:file { getattr read }; dontaudit amanda_t lost_found_t:dir { getattr read };

##############################################################################
# AMANDA RECOVER DECLARATIONS
##############################################################################

# General declarations
######################

# type for amrecover
type amanda_recover_t, domain;
role sysadm_r types { amanda_recover_t amanda_recover_dir_t };
# exec types for amrecover 
type amanda_recover_exec_t, file_type, sysadmfile, exec_type;
# type for recover files ( restored data )
type amanda_recover_dir_t, file_type, sysadmfile;
file_type_auto_trans(amanda_recover_t, sysadm_home_t, amanda_recover_dir_t)
# domain transsition
domain_auto_trans(sysadm_t, amanda_recover_exec_t, amanda_recover_t)
# file type auto trans to write debug messages
file_type_auto_trans(amanda_recover_t, tmp_t, amanda_tmp_t)
# amanda recover process permissions
####################################

uses_shlib(amanda_recover_t)
allow amanda_recover_t self:process { fork sigkill sigstop sigchld signal };
allow amanda_recover_t self:capability { fowner fsetid setgid setuid chown dac_override net_bind_service }; allow amanda_recover_t shell_exec_t:file { execute execute_no_trans getattr read };
allow amanda_recover_t local_login_t:fd { use };

# amrecover network and process communication
#############################################

# You can use this can_network or alternate the 8 out comment rules can_network(amanda_recover_t);
#allow amanda_recover_t self:tcp_socket { bind getattr connect create read write }; #allow amanda_recover_t self:udp_socket { connect create read write }; #allow amanda_recover_t any_socket_t:udp_socket { sendto };
#allow amanda_recover_t netif_eth0_t:netif { tcp_send udp_send }; #allow amanda_recover_t netmsg_eth0_t:tcp_socket { connectto recvfrom }; #allow amanda_recover_t netmsg_eth0_t:udp_socket { recvfrom };
#allow amanda_recover_t node_t:node { tcp_send udp_send };
#allow amanda_recover_t port_t:tcp_socket { name_bind };

allow amanda_recover_t self:fifo_file { getattr ioctl read write }; allow amanda_recover_t self:unix_stream_socket { connect create read write };

# amrecover file permissions
############################
# access to etc_t and similar
allow amanda_recover_t etc_t:dir { search };
allow amanda_recover_t etc_t:file { getattr read };
allow amanda_recover_t resolv_conf_t:file { getattr read };
allow amanda_recover_t etc_runtime_t:file { getattr read };
# access to amanda_recover_dir_t
#allow amanda_recover_t amanda_recover_dir_t:dir  create_dir_perms;
#allow amanda_recover_t amanda_recover_dir_t:file create_file_perms;
allow amanda_recover_t amanda_recover_dir_t:dir { add_name remove_name search write };
allow amanda_recover_t amanda_recover_dir_t:file { append create getattr setattr unlink };
# access to var_t and var_run_t
allow amanda_recover_t var_t:dir { search };
allow amanda_recover_t var_run_t:dir { search };
# access to proc_t
allow amanda_recover_t proc_t:dir { search };
allow amanda_recover_t proc_t:file { getattr read };
# access to sysctl_kernel_t
allow amanda_recover_t sysctl_kernel_t:dir { search };
allow amanda_recover_t sysctl_kernel_t:file { read };
# access to dev_t and similar
allow amanda_recover_t device_t:dir { search };
allow amanda_recover_t devtty_t:chr_file { read write };
allow amanda_recover_t null_device_t:chr_file { getattr write };
# access to bin_t
allow amanda_recover_t bin_t:file { execute execute_no_trans };
# access to sysadm_home_t to start amrecover in the sysadm_home_t:dir
allow amanda_recover_t sysadm_home_t:dir { search getattr };
# access to use sysadm_tty_device_t (/dev/tty?)
allow amanda_recover_t sysadm_tty_device_t:chr_file { getattr ioctl read write };
# access to amanda_tmp_t and tmp_t
allow amanda_recover_t amanda_tmp_t:dir { add_name remove_name search write };
allow amanda_recover_t amanda_tmp_t:file { append create getattr setattr unlink };
allow amanda_recover_t tmp_t:dir { search };
#2 lore raw

I am sorry about my dirty rules and I found still some mistakes.

The correct version is attached, but I can not test it, because my amanda runs on an server with an earlier release.

I am not sure, why you remove follow rule
allow amanda_t self:unix_dgram_socket ... ?

Am Dienstag, 27. August 2002 20:29 schrieb Russell Coker:

Quoted 9 lines · Carsten Grohmann
Quoted 1 line

I've attached the new rules for amanda. There are only little changes.

I've made some changes to amanda.te from my tree and attached it.

Note the use of privlog instead of discrete rules for syslog.

Also note that I've removed the CVS entries as they don't apply to the main tree.

#DESC Amanda backup
#
# This policy file sets the rigths for amanda client started by inetd_t

# and amrecover 
#
# Author     :  Carsten Grohmann <[email protected]>
#
# License    :  GPL
#
# last change:  27. August 2002
#
# state      :  complete and tested
#
# Hints      :
#  - amanda.fc is the appendant file context file
#  - If you use amrecover please extract the files and directories to the
#    directory speficified in amanda.fc as type amanda_recover_dir_t.
#  - The type amanda_user_exec_t is defined to label the files but not used.
#    This configuration works only as an client and a amanda client don't need
#    this programs.
#
# Enhancements/Corrections:
#  - set tighter permissions to /bin/tar instead bin_t 

##############################################################################
# AMANDA CLIENT DECLARATIONS
##############################################################################

# General declarations
######################

type amanda_t, domain, privlog;
role system_r types amanda_t;

# type for the amanda executables
type amanda_exec_t, file_type, sysadmfile, exec_type;
# type for the amanda executables started by inetd
type amanda_inetd_exec_t, file_type, sysadmfile, exec_type;
# type for amanda configurations files
type amanda_config_t, file_type, sysadmfile;
# type for files in /usr/lib/amanda
type amanda_usr_lib_t, file_type, sysadmfile;
# type for all files in /var/lib/amanda
type amanda_var_lib_t, file_type, sysadmfile;
# type for all files in /var/lib/amanda/gnutar-lists/
type amanda_gnutarlists_t, file_type, sysadmfile;
# type for user startable files
type amanda_user_exec_t, file_type, sysadmfile, exec_type;
# type for same awk and other scripts
type amanda_script_exec_t, file_type, sysadmfile, exec_type;
# type for the shell configuration files 
type amanda_shellconfig_t, file_type, sysadmfile;
# type for temporary files
type amanda_tmp_t, file_type, tmpfile, sysadmfile;
file_type_auto_trans(amanda_t, tmp_t, amanda_tmp_t)
# type for /etc/amandates
type amanda_amandates_t, file_type, sysadmfile;
# type for /etc/dumpdates
type amanda_dumpdates_t, file_type, sysadmfile;
# type for amanda data
type amanda_data_t, file_type, sysadmfile;

# Domain transitions
####################

domain_auto_trans(inetd_t, amanda_inetd_exec_t, amanda_t)

##################
# File permissions
##################

# configuration files -> read only
allow amanda_t amanda_config_t:file { getattr read };
allow amanda_t amanda_config_t:dir { search };
# access to amanda_amandates_t
allow amanda_t amanda_amandates_t:file { getattr lock read write };
# access to amanda_dumpdates_t
allow amanda_t amanda_dumpdates_t:file { getattr lock read write };
# access to amandas data structure
allow amanda_t amanda_data_t:dir { read search write };
allow amanda_t amanda_data_t:file { read write };
# access to proc_t
allow amanda_t proc_t:dir { getattr search };
allow amanda_t proc_t:file { getattr read };
# access to etc_t and similar
allow amanda_t etc_t:dir { getattr search };
allow amanda_t etc_t:file { getattr read };
allow amanda_t resolv_conf_t:file { getattr read };
allow amanda_t etc_runtime_t:file { getattr read };
# access to var_t and similar
allow amanda_t var_t:dir { search };
allow amanda_t var_lib_t:dir { search };
allow amanda_t amanda_var_lib_t:dir { search };
# access to amanda_gnutarlists_t (/var/lib/amanda/gnutar-lists)
allow amanda_t amanda_gnutarlists_t:dir { add_name read remove_name search write };
allow amanda_t amanda_gnutarlists_t:file { create getattr read rename setattr unlink write };
# access to var_run_t
allow amanda_t var_run_t:dir { search };
# access to var_log_t
allow amanda_t var_log_t:dir { getattr };
# access to var_spool_t
allow amanda_t var_spool_t:dir { getattr };
# access to amanda_usr_lib_t
allow amanda_t amanda_usr_lib_t:dir { search };
# access to device_t and similar
allow amanda_t device_t:dir { search };
allow amanda_t null_device_t:chr_file { getattr read write };
allow amanda_t devpts_t:dir { getattr };
allow amanda_t fixed_disk_device_t:blk_file { getattr };
allow amanda_t removable_device_t:blk_file { getattr };
allow amanda_t devtty_t:chr_file { read write };
# access to boot_t
allow amanda_t boot_t:dir { getattr };
# access to fs_t
allow amanda_t fs_t:filesystem { getattr };
# access to sysctl_kernel_t ( proc/sys/kernel/* )
allow amanda_t sysctl_kernel_t:dir { search };
allow amanda_t sysctl_kernel_t:file { read };

#####################

# process permissions
#####################

# Allow to use shared libs
uses_shlib(amanda_t)

# Allow to execute a amanda executable file
allow amanda_t amanda_exec_t:file { execute execute_no_trans getattr read };

# Allow to run a shell
allow amanda_t shell_exec_t:file { execute execute_no_trans getattr read };

# access to bin_t (tar)
allow amanda_t bin_t:file { execute execute_no_trans };

allow amanda_t self:capability { chown dac_override setuid }; allow amanda_t self:process { fork sigchld };

###################################
# Network and process communication
###################################

can_network(amanda_t);

allow amanda_t self:fifo_file { getattr read write ioctl lock }; allow amanda_t self:unix_stream_socket { connect create read write };

##########################
# Communication with inetd
##########################

allow amanda_t inetd_t:udp_socket { read write };

###################

# inetd permissions
###################

allow inetd_t amanda_usr_lib_t:dir { search };

########################
# Access to to save data
########################

# access to user_home_t
allow amanda_t { user_home_dir_t user_home_t }:dir { search getattr read };
allow amanda_t user_home_t:file { getattr read };
# access to file_t ( /floppy, /cdrom )
allow amanda_t file_t:dir { getattr };

###########
# Dontaudit
###########

dontaudit amanda_t file_labels_t:dir { getattr read search }; dontaudit amanda_t file_labels_t:file { getattr read }; dontaudit amanda_t lost_found_t:dir { getattr read };

##############################################################################
# AMANDA RECOVER DECLARATIONS
##############################################################################

# General declarations
######################

# type for amrecover
type amanda_recover_t, domain;
role sysadm_r types { amanda_recover_t amanda_recover_dir_t };
# exec types for amrecover 
type amanda_recover_exec_t, file_type, sysadmfile, exec_type;
# type for recover files ( restored data )
type amanda_recover_dir_t, file_type, sysadmfile;
file_type_auto_trans(amanda_recover_t, sysadm_home_dir_t, amanda_recover_dir_t)
# domain transsition
domain_auto_trans(sysadm_t, amanda_recover_exec_t, amanda_recover_t)
# file type auto trans to write debug messages
file_type_auto_trans(amanda_recover_t, tmp_t, amanda_tmp_t)
# amanda recover process permissions
####################################

uses_shlib(amanda_recover_t)
allow amanda_recover_t self:process { fork sigkill sigstop sigchld signal };
allow amanda_recover_t self:capability { fowner fsetid setgid setuid chown dac_override net_bind_service }; allow amanda_recover_t shell_exec_t:file { execute execute_no_trans getattr read };
allow amanda_recover_t local_login_t:fd { use };

# amrecover network and process communication
#############################################

can_network(amanda_recover_t);

allow amanda_recover_t self:fifo_file { getattr ioctl read write }; allow amanda_recover_t self:unix_stream_socket { connect create read write };

# amrecover file permissions
############################
# access to etc_t and similar
allow amanda_recover_t etc_t:dir { search };
allow amanda_recover_t etc_t:file { getattr read };
allow amanda_recover_t resolv_conf_t:file { getattr read };
allow amanda_recover_t etc_runtime_t:file { getattr read };
# access to amanda_recover_dir_t
allow amanda_recover_t amanda_recover_dir_t:dir { add_name remove_name search write };
allow amanda_recover_t amanda_recover_dir_t:file { append create getattr setattr unlink };
# access to var_t and var_run_t
allow amanda_recover_t var_t:dir { search };
allow amanda_recover_t var_run_t:dir { search };
# access to proc_t
allow amanda_recover_t proc_t:dir { search };
allow amanda_recover_t proc_t:file { getattr read };
# access to sysctl_kernel_t
allow amanda_recover_t sysctl_kernel_t:dir { search };
allow amanda_recover_t sysctl_kernel_t:file { read };
# access to dev_t and similar
allow amanda_recover_t device_t:dir { search };
allow amanda_recover_t devtty_t:chr_file { read write };
allow amanda_recover_t null_device_t:chr_file { getattr write };
# access to bin_t
allow amanda_recover_t bin_t:file { execute execute_no_trans };
# access to sysadm_home_t and sysadm_home_dir_t to start amrecover 
# in the sysadm home directory
allow amanda_recover_t { sysadm_home_dir_t sysadm_home_t }:dir { search getattr };
# access to use sysadm_tty_device_t (/dev/tty?)
allow amanda_recover_t sysadm_tty_device_t:chr_file { getattr ioctl read write };
# access to amanda_tmp_t and tmp_t
allow amanda_recover_t amanda_tmp_t:dir { add_name remove_name search write };
allow amanda_recover_t amanda_tmp_t:file { append create getattr setattr unlink };
allow amanda_recover_t tmp_t:dir { search };
#3 lore raw

The updated amanda.te file has been merged and is available in the sourceforge CVS tree.

--
Stephen D. Smalley, NAI Labs
[email protected]

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.