Chris PeBenito b16c6b
## <summary>Policy controlling access to storage devices</summary>
Chris PeBenito b16c6b
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to get the attributes of fixed disk
Chris PeBenito 414e41
##	device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`storage_getattr_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
		class blk_file getattr;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 fixed_disk_device_t:blk_file getattr;
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Do not audit attempts made by the caller to get
Chris PeBenito 414e41
##	the attributes of fixed disk device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process to not audit.
Chris PeBenito 414e41
## </param>
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`storage_dontaudit_getattr_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
		class blk_file getattr;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 fixed_disk_device_t:blk_file getattr;
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to set the attributes of fixed disk
Chris PeBenito 414e41
##	device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`storage_setattr_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
		class blk_file setattr;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 fixed_disk_device_t:blk_file setattr;
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito d35c62
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Do not audit attempts made by the caller to set
Chris PeBenito 414e41
##	the attributes of fixed disk device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process to not audit.
Chris PeBenito 414e41
## </param>
Chris PeBenito d35c62
#
Chris PeBenito 199895
interface(`storage_dontaudit_setattr_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Chris PeBenito 2e0a88
	dontaudit $1 fixed_disk_device_t:blk_file setattr;
Chris PeBenito b16c6b
')
Chris PeBenito e181fe
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read from a fixed disk.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_raw_read_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute fixed_disk_raw_read;
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
		class blk_file r_file_perms;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 fixed_disk_device_t:blk_file r_file_perms;
Chris PeBenito 0c73cd
	typeattribute $1 fixed_disk_raw_read;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 494e98
########################################
Chris PeBenito 25c674
## <summary>
Chris PeBenito 25c674
##	Do not audit attempts made by the caller to read
Chris PeBenito 25c674
##	fixed disk device nodes.
Chris PeBenito 25c674
## </summary>
Chris PeBenito 25c674
## <param name="domain">
Chris PeBenito 25c674
##	The type of the process to not audit.
Chris PeBenito 25c674
## </param>
Chris PeBenito 25c674
#
Chris PeBenito 25c674
interface(`storage_dontaudit_read_fixed_disk',`
Chris PeBenito 25c674
	gen_require(`
Chris PeBenito 25c674
		type fixed_disk_device_t;
Chris PeBenito 25c674
		
Chris PeBenito 25c674
	')
Chris PeBenito 25c674
Chris PeBenito 25c674
	dontaudit $1 fixed_disk_device_t:blk_file { getattr ioctl read };
Chris PeBenito 25c674
')
Chris PeBenito 25c674
Chris PeBenito 25c674
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly write to a fixed disk.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_raw_write_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute fixed_disk_raw_write;
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito e6a2ea
	allow $1 fixed_disk_device_t:blk_file { getattr write append ioctl };
Chris PeBenito 0c73cd
	typeattribute $1 fixed_disk_raw_write;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Create block devices in /dev with the fixed disk type.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito f5c42b
#
Chris PeBenito 8fd367
interface(`storage_create_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
		class blk_file create_file_perms;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 fixed_disk_device_t:blk_file create_file_perms;
Chris PeBenito 9d5949
	dev_filetrans_dev_node($1,fixed_disk_device_t,blk_file)
Chris PeBenito 0c73cd
	typeattribute $1 fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito f5c42b
########################################
Chris PeBenito 783b38
## <summary>
Chris PeBenito 414e41
##	Create, read, write, and delete fixed disk device nodes.
Chris PeBenito 783b38
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito f5c42b
#
Chris PeBenito 199895
interface(`storage_manage_fixed_disk',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito d35c62
		type fixed_disk_device_t;
Chris PeBenito d35c62
		class blk_file create_file_perms;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 fixed_disk_device_t:blk_file create_file_perms;
Chris PeBenito 0c73cd
	typeattribute $1 fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito f5c42b
########################################
Chris PeBenito 783b38
## <summary>
Chris PeBenito a42ca7
##	Create fixed disk device nodes on a tmpfs filesystem.
Chris PeBenito a42ca7
## </summary>
Chris PeBenito a42ca7
## <param name="domain">
Chris PeBenito a42ca7
##	The type of the process performing this action.
Chris PeBenito a42ca7
## </param>
Chris PeBenito a42ca7
#
Chris PeBenito a42ca7
interface(`storage_create_fixed_disk_tmpfs',`
Chris PeBenito a42ca7
	gen_require(`
Chris PeBenito a42ca7
		attribute fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito a42ca7
		type fixed_disk_device_t;
Chris PeBenito a42ca7
		class blk_file create_file_perms;
Chris PeBenito a42ca7
	')
Chris PeBenito a42ca7
Chris PeBenito a42ca7
	allow $1 fixed_disk_device_t:blk_file create_file_perms;
Chris PeBenito 9d5949
	fs_filetrans_tmpfs($1,fixed_disk_device_t,blk_file)
Chris PeBenito a42ca7
Chris PeBenito a42ca7
	typeattribute $1 fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito a42ca7
########################################
Chris PeBenito a42ca7
## <summary>
Chris PeBenito 783b38
##	Relabel fixed disk device nodes.
Chris PeBenito 783b38
## </summary>
Chris PeBenito 783b38
## <param name="domain">
Chris PeBenito 783b38
##	The type of the process performing this action.
Chris PeBenito 783b38
## </param>
Chris PeBenito 783b38
#
Chris PeBenito 783b38
interface(`storage_relabel_fixed_disk',`
Chris PeBenito 783b38
	gen_require(`
Chris PeBenito 783b38
		type fixed_disk_device_t;
Chris PeBenito 783b38
		class blk_file { relabelfrom relabelto };
Chris PeBenito 783b38
	')
Chris PeBenito 783b38
Chris PeBenito 783b38
	dev_list_all_dev_nodes($1)
Chris PeBenito 783b38
	allow $1 fixed_disk_device_t:blk_file { relabelfrom relabelto };
Chris PeBenito 783b38
')
Chris PeBenito 783b38
Chris PeBenito 783b38
########################################
Chris PeBenito 783b38
## <summary>
Chris PeBenito 783b38
##	Enable a fixed disk device as swap space
Chris PeBenito 783b38
## </summary>
Chris PeBenito 783b38
## <param name="domain">
Chris PeBenito 783b38
##	The type of the process performing this action.
Chris PeBenito 783b38
## </param>
Chris PeBenito 783b38
#
Chris PeBenito 783b38
interface(`storage_swapon_fixed_disk',`
Chris PeBenito 783b38
	gen_require(`
Chris PeBenito 783b38
		type fixed_disk_device_t;
Chris PeBenito 783b38
		class blk_file { getattr swapon };
Chris PeBenito 783b38
	')
Chris PeBenito 783b38
Chris PeBenito 783b38
	dev_list_all_dev_nodes($1)
Chris PeBenito 783b38
	allow $1 fixed_disk_device_t:blk_file { getattr swapon };
Chris PeBenito 783b38
')
Chris PeBenito 783b38
Chris PeBenito 783b38
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read from a logical volume.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8e0280
#
Chris PeBenito 199895
interface(`storage_raw_read_lvm_volume',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute fixed_disk_raw_read;
Chris PeBenito d35c62
		type lvm_vg_t;
Chris PeBenito d35c62
		class blk_file r_file_perms;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 lvm_vg_t:blk_file r_file_perms;
Chris PeBenito 0c73cd
	typeattribute $1 fixed_disk_raw_read;
Chris PeBenito 8e0280
')
Chris PeBenito 8e0280
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read from a logical volume.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8e0280
#
Chris PeBenito 199895
interface(`storage_raw_write_lvm_volume',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute fixed_disk_raw_write;
Chris PeBenito d35c62
		type lvm_vg_t;
Chris PeBenito d35c62
		class blk_file { getattr write ioctl };
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 lvm_vg_t:blk_file { getattr write ioctl };
Chris PeBenito 0c73cd
	typeattribute $1 fixed_disk_raw_write;
Chris PeBenito 8e0280
')
Chris PeBenito 8e0280
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to get the attributes of
Chris PeBenito 414e41
##	the generic SCSI interface device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 7a2f20
#
Chris PeBenito 199895
interface(`storage_getattr_scsi_generic',`
Chris PeBenito 7a2f20
	gen_require(`
Chris PeBenito 7a2f20
		type scsi_generic_device_t;
Chris PeBenito 7a2f20
	')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 scsi_generic_device_t:chr_file getattr;
Chris PeBenito 7a2f20
')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to set the attributes of
Chris PeBenito 414e41
##	the generic SCSI interface device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 7a2f20
#
Chris PeBenito 199895
interface(`storage_setattr_scsi_generic',`
Chris PeBenito 7a2f20
	gen_require(`
Chris PeBenito 7a2f20
		type scsi_generic_device_t;
Chris PeBenito 7a2f20
	')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 scsi_generic_device_t:chr_file setattr;
Chris PeBenito 7a2f20
')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read, in a
Chris PeBenito 414e41
##	generic fashion, from any SCSI device.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_read_scsi_generic',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute scsi_generic_read;
Chris PeBenito d35c62
		type scsi_generic_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 842859
	allow $1 scsi_generic_device_t:chr_file r_file_perms;
Chris PeBenito 0c73cd
	typeattribute $1 scsi_generic_read;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly write, in a
Chris PeBenito 414e41
##	generic fashion, from any SCSI device.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_write_scsi_generic',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		attribute scsi_generic_write;
Chris PeBenito d35c62
		type scsi_generic_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 scsi_generic_device_t:chr_file { getattr write ioctl };
Chris PeBenito 0c73cd
	typeattribute $1 scsi_generic_write;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Set attributes of the device nodes
Chris PeBenito 414e41
##	for the SCSI generic inerface.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8a0da1
#
Chris PeBenito 199895
interface(`storage_set_scsi_generic_attributes',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type scsi_generic_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 scsi_generic_device_t:chr_file setattr;
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to get the attributes of removable
Chris PeBenito 414e41
##	devices device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_getattr_removable_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type removable_device_t;
Chris PeBenito d35c62
		class blk_file getattr;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 removable_device_t:blk_file getattr;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 494e98
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Do not audit attempts made by the caller to get
Chris PeBenito 414e41
##	the attributes of removable devices device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process to not audit.
Chris PeBenito 414e41
## </param>
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`storage_dontaudit_getattr_removable_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type removable_device_t;
Chris PeBenito d35c62
		class blk_file getattr;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 removable_device_t:blk_file getattr;
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito b4cd15
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito ccc597
##	Do not audit attempts made by the caller to read
Chris PeBenito ccc597
##	removable devices device nodes.
Chris PeBenito ccc597
## </summary>
Chris PeBenito ccc597
## <param name="domain">
Chris PeBenito ccc597
##	The type of the process to not audit.
Chris PeBenito ccc597
## </param>
Chris PeBenito ccc597
#
Chris PeBenito ccc597
interface(`storage_dontaudit_read_removable_device',`
Chris PeBenito ccc597
	gen_require(`
Chris PeBenito ccc597
		type removable_device_t;
Chris PeBenito ccc597
		class blk_file { getattr ioctl read };
Chris PeBenito ccc597
		
Chris PeBenito ccc597
	')
Chris PeBenito ccc597
Chris PeBenito ccc597
	dontaudit $1 removable_device_t:blk_file { getattr ioctl read };
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
########################################
Chris PeBenito ccc597
## <summary>
Chris PeBenito 414e41
##	Allow the caller to set the attributes of removable
Chris PeBenito 414e41
##	devices device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_setattr_removable_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type removable_device_t;
Chris PeBenito d35c62
		class blk_file setattr;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 removable_device_t:blk_file setattr;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Do not audit attempts made by the caller to set
Chris PeBenito 414e41
##	the attributes of removable devices device nodes.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process to not audit.
Chris PeBenito 414e41
## </param>
Chris PeBenito 7a2f20
#
Chris PeBenito 199895
interface(`storage_dontaudit_setattr_removable_device',`
Chris PeBenito 7a2f20
	gen_require(`
Chris PeBenito 7a2f20
		type removable_device_t;
Chris PeBenito 7a2f20
		class blk_file setattr;
Chris PeBenito 7a2f20
	')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
	dontaudit $1 removable_device_t:blk_file setattr;
Chris PeBenito 7a2f20
')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read from
Chris PeBenito 414e41
##	a removable device.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8a0da1
#
Chris PeBenito 199895
interface(`storage_raw_read_removable_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type removable_device_t;
Chris PeBenito d35c62
		class blk_file r_file_perms;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 removable_device_t:blk_file r_file_perms;
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 8a0da1
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly write to
Chris PeBenito 414e41
##	a removable device.
Chris PeBenito 414e41
##	This is extremly dangerous as it can bypass the
Chris PeBenito 414e41
##	SELinux protections for filesystem objects, and
Chris PeBenito 414e41
##	should only be used by trusted domains.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8a0da1
#
Chris PeBenito 199895
interface(`storage_raw_write_removable_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type removable_device_t;
Chris PeBenito d35c62
		class blk_file { getattr write ioctl };
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 0c73cd
	allow $1 removable_device_t:blk_file { getattr write ioctl };
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 8a0da1
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read
Chris PeBenito 414e41
##	a tape device.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_read_tape_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type tape_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito 842859
	allow $1 tape_device_t:chr_file r_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to directly read
Chris PeBenito 414e41
##	a tape device.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`storage_write_tape_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type tape_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 tape_device_t:chr_file { getattr write ioctl };
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 8a0da1
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to get the attributes
Chris PeBenito 414e41
##	of device nodes of tape devices.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8a0da1
#
Chris PeBenito 199895
interface(`storage_getattr_tape_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type tape_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 tape_device_t:chr_file getattr;
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 8a0da1
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 414e41
##	Allow the caller to set the attributes
Chris PeBenito 414e41
##	of device nodes of tape devices.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 414e41
##	The type of the process performing this action.
Chris PeBenito 414e41
## </param>
Chris PeBenito 8a0da1
#
Chris PeBenito 199895
interface(`storage_setattr_tape_device',`
Chris PeBenito d35c62
	gen_require(`
Chris PeBenito d35c62
		type tape_device_t;
Chris PeBenito d35c62
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito a5ec7c
	allow $1 tape_device_t:chr_file setattr;
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 9726b3
########################################
Chris PeBenito 9726b3
## <summary>
Chris PeBenito 9726b3
##	Unconfined access to storage devices.
Chris PeBenito 9726b3
## </summary>
Chris PeBenito 9726b3
## <param name="domain">
Chris PeBenito 9726b3
##	Domain allowed access.
Chris PeBenito 9726b3
## </param>
Chris PeBenito 9726b3
#
Chris PeBenito 9726b3
interface(`storage_unconfined',`
Chris PeBenito 9726b3
	gen_require(`
Chris PeBenito 9726b3
		type fixed_disk_device_t, removable_device_t;
Chris PeBenito 9726b3
		type lvm_vg_t, scsi_generic_device_t, tape_device_t;
Chris PeBenito 71fe0f
		attribute fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito 71fe0f
		attribute scsi_generic_read, scsi_generic_write;
Chris PeBenito 9726b3
	')
Chris PeBenito 9726b3
Chris PeBenito a5ec7c
	allow $1 { fixed_disk_device_t removable_device_t lvm_vg_t }:blk_file *;
Chris PeBenito a5ec7c
	allow $1 { scsi_generic_device_t tape_device_t }:chr_file *;
Chris PeBenito 9726b3
Chris PeBenito 9726b3
	typeattribute $1 fixed_disk_raw_read, fixed_disk_raw_write;
Chris PeBenito 9726b3
	typeattribute $1 scsi_generic_read, scsi_generic_write;
Chris PeBenito 9726b3
')