From: max@duempel.org (Max Kellermann)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] new policy: rtorrent
Date: Thu, 9 Jul 2009 11:58:17 +0200 [thread overview]
Message-ID: <20090709095817.GA7703@squirrel.roonstrasse.net> (raw)
Hi,
I have written a policy for rtorrent a while ago, and I thought it
might be a good idea to submit it to the refpolicy project. Here it
is.
The policy defines the rtorrent_data_t type, but does not declare a
fcontext for it. Users who want to use it have to manually tag the
data directory. Another idea might be to provide a "reasonable"
default... on my machine, that's declared in the host specific policy
.fc file.
Max
-------------- next part --------------
policy_module(rtorrent,1.0.0)
type rtorrent_t;
type rtorrent_exec_t;
application_domain(rtorrent_t, rtorrent_exec_t)
ubac_constrained(rtorrent_t)
type rtorrent_conf_t;
files_config_file(rtorrent_conf_t)
type rtorrent_data_t;
files_type(rtorrent_data_t)
# shared libraries
libs_use_ld_so(rtorrent_t)
libs_use_shared_libs(rtorrent_t)
# rtorrent is an interactive program
domain_use_interactive_fds(rtorrent_t)
userdom_use_user_terminals(rtorrent_t)
# grant locale + resolver read access
miscfiles_read_localization(rtorrent_t)
sysnet_read_config(rtorrent_t)
sysnet_dns_name_resolve(rtorrent_t)
optional_policy(`
nscd_socket_use(rtorrent_t)
')
# read config files
userdom_search_user_home_dirs(rtorrent_t)
userdom_dontaudit_list_user_home_dirs(rtorrent_t)
read_files_pattern(rtorrent_t, rtorrent_conf_t, rtorrent_conf_t)
# manage data files
allow rtorrent_t rtorrent_data_t:dir manage_dir_perms;
allow rtorrent_t rtorrent_data_t:file manage_file_perms;
# network access
allow rtorrent_t self:tcp_socket create_stream_socket_perms;
allow rtorrent_t self:udp_socket create_socket_perms;
corenet_tcp_bind_all_ports(rtorrent_t)
corenet_tcp_bind_all_nodes(rtorrent_t)
corenet_tcp_connect_all_ports(rtorrent_t)
corenet_tcp_sendrecv_all_ports(rtorrent_t)
corenet_udp_bind_all_ports(rtorrent_t)
corenet_udp_bind_all_nodes(rtorrent_t)
corenet_udp_sendrecv_all_ports(rtorrent_t)
# rtorrent wants to know how much disk space is available
fs_getattr_xattr_fs(rtorrent_t)
files_dontaudit_getattr_all_dirs(rtorrent_t)
# misc
allow rtorrent_t self:process signal;
dev_read_urand(rtorrent_t)
# some dontaudit rules
gen_require(`
type etc_t;
')
dontaudit rtorrent_t etc_t:file read_file_perms;
dontaudit rtorrent_t self:netlink_route_socket create_stream_socket_perms;
-------------- next part --------------
## <summary>rtorrent client policy</summary>
########################################
## <summary>
## Role access for rtorrent
## </summary>
## <param name="role">
## <summary>
## Role allowed access
## </summary>
## </param>
## <param name="domain">
## <summary>
## User domain for the role
## </summary>
## </param>
#
template(`rtorrent_role',`
gen_require(`
type rtorrent_t;
type rtorrent_exec_t;
type rtorrent_conf_t;
type rtorrent_data_t;
')
role $1 types rtorrent_t;
# Transition from the user domain to the derived domain.
domtrans_pattern($2, rtorrent_exec_t, rtorrent_t)
# allow ps to show rtorrent
ps_process_pattern($2, rtorrent_t)
allow $2 rtorrent_t:process signal;
# user can manage config
manage_files_pattern($2, rtorrent_conf_t, rtorrent_conf_t)
# Access the torrent data files.
allow $2 rtorrent_data_t:dir manage_dir_perms;
allow $2 rtorrent_data_t:file manage_file_perms;
')
-------------- next part --------------
/usr/bin/rtorrent -- gen_context(system_u:object_r:rtorrent_exec_t,s0)
HOME_DIR/\.rtorrent.rc gen_context(system_u:object_r:rtorrent_conf_t,s0)
next reply other threads:[~2009-07-09 9:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-09 9:58 Max Kellermann [this message]
2009-07-09 12:21 ` [refpolicy] new policy: rtorrent Dominick Grift
2009-07-09 12:31 ` Dominick Grift
2009-07-17 9:09 ` Max Kellermann
2009-07-17 9:58 ` Dominick Grift
2009-07-14 13:22 ` Christopher J. PeBenito
2009-07-17 9:13 ` Max Kellermann
2009-07-17 10:21 ` Dominick 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=20090709095817.GA7703@squirrel.roonstrasse.net \
--to=max@duempel.org \
--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.