Skip to contentSkip to conversation

openvpn policy

PATCH In review Colin Walters 2 participants 3 messages Jul 25, 2004 – Jul 26, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openvpn policy

Hi,

Attached is a policy for OpenVPN (http://openvpn.sf.net). The last two parts of openvpn.te seem just slightly unclean; if anyone sees a better way, let me know.

I've only tested a simple configuration with pre-shared static keys.

(OT, but: OpenVPN is really cool.)

#DESC OpenVPN - Firewall-friendly SSL-based VPN
#
# Author: Colin Walters <[email protected]>
#
########################################
#

daemon_domain(openvpn)
etcdir_domain(openvpn)

type openvpn_port_t, port_type;

allow openvpn_t { etc_t etc_runtime_t }:{ file lnk_file } r_file_perms;

allow openvpn_t { random_device_t urandom_device_t }:chr_file { read getattr }; allow openvpn_t devpts_t:dir { search getattr };
allow openvpn_t tun_tap_device_t:chr_file rw_file_perms;
allow openvpn_t proc_t:file { getattr read };

allow openvpn_t self:unix_dgram_socket create_socket_perms; allow openvpn_t self:unix_stream_socket create_stream_socket_perms; allow openvpn_t self:unix_dgram_socket sendto;
allow openvpn_t self:unix_stream_socket connectto;
allow openvpn_t self:capability { net_admin }; r_dir_file(openvpn_t, sysctl_net_t)

can_network(openvpn_t)
allow openvpn_t openvpn_port_t:udp_socket { name_bind };

# OpenVPN executes a lot of helper programs and scripts allow openvpn_t { bin_t sbin_t }:dir { search getattr }; allow openvpn_t bin_t:lnk_file { getattr read }; can_exec(openvpn_t, { bin_t sbin_t shell_exec_t }) # Do not transition to ifconfig_t, since then it needs

# permission to access openvpn_t:udp_socket, which seems
# worse.
can_exec(openvpn_t, ifconfig_exec_t)

# The Fedora init script iterates over /etc/openvpn/*.conf, and

# starts a daemon for each file.
r_dir_file(initrc_t, openvpn_etc_t)

# OpenVPN

/etc/openvpn(/*)? -- system_u:object_r:openvpn_etc_t
/usr/sbin/openvpn -- system_u:object_r:openvpn_exec_t

* modified files

net_contexts +3 -0
@@ -190,6 +190,9 @@
 portcon tcp 8080  system_u:object_r:http_cache_port_t
 portcon udp 3130  system_u:object_r:http_cache_port_t
 ')
+ifdef(`openvpn.te', `
+portcon udp 5000 system_u:object_r:openvpn_port_t
+')
 ifdef(`transproxy.te', `portcon tcp 8081 system_u:object_r:transproxy_port_t')
 ifdef(`amanda.te', `
 portcon udp 10080 system_u:object_r:amanda_port_t
#1 lore raw
Quoted 3 lines · Colin Walters

Attached is a policy for OpenVPN (http://openvpn.sf.net). The last two parts of openvpn.te seem just slightly unclean; if anyone sees a better way, let me know.

That seems OK to me. It is good to minimise the access that initrc_t gets to daemon configuration files, but it's not a big deal IMHO (it seems a fairly standard thing to do).

Signature · 9 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

--
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.
#2 lore raw
In reply to Colin Walters

On Sun, 2004-07-25 at 19:50 -0400, Colin Walters wrote:

openvpn.fc:

Quoted 1 line

/etc/openvpn/(/*) -- system_u:object_r:openvpn_etc_t

Ooops, obviously that should be:

/etc/openvpn(/.*)? -- system_u:object_r:openvpn_etc_t

--
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.